X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e8a7500b69476b76f596e2a52209fd1abdd1969d..5193d31089b0e9d2a564d425f61fdbc27e01af60:/src/smpi/smpi_global.cpp diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index ff7c129f1b..7f62db8e9e 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -95,7 +95,10 @@ int smpi_process_count() simgrid::smpi::Process* smpi_process() { - simgrid::MsgActorExt* msgExt = static_cast(SIMIX_process_self()->data); + smx_actor_t me = SIMIX_process_self(); + if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) + return nullptr; + simgrid::MsgActorExt* msgExt = static_cast(me->data); return static_cast(msgExt->data); } @@ -573,9 +576,12 @@ int smpi_main(const char* executable, int argc, char *argv[]) xbt_assert(fdout >= 0, "Cannot write into %s", target_executable.c_str()); #if HAVE_SENDFILE - sendfile(fdout, fdin, NULL, fdin_size); + ssize_t sent_size = sendfile(fdout, fdin, NULL, fdin_size); + xbt_assert(sent_size == fdin_size, + "Error while copying %s: only %zd bytes copied instead of %ld (errno: %d -- %s)", + target_executable.c_str(), sent_size, fdin_size, errno, strerror(errno)); #else - XBT_WARN("Copy %d bytes into %s", static_cast(fdin_size), target_executable.c_str()); + XBT_VERB("Copy %d bytes into %s", static_cast(fdin_size), target_executable.c_str()); const int bufsize = 1024 * 1024 * 4; char buf[bufsize]; while (int got = read(fdin, buf, bufsize)) { @@ -600,7 +606,8 @@ int smpi_main(const char* executable, int argc, char *argv[]) // Load the copy and resolve the entry point: void* handle = dlopen(target_executable.c_str(), RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND); - unlink(target_executable.c_str()); + if (xbt_cfg_get_boolean("smpi/keep-temps") == false) + unlink(target_executable.c_str()); if (handle == nullptr) xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), errno, strerror(errno)); smpi_entry_point_type entry_point = smpi_resolve_function(handle);