X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/409fd38ea33967d5d473264211982b144933cb86..b355e26d385e1e8d0f73aeb8a6283385dda6f9a3:/src/sthread/sthread_impl.cpp diff --git a/src/sthread/sthread_impl.cpp b/src/sthread/sthread_impl.cpp index df1854109b..d1a88a7038 100644 --- a/src/sthread/sthread_impl.cpp +++ b/src/sthread/sthread_impl.cpp @@ -27,6 +27,12 @@ static sg4::Host* lilibeth = nullptr; int sthread_main(int argc, char** argv, char** envp, int (*raw_main)(int, char**, char**)) { + /* Do not intercept the main when run from SMPI: it will initialize the simulation properly */ + for (int i = 0; envp[i] != nullptr; i++) + if (strncmp(envp[i], "SMPI_GLOBAL_SIZE", strlen("SMPI_GLOBAL_SIZE")) == 0) + return raw_main(argc, argv, envp); + + /* If not in SMPI, the old main becomes an actor in a newly created simulation */ std::ostringstream id; id << std::this_thread::get_id();