X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4d140762b2b9c8746cdd3b0680a7167867ba0ad9..1fc042e8bc9c51f9267fa1936deaebe59ae01ee7:/src/smpi/internals/smpi_process.cpp?ds=sidebyside diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index 451f3cf9d8..d073614dad 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -3,16 +3,14 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "smpi_process.hpp" #include "mc/mc.h" -#include "src/mc/mc_replay.h" -#include "src/msg/msg_private.h" -#include "src/simix/smx_private.h" -#include "private.h" #include "private.hpp" -#include "smpi_process.hpp" -#include "smpi_group.hpp" #include "smpi_comm.hpp" - +#include "smpi_group.hpp" +#include "src/mc/mc_replay.h" +#include "src/msg/msg_private.hpp" +#include "src/simix/smx_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_process, smpi, "Logging specific to SMPI (kernel)"); @@ -24,13 +22,13 @@ extern int* index_to_process_data; static char *get_mailbox_name(char *str, int index) { - snprintf(str, MAILBOX_NAME_MAXLEN, "SMPI-%0*x", static_cast (sizeof(int) * 2), index); + snprintf(str, MAILBOX_NAME_MAXLEN, "SMPI-%0*x", static_cast(sizeof(int) * 2), static_cast(index)); return str; } static char *get_mailbox_name_small(char *str, int index) { - snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", static_cast (sizeof(int) * 2), index); + snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", static_cast(sizeof(int) * 2), static_cast(index)); return str; } @@ -158,10 +156,8 @@ smx_actor_t Process::process(){ return process_; } - /** - * \brief Returns a structure that stores the location (filename + linenumber) - * of the last calls to MPI_* functions. + * \brief Returns a structure that stores the location (filename + linenumber) of the last calls to MPI_* functions. * * \see smpi_trace_set_call_location */ @@ -281,8 +277,12 @@ void Process::init(int *argc, char ***argv){ } char* instance_id = (*argv)[1]; - int rank = xbt_str_parse_int((*argv)[2], "Invalid rank: %s"); - smpi_deployment_register_process(instance_id, rank, index); + try { + int rank = std::stoi(std::string((*argv)[2])); + smpi_deployment_register_process(instance_id, rank, index); + } catch (std::invalid_argument& ia) { + throw std::invalid_argument(std::string("Invalid rank: ") + (*argv)[2]); + } if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ /* Now using segment index of the process */