Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 12 Apr 2017 06:44:48 +0000 (08:44 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 12 Apr 2017 06:44:48 +0000 (08:44 +0200)
72 files changed:
.gitignore
.travis.yml
CMakeLists.txt
doc/doxygen/tutorial_msg.doc
examples/s4u/dht-chord/s4u_dht-chord.hpp
include/smpi/smpi.h
include/smpi/smpi_extended_traces.h
include/smpi/smpi_extended_traces_fortran.h
src/mc/Process.cpp
src/mc/Session.cpp
src/mc/VisitedState.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/mc_request.cpp
src/mc/remote/Client.cpp
src/simgrid/sg_config.cpp
src/simix/ActorImpl.cpp
src/simix/smx_global.cpp
src/smpi/private.h
src/smpi/smpi_bench.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_datatype.cpp
src/smpi/smpi_global.cpp
src/smpi/smpi_main.c [new file with mode: 0644]
src/smpi/smpi_memory.cpp
src/smpi/smpi_pmpi.cpp
src/smpi/smpi_process.cpp
src/smpi/smpi_process.hpp
src/smpi/smpi_replay.cpp
src/smpi/smpi_request.cpp
src/smpi/smpicc.in
src/smpi/smpicxx.in
src/smpi/smpif90.in
src/smpi/smpiff.in
src/smpi/smpirun.in
src/xbt/dict.cpp
src/xbt/dict_elm.c
src/xbt/dict_private.h
teshsuite/smpi/bug-17132/bug-17132.tesh
teshsuite/smpi/coll-allgather/coll-allgather.tesh
teshsuite/smpi/coll-allgatherv/coll-allgatherv.tesh
teshsuite/smpi/coll-allreduce/coll-allreduce-automatic.tesh
teshsuite/smpi/coll-allreduce/coll-allreduce-large.tesh
teshsuite/smpi/coll-allreduce/coll-allreduce.tesh
teshsuite/smpi/coll-alltoall/clusters.tesh
teshsuite/smpi/coll-alltoall/coll-alltoall.tesh
teshsuite/smpi/coll-alltoallv/coll-alltoallv.tesh
teshsuite/smpi/coll-barrier/coll-barrier.tesh
teshsuite/smpi/coll-bcast/coll-bcast.tesh
teshsuite/smpi/coll-gather/coll-gather.tesh
teshsuite/smpi/coll-reduce-scatter/coll-reduce-scatter.tesh
teshsuite/smpi/coll-reduce/coll-reduce.tesh
teshsuite/smpi/coll-scatter/coll-scatter.tesh
teshsuite/smpi/isp/umpire/CMakeLists.txt
teshsuite/smpi/macro-sample/macro-sample.tesh
teshsuite/smpi/macro-shared/macro-shared.tesh
teshsuite/smpi/mpich3-test/pt2pt/CMakeLists.txt
teshsuite/smpi/mpich3-test/pt2pt/huge_anysrc.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/pt2pt/huge_underflow.c [new file with mode: 0644]
teshsuite/smpi/mpich3-test/pt2pt/testlist
teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.tesh
teshsuite/smpi/pt2pt-pingpong/TI_output.tesh
teshsuite/smpi/pt2pt-pingpong/broken_hostfiles.tesh
teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.tesh
teshsuite/smpi/timers/timers.tesh
teshsuite/smpi/type-hvector/type-hvector.tesh
teshsuite/smpi/type-indexed/type-indexed.tesh
teshsuite/smpi/type-struct/type-struct.tesh
teshsuite/smpi/type-vector/type-vector.tesh
tools/cmake/CTestConfig.cmake
tools/cmake/DefinePackages.cmake
tools/cmake/Distrib.cmake
tools/cmake/MakeLib.cmake

index 7bd9666..466f2bf 100644 (file)
@@ -988,6 +988,12 @@ teshsuite/smpi/coll-scatter/coll-scatter
 teshsuite/smpi/macro-shared/macro-shared
 teshsuite/smpi/type-struct/type-struct
 teshsuite/smpi/type-vector/type-vector
+teshsuite/s4u/actor/actor
+teshsuite/s4u/concurrent_rw/concurrent_rw
+teshsuite/s4u/host_on_off_wait/host_on_off_wait
+teshsuite/s4u/listen_async/listen_async
+teshsuite/s4u/pid/pid
+teshsuite/s4u/storage_client_server/storage_client_server
 teshsuite/surf/lmm_usage/lmm_usage
 teshsuite/surf/maxmin_bench/maxmin_bench
 teshsuite/surf/surf_usage/surf_usage
index 106ad7f..99f0f5e 100644 (file)
@@ -30,7 +30,7 @@ addons:
       name: "simgrid/simgrid"
       description: "Build submitted via Travis CI"
     notification_email: martin.quinson@ens-rennes.fr
-    build_command_prepend: "cmake -Denable_documentation=OFF -Denable_coverage=ON -Denable_java=OFF -Denable_model-checking=OFF -Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=OFF ."
+    build_command_prepend: "cmake -Denable_documentation=OFF -Denable_coverage=ON -Denable_java=OFF -Denable_model-checking=OFF -Denable_lua=OFF -Denable_compile_optimizations=ON -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=OFF ."
     build_command:   "make VERBOSE=1"
     branch_pattern: coverity
 
@@ -46,7 +46,7 @@ addons:
 script:
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update         ; fi
    - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi
-   - cmake -Denable_documentation=OFF -Denable_coverage=ON -Denable_java=ON -Denable_model-checking=OFF -Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=ON . 
+   - cmake -Denable_documentation=OFF -Denable_coverage=ON -Denable_java=ON -Denable_model-checking=OFF -Denable_lua=OFF -Denable_compile_optimizations=ON -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=ON . 
    # run make in the sonar wrapper && run the tests before sonar to get coverage info
    - ./tools/internal/travis-sonarqube.sh make VERBOSE=1
    # if sonar was not run (and if the build succeeded), run the tests manually
index 382a88e..ab63f19 100644 (file)
@@ -690,6 +690,7 @@ if(NS3_LIBRARY_PATH)
   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
 endif()
 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
+set(SMPIMAIN smpimain)
 
 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
 foreach(script cc cxx ff f90 run)
@@ -707,6 +708,7 @@ if(NS3_LIBRARY_PATH)
   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
 endif()
 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
+set(SMPIMAIN ${CMAKE_BINARY_DIR}/bin/smpimain)
 
 foreach(script cc cxx ff f90 run)
   configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpi${script}.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpi${script} @ONLY)
index a830c41..6adb7d3 100644 (file)
@@ -134,7 +134,7 @@ The corresponding source files can be obtained
 [online on GitLab](https://gitlab.inria.fr/simgrid/simgrid/tree/master/doc/msg-tuto-src). 
 If you find the right button on the top right of the interface, you can download the whole 
 directory in one archive file. If you wish, you can find other platform file in 
-[this GitLab directory](https://gitlab.inria.fr/simgrid/simgrid/tree/master/doc/examples/platforms).
+[this GitLab directory](https://gitlab.inria.fr/simgrid/simgrid/tree/master/examples/platforms).
 
 As you can see, there is already a little Makefile that compiles
 everything for you. If you struggle with the compilation, then you should double check 
index a8c81eb..7b64d2c 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2016. The SimGrid Team.
-* All rights reserved.                                                     */
+/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -123,7 +122,7 @@ public:
       return;
     ChordMessage* message              = nullptr;
     void* data                         = nullptr;
-    double now                         = simgrid::s4u::Engine::instance()->getClock();
+    double now                         = simgrid::s4u::Engine::getClock();
     double next_stabilize_date         = start_time_ + PERIODIC_STABILIZE_DELAY;
     double next_fix_fingers_date       = start_time_ + PERIODIC_FIX_FINGERS_DELAY;
     double next_check_predecessor_date = start_time_ + PERIODIC_CHECK_PREDECESSOR_DELAY;
index 502c6ae..2d8e740 100644 (file)
@@ -912,10 +912,7 @@ XBT_PUBLIC(void*) smpi_shared_set_call(const char* func, const char* input, void
 
 /* Fortran specific stuff */
 
-XBT_PUBLIC(int) __attribute__((weak)) smpi_simulated_main_(int argc, char** argv);
-XBT_PUBLIC(int) __attribute__((weak)) MAIN__();
-XBT_PUBLIC(int) smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[]);
-XBT_PUBLIC(void) __attribute__((weak)) user_main_();
+XBT_PUBLIC(int) smpi_main(const char* program, int argc, char *argv[]);
 XBT_PUBLIC(int) smpi_process_index();
 XBT_PUBLIC(void) smpi_process_init(int *argc, char ***argv);
 
index 8d4aea3..17e4d18 100644 (file)
@@ -36,6 +36,7 @@
 #define MPI_Testall(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Testall(__VA_ARGS__); })
 #define MPI_Op_create(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Op_create(__VA_ARGS__); })
 #define MPI_Op_free(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Op_free(__VA_ARGS__); })
+#define MPI_Op_commutative(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Op_commutative(__VA_ARGS__); })
 #define MPI_Group_free(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Group_free(__VA_ARGS__); })
 #define MPI_Group_size(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Group_size(__VA_ARGS__); })
 #define MPI_Group_rank(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Group_rank(__VA_ARGS__); })
 #define MPI_Reduce_local(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Reduce_local(__VA_ARGS__); })
 #define MPI_Win_free(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_free(__VA_ARGS__); })
 #define MPI_Win_create(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_create(__VA_ARGS__); })
+#define MPI_Win_allocate(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_allocate(__VA_ARGS__); })
+#define MPI_Win_create_dynamic(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_create_dynamic(__VA_ARGS__); })
+#define MPI_Win_attach(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_attach(__VA_ARGS__); })
+#define MPI_Win_detach(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_detach(__VA_ARGS__); })
 #define MPI_Win_set_name(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_set_name(__VA_ARGS__); })
 #define MPI_Win_get_name(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_get_name(__VA_ARGS__); })
+#define MPI_Win_set_info(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_set_info(__VA_ARGS__); })
+#define MPI_Win_get_info(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_get_info(__VA_ARGS__); })
 #define MPI_Win_get_group(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_get_group(__VA_ARGS__); })
 #define MPI_Win_fence(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_fence(__VA_ARGS__); })
 #define MPI_Win_get_attr(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_get_attr(__VA_ARGS__); })
 #define MPI_Get(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Get(__VA_ARGS__); })
 #define MPI_Put(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Put(__VA_ARGS__); })
 #define MPI_Accumulate(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Accumulate(__VA_ARGS__); })
+#define MPI_Get_accumulate(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Get_accumulate(__VA_ARGS__); })
+#define MPI_Rget(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Rget(__VA_ARGS__); })
+#define MPI_Rput(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Rput(__VA_ARGS__); })
+#define MPI_Raccumulate(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Raccumulate(__VA_ARGS__); })
+#define MPI_Rget_accumulate(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Rget_accumulate(__VA_ARGS__); })
+#define MPI_Fetch_and_op(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Fetch_and_op(__VA_ARGS__); })
+#define MPI_Compare_and_swap(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Compare_and_swap(__VA_ARGS__); })
 #define MPI_Alloc_mem(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Alloc_mem(__VA_ARGS__); })
 #define MPI_Free_mem(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Free_mem(__VA_ARGS__); })
 #define MPI_Type_f2c(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Type_f2c(__VA_ARGS__); })
 #define MPI_Comm_spawn_multiple(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Comm_spawn_multiple(__VA_ARGS__); })
 #define MPI_Comm_get_parent(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Comm_get_parent(__VA_ARGS__); })
 #define MPI_Win_complete(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_complete(__VA_ARGS__); })
-#define MPI_Win_lock(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_lock(__VA_ARGS__); })
 #define MPI_Win_post(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_post(__VA_ARGS__); })
 #define MPI_Win_start(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_start(__VA_ARGS__); })
 #define MPI_Win_test(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_test(__VA_ARGS__); })
-#define MPI_Win_unlock(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_unlock(__VA_ARGS__); })
 #define MPI_Win_wait(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_wait(__VA_ARGS__); })
+#define MPI_Win_lock(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_lock(__VA_ARGS__); })
+#define MPI_Win_lock_all(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_lock_all(__VA_ARGS__); })
+#define MPI_Win_unlock(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_unlock(__VA_ARGS__); })
+#define MPI_Win_unlock_all(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_unlock_all(__VA_ARGS__); })
+#define MPI_Win_flush(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_flush(__VA_ARGS__); })
+#define MPI_Win_flush_local(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_flush_local(__VA_ARGS__); })
+#define MPI_Win_flush_all(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_flush_all(__VA_ARGS__); })
+#define MPI_Win_flush_local_all(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Win_flush_local_all(__VA_ARGS__); })
 #define MPI_File_get_errhandler(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_File_get_errhandler(__VA_ARGS__); })
 #define MPI_File_set_errhandler(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_File_set_errhandler(__VA_ARGS__); })
 #define MPI_File_open(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); MPI_File_open(__VA_ARGS__); })
index c585962..10a7fe4 100644 (file)
@@ -36,6 +36,7 @@
 #define MPI_TESTALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_testall
 #define MPI_OP_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_create
 #define MPI_OP_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_free
+#define MPI_OP_COMMUTATIVE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_op_commutative
 #define MPI_GROUP_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_free
 #define MPI_GROUP_SIZE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_size
 #define MPI_GROUP_RANK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_group_rank
 #define MPI_REDUCE_LOCAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_reduce_local
 #define MPI_WIN_FREE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_free
 #define MPI_WIN_CREATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_create
+#define MPI_WIN_ALLOCATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_allocate
+#define MPI_WIN_CREATE_DYNAMIC smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_create_dynamic
+#define MPI_WIN_ATTACH smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_attach
+#define MPI_WIN_DETACH smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_detach
 #define MPI_WIN_SET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_set_name
 #define MPI_WIN_GET_NAME smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_get_name
+#define MPI_WIN_SET_INFO smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_set_info
+#define MPI_WIN_GET_INFO smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_get_info
 #define MPI_WIN_GET_GROUP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_get_group
 #define MPI_WIN_FENCE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_fence
 #define MPI_WIN_GET_ATTR smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_get_attr
 #define MPI_GET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get
 #define MPI_PUT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_put
 #define MPI_ACCUMULATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_accumulate
+#define MPI_GET_ACCUMULATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_get_accumulate
+#define MPI_RGET smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_rget
+#define MPI_RPUT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_rput
+#define MPI_RACCUMULATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_raccumulate
+#define MPI_RGET_ACCUMULATE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_rget_accumulate
+#define MPI_FETCH_AND_OP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_fetch_and_op
+#define MPI_COMPARE_AND_SWAP smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_compare_and_swap
 #define MPI_ALLOC_MEM smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_alloc_mem
 #define MPI_FREE_MEM smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_free_mem
 #define MPI_TYPE_F2C smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_type_f2c
 #define MPI_COMM_SPAWN_MULTIPLE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_spawn_multiple
 #define MPI_COMM_GET_PARENT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_comm_get_parent
 #define MPI_WIN_COMPLETE smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_complete
-#define MPI_WIN_LOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_lock
 #define MPI_WIN_POST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_post
 #define MPI_WIN_START smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_start
 #define MPI_WIN_TEST smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_test
-#define MPI_WIN_UNLOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_unlock
 #define MPI_WIN_WAIT smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_wait
+#define MPI_WIN_LOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_lock
+#define MPI_WIN_LOCK_ALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_lock_all
+#define MPI_WIN_UNLOCK smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_unlock
+#define MPI_WIN_UNLOCK_ALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_unlock_all
+#define MPI_WIN_FLUSH smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_flush
+#define MPI_WIN_FLUSH_LOCAL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_flush_local
+#define MPI_WIN_FLUSH_ALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_flush_all
+#define MPI_WIN_FLUSH_LOCAL_ALL smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_win_flush_local_all
 #define MPI_FILE_GET_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_file_get_errhandler
 #define MPI_FILE_SET_ERRHANDLER smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_file_set_errhandler
 #define MPI_FILE_OPEN smpi_trace_set_call_location(__FILE__,__LINE__); call mpi_file_open
index 7ffd7b3..5b1f3c9 100644 (file)
@@ -248,8 +248,10 @@ Process::~Process()
     close(this->memory_file);
 
   if (this->unw_underlying_addr_space != unw_local_addr_space) {
-    unw_destroy_addr_space(this->unw_underlying_addr_space);
-    _UPT_destroy(this->unw_underlying_context);
+    if (this->unw_underlying_addr_space)
+      unw_destroy_addr_space(this->unw_underlying_addr_space);
+    if (this->unw_underlying_context)
+      _UPT_destroy(this->unw_underlying_context);
   }
 
   unw_destroy_addr_space(this->unw_addr_space);
index f08f806..8195c5c 100644 (file)
@@ -85,8 +85,7 @@ Session::Session(pid_t pid, int socket)
 {
   std::unique_ptr<simgrid::mc::Process> process(new simgrid::mc::Process(pid, socket));
   // TODO, automatic detection of the config from the process
-  process->privatized(
-    xbt_cfg_get_boolean("smpi/privatize-global-variables"));
+  process->privatized(smpi_privatize_global_variables != SMPI_PRIVATIZE_NONE);
   modelChecker_ = std::unique_ptr<ModelChecker>(
     new simgrid::mc::ModelChecker(std::move(process)));
   xbt_assert(mc_model_checker == nullptr);
index a2348a8..68b1990 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2011-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2011-2017. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -21,8 +20,7 @@
 #include "src/mc/mc_smx.h"
 #include "src/mc/VisitedState.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_VisitedState, mc,
-                                "Logging specific to state equaity detection mechanisms");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_VisitedState, mc, "Logging specific to state equality detection mechanisms");
 
 namespace simgrid {
 namespace mc {
@@ -36,10 +34,7 @@ static int snapshot_compare(simgrid::mc::VisitedState* state1, simgrid::mc::Visi
   return snapshot_compare(num1, s1, num2, s2);
 }
 
-/**
- * \brief Save the current state
- * \return Snapshot of the current state.
- */
+/** @brief Save the current state */
 VisitedState::VisitedState(unsigned long state_number)
 {
   simgrid::mc::Process* process = &(mc_model_checker->process());
index d81492c..643c734 100644 (file)
@@ -158,7 +158,7 @@ void SafetyChecker::run()
       this->checkNonTermination(next_state.get());
 
     /* Check whether we already explored next_state in the past (but only if interested in state-equality reduction) */
-    if (_sg_mc_max_visited_states == true)
+    if (_sg_mc_max_visited_states > 0)
       visitedState_ = visitedStates_.addVisitedState(expandedStatesCount_, next_state.get(), true);
 
     /* If this is a new state (or if we don't care about state-equality reduction) */
@@ -248,7 +248,7 @@ void SafetyChecker::backtrack()
         } else {
 
           const smx_actor_t previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req);
-          XBT_DEBUG("Simcall %d, process %lu (state %d) and simcall %d, process %lu (state %d) are independant",
+          XBT_DEBUG("Simcall %d, process %lu (state %d) and simcall %d, process %lu (state %d) are independent",
                     req->call, issuer->pid, state->num,
                     prev_state->internal_req.call,
                     previous_issuer->pid,
index dfb4e9a..1d3b8c6 100644 (file)
@@ -142,7 +142,7 @@ bool request_depend(smx_simcall_t r1, smx_simcall_t r2)
   if (r1->issuer == r2->issuer)
     return false;
 
-  /* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependant with all other transitions */
+  /* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependent with all other transitions */
   if ((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0)
       || (r2->call == SIMCALL_COMM_WAIT
           && simcall_comm_wait__get__timeout(r2) > 0))
@@ -391,7 +391,9 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     break;
 
   default:
-    THROW_UNIMPLEMENTED;
+    type = SIMIX_simcall_name(req->call);
+    args = bprintf("??");
+    break;
   }
 
   std::string str;
index 7cc5127..9759c21 100644 (file)
@@ -232,7 +232,7 @@ void Client::declareStack(void* stack, size_t size, smx_actor_t process, ucontex
   region.size    = size;
   region.block   = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1;
 #if HAVE_SMPI
-  if (smpi_privatize_global_variables && process)
+  if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP && process)
     region.process_index = smpi_process_index_of_smx_process(process);
   else
 #endif
index dd0df36..a5eba59 100644 (file)
@@ -499,7 +499,12 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_register_alias("smpi/send-is-detached-thresh","smpi/send_is_detached_thresh");
     xbt_cfg_register_alias("smpi/send-is-detached-thresh","smpi/send_is_detached_thres");
 
-    xbt_cfg_register_boolean("smpi/privatize-global-variables", "no", nullptr, "Whether we should privatize global variable at runtime.");
+    const char* default_privatization = std::getenv("SMPI_PRIVATIZATION");
+    if (default_privatization == nullptr)
+      default_privatization = "no";
+
+    xbt_cfg_register_string("smpi/privatize-global-variables", default_privatization, nullptr, "Whether we should privatize global variable at runtime (no, yes, mmap, dlopen).");
+
     xbt_cfg_register_alias("smpi/privatize-global-variables", "smpi/privatize_global_variables");
 
     xbt_cfg_register_boolean("smpi/grow-injected-times", "yes", nullptr, "Whether we want to make the injected time in MPI_Iprobe and MPI_Test grow, to allow faster simulation. This can make simulation less precise, though.");
index 9e256c9..43944d0 100644 (file)
@@ -262,7 +262,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
     process->ppid = parent_process->pid;
 /* SMPI process have their own data segment and each other inherit from their father */
 #if HAVE_SMPI
-    if (smpi_privatize_global_variables) {
+    if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
       if (parent_process->pid != 0) {
         SIMIX_segment_index_set(process, parent_process->segment_index);
       } else {
@@ -327,7 +327,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
     process->ppid = parent_process->pid;
     /* SMPI process have their own data segment and each other inherit from their father */
 #if HAVE_SMPI
-    if (smpi_privatize_global_variables) {
+    if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
       if (parent_process->pid != 0) {
         SIMIX_segment_index_set(process, parent_process->segment_index);
       } else {
index a8538f4..341c3e3 100644 (file)
@@ -94,7 +94,7 @@ static void segvhandler(int signum, siginfo_t *siginfo, void *context)
   } else  if (siginfo->si_signo == SIGSEGV) {
     fprintf(stderr, "Segmentation fault.\n");
 #if HAVE_SMPI
-    if (smpi_enabled() && !smpi_privatize_global_variables) {
+    if (smpi_enabled() && smpi_privatize_global_variables == SMPI_PRIVATIZE_NONE) {
 #if HAVE_PRIVATIZATION
       fprintf(stderr, "Try to enable SMPI variable privatization with --cfg=smpi/privatize-global-variables:yes.\n");
 #else
@@ -513,6 +513,12 @@ void SIMIX_run()
         SIMIX_wake_processes();
       } while (SIMIX_execute_tasks());
 
+      /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */
+      if (simix_global->process_list.size() == simix_global->daemons.size())
+        for (const auto& dmon : simix_global->daemons) {
+          XBT_DEBUG("Kill %s", dmon->cname());
+          SIMIX_process_kill(dmon, simix_global->maestro_process);
+        }
     }
 
     time = SIMIX_timer_next();
@@ -548,12 +554,6 @@ void SIMIX_run()
     XBT_DEBUG("### time %f, #processes %zu, #to_run %lu", time, simix_global->process_list.size(),
               xbt_dynar_length(simix_global->process_to_run));
 
-    /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */
-    if (simix_global->process_list.size() == simix_global->daemons.size())
-      for (const auto& dmon : simix_global->daemons) {
-        XBT_DEBUG("Kill %s", dmon->cname());
-        SIMIX_process_kill(dmon, simix_global->maestro_process);
-      }
 
     if (xbt_dynar_is_empty(simix_global->process_to_run) &&
         !simix_global->process_list.empty())
index 2fed112..a01bc88 100644 (file)
@@ -95,7 +95,13 @@ XBT_PRIVATE void smpi_mpi_init();
 // utilities
 extern XBT_PRIVATE double smpi_cpu_threshold;
 extern XBT_PRIVATE double smpi_host_speed;
-extern XBT_PRIVATE bool smpi_privatize_global_variables;
+
+#define SMPI_PRIVATIZE_NONE 0
+#define SMPI_PRIVATIZE_MMAP 1
+#define SMPI_PRIVATIZE_DLOPEN 2
+#define SMPI_PRIVATIZE_DEFAULT SMPI_PRIVATIZE_MMAP
+extern XBT_PRIVATE int smpi_privatize_global_variables;
+
 extern XBT_PRIVATE char* smpi_start_data_exe; //start of the data+bss segment of the executable
 extern XBT_PRIVATE int smpi_size_data_exe; //size of the data+bss segment of the executable
 
index b8d2d4b..b925281 100644 (file)
@@ -91,7 +91,7 @@ void smpi_execute(double duration)
 
 void smpi_bench_begin()
 {
-  if (smpi_privatize_global_variables) {
+  if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
     smpi_switch_data_segment(smpi_process()->index());
   }
 
index d4941e4..9bb515e 100644 (file)
@@ -73,7 +73,7 @@ void Comm::destroy(Comm* comm)
 }
 
 int Comm::dup(MPI_Comm* newcomm){
-  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process()->index());
    }
   MPI_Group cp = new  Group(this->group());
@@ -328,7 +328,7 @@ void Comm::init_smp(){
    smpi_process()->set_replaying(false);
   }
 
-  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process()->index());
    }
   //identify neighbours in comm
@@ -370,7 +370,7 @@ void Comm::init_smp(){
 
   Coll_allgather_mpich::allgather(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
 
-  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process()->index());
    }
 
@@ -444,7 +444,7 @@ void Comm::init_smp(){
   }
   Coll_bcast_mpich::bcast(&(is_uniform_),1, MPI_INT, 0, comm_intra );
 
-  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process()->index());
    }
   // Are the ranks blocked ? = allocated contiguously on the SMP nodes
index 52ca497..4ce4985 100644 (file)
@@ -277,7 +277,7 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     XBT_DEBUG("Copy output buf %p is shared. Let's ignore it.", recvbuf);
   }
 
-  if(smpi_privatize_global_variables){
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
     smpi_switch_data_segment(smpi_process()->index());
   }
   /* First check if we really have something to do */
index 0acc0d4..0da7f66 100644 (file)
@@ -3,6 +3,11 @@
 /* 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 <spawn.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <dlfcn.h>
+
 #include "mc/mc.h"
 #include "private.h"
 #include "private.hpp"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
+#include <utility>
 #include <vector>
+#include <memory>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
 #include <boost/tokenizer.hpp>
 #include <boost/algorithm/string.hpp> /* trim_right / trim_left */
 
+#ifndef RTLD_DEEPBIND
+/* RTLD_DEEPBIND is a bad idea of GNU ld that obviously does not exist on other platforms
+ * See https://www.akkadia.org/drepper/dsohowto.pdf
+ * and https://lists.freebsd.org/pipermail/freebsd-current/2016-March/060284.html
+*/
+#define RTLD_DEEPBIND 0
+#endif
+
+/* Mac OSX does not have any header file providing that definition so we have to duplicate it here. Bummers. */
+extern char** environ; /* we use it in posix_spawnp below */
+
 #if HAVE_PAPI
 #include "papi.h"
 const char* papi_default_config_name = "default";
@@ -115,7 +133,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
     XBT_DEBUG("Receiver %p is shared. Let's ignore it.", (char*)comm->dst_buff);
   }else{
     void* tmpbuff=buff;
-    if((smpi_privatize_global_variables) && (static_cast<char*>(buff) >= smpi_start_data_exe)
+    if((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && (static_cast<char*>(buff) >= smpi_start_data_exe)
         && (static_cast<char*>(buff) < smpi_start_data_exe + smpi_size_data_exe )
       ){
          XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
@@ -126,7 +144,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
          memcpy(tmpbuff, buff, buff_size);
     }
 
-    if((smpi_privatize_global_variables) && ((char*)comm->dst_buff >= smpi_start_data_exe)
+    if((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && ((char*)comm->dst_buff >= smpi_start_data_exe)
         && ((char*)comm->dst_buff < smpi_start_data_exe + smpi_size_data_exe )){
          XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
          smpi_switch_data_segment(
@@ -177,9 +195,7 @@ int smpi_enabled() {
 
 void smpi_global_init()
 {
-  int i;
   MPI_Group group;
-  int smpirun=0;
 
   if (!MC_is_active()) {
     global_timer = xbt_os_timer_new();
@@ -276,27 +292,28 @@ void smpi_global_init()
     }
   }
 #endif
+
+  int smpirun = 0;
+  msg_bar_t finalization_barrier = nullptr;
   if (process_count == 0){
     process_count = SIMIX_process_count();
     smpirun=1;
+    finalization_barrier = MSG_barrier_init(process_count);
   }
   smpi_universe_size = process_count;
   process_data       = new simgrid::smpi::Process*[process_count];
-  for (i = 0; i < process_count; i++) {
-    process_data[i]                       = new simgrid::smpi::Process(i);
+  for (int i = 0; i < process_count; i++) {
+    process_data[i] = new simgrid::smpi::Process(i, finalization_barrier);
   }
   //if the process was launched through smpirun script we generate a global mpi_comm_world
   //if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
-  if(smpirun){
+  if (smpirun) {
     group = new  simgrid::smpi::Group(process_count);
     MPI_COMM_WORLD = new  simgrid::smpi::Comm(group, nullptr);
     MPI_Attr_put(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, reinterpret_cast<void *>(process_count));
-    msg_bar_t bar = MSG_barrier_init(process_count);
 
-    for (i = 0; i < process_count; i++) {
+    for (int i = 0; i < process_count; i++)
       group->set_mapping(i, i);
-      process_data[i]->set_finalization_barrier(bar);
-    }
   }
 }
 
@@ -341,43 +358,13 @@ void smpi_global_destroy()
   }
 
   xbt_free(index_to_process_data);
-  if(smpi_privatize_global_variables)
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
     smpi_destroy_global_memory_segments();
   smpi_free_static();
 }
 
 extern "C" {
 
-#ifndef WIN32
-
-void __attribute__ ((weak)) user_main_()
-{
-  xbt_die("Should not be in this smpi_simulated_main");
-}
-
-int __attribute__ ((weak)) smpi_simulated_main_(int argc, char **argv)
-{
-  simgrid::smpi::Process::init(&argc, &argv);
-  user_main_();
-  return 0;
-}
-
-inline static int smpi_main_wrapper(int argc, char **argv){
-  int ret = smpi_simulated_main_(argc,argv);
-  if(ret !=0){
-    XBT_WARN("SMPI process did not return 0. Return value : %d", ret);
-    smpi_process()->set_return_value(ret);
-  }
-  return 0;
-}
-
-int __attribute__ ((weak)) main(int argc, char **argv)
-{
-  return smpi_main(smpi_main_wrapper, argc, argv);
-}
-
-#endif
-
 static void smpi_init_logs(){
 
   /* Connect log categories.  See xbt/log.c */
@@ -411,7 +398,26 @@ static void smpi_init_options(){
     simgrid::smpi::Colls::smpi_coll_cleanup_callback=nullptr;
     smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
     smpi_host_speed = xbt_cfg_get_double("smpi/host-speed");
-    smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables");
+    const char* smpi_privatize_option = xbt_cfg_get_string("smpi/privatize-global-variables");
+    if (std::strcmp(smpi_privatize_option, "no") == 0)
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
+    else if (std::strcmp(smpi_privatize_option, "yes") == 0)
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_DEFAULT;
+    else if (std::strcmp(smpi_privatize_option, "mmap") == 0)
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_MMAP;
+    else if (std::strcmp(smpi_privatize_option, "dlopen") == 0)
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_DLOPEN;
+
+    // Some compatibility stuff:
+    else if (std::strcmp(smpi_privatize_option, "1") == 0)
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_DEFAULT;
+    else if (std::strcmp(smpi_privatize_option, "0") == 0)
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
+
+    else
+      xbt_die("Invalid value for smpi/privatize-global-variables: %s",
+        smpi_privatize_option);
+
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
 
@@ -428,7 +434,61 @@ static void smpi_init_options(){
     }
 }
 
-int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
+static int execute_command(const char * const argv[])
+{
+  pid_t pid;
+  int status;
+  if (posix_spawnp(&pid, argv[0], nullptr, nullptr, (char* const*) argv, environ) != 0)
+    return 127;
+  if (waitpid(pid, &status, 0) != pid)
+    return 127;
+  return status;
+}
+
+typedef std::function<int(int argc, char *argv[])> smpi_entry_point_type;
+typedef int (* smpi_c_entry_point_type)(int argc, char **argv);
+typedef void (* smpi_fortran_entry_point_type)(void);
+
+static int smpi_run_entry_point(smpi_entry_point_type entry_point, std::vector<std::string> args)
+{
+  const int argc = args.size();
+  std::unique_ptr<char*[]> argv(new char*[argc + 1]);
+  for (int i = 0; i != argc; ++i)
+    argv[i] = args[i].empty() ? const_cast<char*>(""): &args[i].front();
+  argv[argc] = nullptr;
+
+  int res = entry_point(argc, argv.get());
+  if (res != 0){
+    XBT_WARN("SMPI process did not return 0. Return value : %d", res);
+    smpi_process()->set_return_value(res);
+  }
+  return 0;
+}
+
+// TODO, remove the number of functions involved here
+static smpi_entry_point_type smpi_resolve_function(void* handle)
+{
+  smpi_fortran_entry_point_type entry_point2 =
+    (smpi_fortran_entry_point_type) dlsym(handle, "user_main_");
+  if (entry_point2 != nullptr) {
+    // fprintf(stderr, "EP user_main_=%p\n", entry_point2);
+    return [entry_point2](int argc, char** argv) {
+      smpi_process_init(&argc, &argv);
+      entry_point2();
+      return 0;
+    };
+  }
+
+  smpi_c_entry_point_type entry_point = (smpi_c_entry_point_type) dlsym(handle, "main");
+  if (entry_point != nullptr) {
+    // fprintf(stderr, "EP main=%p\n", entry_point);
+    return entry_point;
+  }
+
+  return smpi_entry_point_type();
+}
+
+int smpi_main(const char* executable, int argc, char *argv[])
 {
   srand(SMPI_RAND_SEED);
 
@@ -452,15 +512,73 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
 
   // parse the platform file: get the host list
   SIMIX_create_environment(argv[1]);
-  SIMIX_comm_set_copy_data_callback(smpi_comm_copy_data_callback);
-  SIMIX_function_register_default(realmain);
+  SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback);
+
+  static std::size_t rank = 0;
+
+  if (smpi_privatize_global_variables == SMPI_PRIVATIZE_DLOPEN) {
+
+    std::string executable_copy = executable;
+    simix_global->default_function = [executable_copy](std::vector<std::string> args) {
+      return std::function<void()>([executable_copy, args] {
+
+        // Copy the dynamic library:
+        std::string target_executable = executable_copy
+          + "_" + std::to_string(getpid())
+          + "_" + std::to_string(rank++) + ".so";
+        // TODO, execute directly instead of relying on cp
+        const char* command1 [] = {
+          "cp", "--reflink=auto", "--", executable_copy.c_str(), target_executable.c_str(),
+          nullptr
+        };
+        const char* command2 [] = {
+          "cp", "--", executable_copy.c_str(), target_executable.c_str(),
+          nullptr
+        };
+        if (execute_command(command1) != 0 && execute_command(command2) != 0)
+          xbt_die("copy failed");
+
+        // 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 (handle == nullptr)
+          xbt_die("dlopen failed");
+        smpi_entry_point_type entry_point = smpi_resolve_function(handle);
+        if (!entry_point)
+          xbt_die("Could not resolve entry point");
+
+          smpi_run_entry_point(entry_point, args);
+      });
+    };
+
+  }
+  else {
+
+    // Load the dynamic library and resolve the entry point:
+    void* handle = dlopen(executable, RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND);
+    if (handle == nullptr)
+      xbt_die("dlopen failed for %s", executable);
+    smpi_entry_point_type entry_point = smpi_resolve_function(handle);
+    if (!entry_point)
+      xbt_die("main not found in %s", executable);
+    // TODO, register the executable for SMPI privatization
+
+    // Execute the same entry point for each simulated process:
+    simix_global->default_function = [entry_point](std::vector<std::string> args) {
+      return std::function<void()>([entry_point, args] {
+        smpi_run_entry_point(entry_point, args);
+      });
+    };
+
+  }
+
   SIMIX_launch_application(argv[2]);
 
   smpi_global_init();
 
   smpi_check_options();
 
-  if(smpi_privatize_global_variables)
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
     smpi_initialize_global_memory_segments();
 
   /* Clean IO before the run */
@@ -510,7 +628,7 @@ void SMPI_init(){
   smpi_check_options();
   if (TRACE_is_enabled() && TRACE_is_configured())
     TRACE_smpi_alloc();
-  if(smpi_privatize_global_variables)
+  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
     smpi_initialize_global_memory_segments();
 }
 
diff --git a/src/smpi/smpi_main.c b/src/smpi/smpi_main.c
new file mode 100644 (file)
index 0000000..d194156
--- /dev/null
@@ -0,0 +1,19 @@
+/* Copyright (c) 2007-2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* 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 <stdio.h>
+#include <stdlib.h>
+
+#include <smpi/smpi.h>
+
+int main(int argc, char **argv)
+{
+  if (argc < 2) {
+    fprintf(stderr, "Missing SMPI program to launch\n");
+    exit(1);
+  }
+  return smpi_main(argv[1], argc - 1, argv + 1);
+}
index a2fd3c1..f21f5dc 100644 (file)
@@ -31,7 +31,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SM
 int smpi_loaded_page = -1;
 char* smpi_start_data_exe = nullptr;
 int smpi_size_data_exe = 0;
-bool smpi_privatize_global_variables;
+int smpi_privatize_global_variables;
 
 static const int PROT_RWX = (PROT_READ | PROT_WRITE | PROT_EXEC);
 static const int PROT_RW  = (PROT_READ | PROT_WRITE );
index c6082e4..85fd0e5 100644 (file)
@@ -57,7 +57,6 @@ int PMPI_Finalize()
 
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   TRACE_smpi_finalize(smpi_process()->index());
-  smpi_process()->destroy();
   return MPI_SUCCESS;
 }
 
@@ -113,7 +112,6 @@ int PMPI_Is_thread_main(int *flag)
 int PMPI_Abort(MPI_Comm comm, int errorcode)
 {
   smpi_bench_end();
-  smpi_process()->destroy();
   // FIXME: should kill all processes in comm instead
   simcall_process_kill(SIMIX_process_self());
   return MPI_SUCCESS;
@@ -1178,7 +1176,7 @@ int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* statu
   int retval = 0;
   smpi_bench_end();
 
-  if ((flag == nullptr) || (status == nullptr)) {
+  if (flag == nullptr) {
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
index fbf586f..92cd1d3 100644 (file)
@@ -32,25 +32,17 @@ static char *get_mailbox_name_small(char *str, int index)
 namespace simgrid{
 namespace smpi{
 
-Process::Process(int index)
+Process::Process(int index, msg_bar_t finalization_barrier)
+  : finalization_barrier_(finalization_barrier)
 {
   char name[MAILBOX_NAME_MAXLEN];
-  index_ = MPI_UNDEFINED;
-  argc_                 = nullptr;
-  argv_                 = nullptr;
   mailbox_              = simgrid::s4u::Mailbox::byName(get_mailbox_name(name, index));
   mailbox_small_        = simgrid::s4u::Mailbox::byName(get_mailbox_name_small(name, index));
   mailboxes_mutex_      = xbt_mutex_init();
   timer_                = xbt_os_timer_new();
+  state_                = SMPI_UNINITIALIZED;
   if (MC_is_active())
     MC_ignore_heap(timer_, xbt_os_timer_size());
-  comm_self_            = MPI_COMM_NULL;
-  comm_intra_           = MPI_COMM_NULL;
-  comm_world_           = nullptr;
-  state_                = SMPI_UNINITIALIZED;
-  sampling_             = 0;
-  finalization_barrier_ = nullptr;
-  return_value_         = 0;
 
 #if HAVE_PAPI
   if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
@@ -70,17 +62,15 @@ Process::Process(int index)
 #endif
 }
 
-void Process::set_data(int index, int *argc, char ***argv)
+void Process::set_data(int index, int* argc, char*** argv)
 {
-
     char* instance_id = (*argv)[1];
     comm_world_         = smpi_deployment_comm_world(instance_id);
     msg_bar_t bar = smpi_deployment_finalization_barrier(instance_id);
     if (bar!=nullptr) // don't overwrite the default one
       finalization_barrier_ = bar;
-    index_       = index;
     instance_id_ = instance_id;
-    replaying_   = false;
+    index_ = index;
 
     static_cast<simgrid::MsgActorExt*>(SIMIX_process_self()->data)->data = this;
 
@@ -95,21 +85,15 @@ void Process::set_data(int index, int *argc, char ***argv)
     // set the process attached to the mailbox
     mailbox_small_->setReceiver(simgrid::s4u::Actor::self());
     process_ = SIMIX_process_self();
-    XBT_DEBUG("<%d> New process in the game: %p", index, SIMIX_process_self());
+    XBT_DEBUG("<%d> New process in the game: %p", index_, SIMIX_process_self());
 }
 
-void Process::destroy()
+/** @brief Prepares the current process for termination. */
+void Process::finalize()
 {
-  if(smpi_privatize_global_variables){
-    smpi_switch_data_segment(index_);
-  }
   state_ = SMPI_FINALIZED;
   XBT_DEBUG("<%d> Process left the game", index_);
-}
 
-/** @brief Prepares the current process for termination. */
-void Process::finalize()
-{
     // This leads to an explosion of the search graph which cannot be reduced:
     if(MC_is_active() || MC_record_replay_is_active())
       return;
@@ -155,16 +139,6 @@ bool Process::replaying(){
     return false;
 }
 
-void Process::set_user_data(void *data)
-{
-  data_ = data;
-}
-
-void *Process::get_user_data()
-{
-  return data_;
-}
-
 smx_actor_t Process::process(){
   return process_;
 }
@@ -263,10 +237,6 @@ int Process::sampling()
   return sampling_;
 }
 
-void Process::set_finalization_barrier(msg_bar_t bar){
-  finalization_barrier_=bar;
-}
-
 msg_bar_t Process::finalization_barrier(){
   return finalization_barrier_;
 }
@@ -299,7 +269,7 @@ void Process::init(int *argc, char ***argv){
     int rank = xbt_str_parse_int((*argv)[2], "Invalid rank: %s");
     smpi_deployment_register_process(instance_id, rank, index);
 
-    if(smpi_privatize_global_variables){
+    if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
       /* Now using segment index of the process  */
       index = proc->segment_index;
       /* Done at the process's creation */
index f31e8dd..9cc8a2a 100644 (file)
@@ -18,43 +18,39 @@ namespace smpi{
 
 class Process {
   private:
-    double simulated_;
-    int *argc_;
-    char ***argv_;
+    double simulated_ = 0 /* Used to time with simulated_start/elapsed */;
+    int* argc_        = nullptr;
+    char*** argv_     = nullptr;
     simgrid::s4u::MailboxPtr mailbox_;
     simgrid::s4u::MailboxPtr mailbox_small_;
     xbt_mutex_t mailboxes_mutex_;
     xbt_os_timer_t timer_;
-    MPI_Comm comm_self_;
-    MPI_Comm comm_intra_;
-    MPI_Comm* comm_world_;
-    void *data_;                   /* user data */
-    int index_;
+    MPI_Comm comm_self_   = MPI_COMM_NULL;
+    MPI_Comm comm_intra_  = MPI_COMM_NULL;
+    MPI_Comm* comm_world_ = nullptr;
+    int index_            = MPI_UNDEFINED;
     char state_;
-    int sampling_;                 /* inside an SMPI_SAMPLE_ block? */
-    char* instance_id_;
-    bool replaying_;                /* is the process replaying a trace */
+    int sampling_                   = 0; /* inside an SMPI_SAMPLE_ block? */
+    char* instance_id_              = nullptr;
+    bool replaying_                 = false; /* is the process replaying a trace */
     msg_bar_t finalization_barrier_;
-    int return_value_;
+    int return_value_ = 0;
     smpi_trace_call_location_t trace_call_loc_;
-    smx_actor_t process_;
+    smx_actor_t process_ = nullptr;
 #if HAVE_PAPI
   /** Contains hardware data as read by PAPI **/
     int papi_event_set_;
     papi_counter_t papi_counter_data_;
 #endif
   public:
-    explicit Process(int index);
-    void destroy();
-    void set_data(int index, int *argc, char ***argv);
+    explicit Process(int index, msg_bar_t barrier);
+    void set_data(int index, int* argc, char*** argv);
     void finalize();
     int finalized();
     int initialized();
     void mark_as_initialized();
     void set_replaying(bool value);
     bool replaying();
-    void set_user_data(void *data);
-    void *get_user_data();
     smpi_trace_call_location_t* call_location();
     int index();
     MPI_Comm comm_world();
@@ -74,7 +70,6 @@ class Process {
     void set_sampling(int s);
     int sampling();
     msg_bar_t finalization_barrier();
-    void set_finalization_barrier(msg_bar_t bar);
     int return_value();
     void set_return_value(int val);
     static void init(int *argc, char ***argv);
index f406072..ada1fec 100644 (file)
@@ -988,6 +988,5 @@ void smpi_replay_run(int *argc, char***argv){
 
   TRACE_smpi_collective_out(rank, -1, operation);
   TRACE_smpi_finalize(smpi_process()->index());
-  smpi_process()->destroy();
   xbt_free(operation);
 }
index 33eaa9a..2ff10a2 100644 (file)
@@ -472,7 +472,7 @@ void Request::start()
       if(!(old_type_->flags() & DT_FLAG_DERIVED)){
         oldbuf = buf_;
         if (!process->replaying() && oldbuf != nullptr && size_!=0){
-          if((smpi_privatize_global_variables != 0)
+          if((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
             && (static_cast<char*>(buf_) >= smpi_start_data_exe)
             && (static_cast<char*>(buf_) < smpi_start_data_exe + smpi_size_data_exe )){
             XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment ");
@@ -766,7 +766,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
     if((((req->flags_ & ACCUMULATE) != 0) || (datatype->flags() & DT_FLAG_DERIVED)) && (!smpi_is_shared(req->old_buf_))){
 
       if (!smpi_process()->replaying()){
-        if( smpi_privatize_global_variables != 0 && (static_cast<char*>(req->old_buf_) >= smpi_start_data_exe)
+        if( smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP && (static_cast<char*>(req->old_buf_) >= smpi_start_data_exe)
             && ((char*)req->old_buf_ < smpi_start_data_exe + smpi_size_data_exe )){
             XBT_VERB("Privatization : We are unserializing to a zone in global memory  Switch data segment ");
             smpi_switch_data_segment(smpi_process()->index());
index 8667c84..fa5c02e 100755 (executable)
@@ -19,8 +19,9 @@ CMAKE_LINKARGS="-L@libdir@"
 list_set CFLAGS
 list_set LINKARGS
 if [ "@WIN32@" != "1" ]; then
-    list_add CFLAGS "-Dmain=smpi_simulated_main_"
-    list_add LINKARGS "-lsimgrid"
+    # list_add CFLAGS "-Dmain=smpi_simulated_main_"
+    list_add CFLAGS "-fpic"
+    list_add LINKARGS "-shared" "-lsimgrid"
 else
     list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
     list_add LINKARGS "@libdir@\libsimgrid.dll"
index 9e8ab98..886a8dd 100755 (executable)
@@ -19,8 +19,9 @@ CMAKE_LINKARGS="-L@libdir@"
 list_set CXXFLAGS
 list_set LINKARGS
 if [ "@WIN32@" != "1" ]; then
-    list_add CXXFLAGS "-Dmain=smpi_simulated_main_"
-    list_add LINKARGS "-lsimgrid"
+    # list_add CXXFLAGS "-Dmain=smpi_simulated_main_"
+    list_add CXXFLAGS "-fpic"
+    list_add LINKARGS "-shared" "-lsimgrid"
 else
     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
     list_add LINKARGS "@libdir@\libsimgrid.dll"
index 1a54f16..459cac3 100644 (file)
@@ -16,8 +16,8 @@ CMAKE_LINKARGS="-L@libdir@"
 
 @SMPITOOLS_SH@
 
-list_set FFLAGS "-ff2c" "-fno-second-underscore"
-list_set LINKARGS "-lsimgrid" "-lm" "-lgfortran"
+list_set FFLAGS "-fpic" "-ff2c" "-fno-second-underscore"
+list_set LINKARGS "-shared" "-lsimgrid" "-lm" "-lgfortran"
 list_set TMPFILES
 main_name=main
 
index 75bbdba..f78ffbd 100644 (file)
@@ -16,8 +16,8 @@ CMAKE_LINKARGS="-L@libdir@"
 
 @SMPITOOLS_SH@
 
-list_set FFLAGS "-ff2c" "-fno-second-underscore"
-list_set LINKARGS "-lsimgrid" "-lm" "-lgfortran"
+list_set FFLAGS "-fpic" "-ff2c" "-fno-second-underscore"
+list_set LINKARGS "-shared" "-lsimgrid" "-lm" "-lgfortran"
 list_set TMPFILES
 main_name=main
 
index b6f0d93..b6a7ec5 100755 (executable)
@@ -249,11 +249,7 @@ then
     exit
 fi
 
-if [ -n "$WRAPPER" ]; then
-    EXEC="$WRAPPER $1"
-else
-    EXEC="$1"
-fi
+EXEC="$1"
 shift
 
 # steel --cfg and --logs options
@@ -513,7 +509,7 @@ fi
 # * The FD 3 is used to temporarily store FD 1. This is because the shell connects FD 1 to /dev/null when the command
 #   is launched in the background: this can be overriden in bash but not in standard bourne shell.
 exec 3<&0
-${EXEC} ${PRIVATIZE} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP} <&3 3>&- &
+${WRAPPER} "@SMPIMAIN@" ${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP} <&3 3>&- &
 pid=$!
 exec 3>&-
 wait $pid
index 370774f..cc112b9 100644 (file)
@@ -163,6 +163,7 @@ void xbt_dict_set_ext(xbt_dict_t dict, const char *key, int key_len, void *data,
   xbt_dictelm_t current;
   xbt_dictelm_t previous = nullptr;
 
+  xbt_assert(!free_ctn, "Cannot set an individual free function in homogeneous dicts.");
   XBT_CDEBUG(xbt_dict, "ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code,
              dict->table_size, hash_code & dict->table_size);
   current = dict->table[hash_code & dict->table_size];
@@ -174,7 +175,7 @@ void xbt_dict_set_ext(xbt_dict_t dict, const char *key, int key_len, void *data,
 
   if (current == nullptr) {
     /* this key doesn't exist yet */
-    current = xbt_dictelm_new(dict, key, key_len, hash_code, data, free_ctn);
+    current = xbt_dictelm_new(key, key_len, hash_code, data);
     dict->count++;
     if (previous == nullptr) {
       dict->table[hash_code & dict->table_size] = current;
index dae75e8..28c0901 100644 (file)
@@ -1,7 +1,6 @@
 /* dict - a generic dictionary, variation over hash table                   */
 
-/* Copyright (c) 2004-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -12,13 +11,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_elm, xbt_dict, "Dictionaries internals"
 
 xbt_mallocator_t dict_elm_mallocator = NULL;
 
-xbt_dictelm_t xbt_dictelm_new(xbt_dict_t dict, const char *key, int key_len, unsigned int hash_code, void *content,
-                              void_f_pvoid_t free_f)
+xbt_dictelm_t xbt_dictelm_new(const char* key, int key_len, unsigned int hash_code, void* content)
 {
-  xbt_dictelm_t element;
-
-  xbt_assert(!free_f, "Cannot set an individual free function in homogeneous dicts.");
-  element      = xbt_mallocator_get(dict_elm_mallocator);
+  xbt_dictelm_t element = xbt_mallocator_get(dict_elm_mallocator);
   element->key = xbt_new(char, key_len + 1);
   memcpy(element->key, key, key_len);
   element->key[key_len] = '\0';
index 43d974f..83798fb 100644 (file)
@@ -38,8 +38,7 @@ XBT_PRIVATE void * dict_elm_mallocator_new_f(void);
 #define dict_elm_mallocator_reset_f ((void_f_pvoid_t)NULL)
 
 /*####[ Function prototypes ]################################################*/
-XBT_PRIVATE xbt_dictelm_t xbt_dictelm_new(xbt_dict_t dict, const char *key, int key_len,
-                              unsigned int hash_code, void *content, void_f_pvoid_t free_f);
+XBT_PRIVATE xbt_dictelm_t xbt_dictelm_new(const char* key, int key_len, unsigned int hash_code, void* content);
 XBT_PRIVATE void xbt_dictelm_free(xbt_dict_t dict, xbt_dictelm_t element);
 XBT_PRIVATE void xbt_dictelm_set_data(xbt_dict_t dict, xbt_dictelm_t element, void *data, void_f_pvoid_t free_ctn);
 
index b1583d6..728b8f3 100644 (file)
@@ -1,3 +1,3 @@
-$ ${bindir:=.}/../../../bin/smpirun -np 16 -platform ../../../examples/platforms/small_platform.xml -hostfile ../hostfile ${bindir:=.}/bug-17132 --cfg=smpi/simulate-computation:no --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -np 16 -platform ../../../examples/platforms/small_platform.xml -hostfile ../hostfile ${bindir:=.}/bug-17132 --cfg=smpi/simulate-computation:no --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > You requested to use 16 processes, but there is only 5 processes in your hostfile...
 > Walltime = 0.468274
index 5c99a9d..cda0bba 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test allgather
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allgather --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allgather --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index ef8c664..b3a6e49 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test allgatherv
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allgatherv --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allgatherv --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index c08ea85..b1b780a 100644 (file)
@@ -3,7 +3,7 @@
 
 p Test allreduce
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error --cfg=smpi/allreduce:automatic --cfg=smpi/async-small-thresh:65536 --cfg=smpi/send-is-detached-thresh:128000 --cfg=smpi/simulate-computation:no "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error --cfg=smpi/allreduce:automatic --cfg=smpi/async-small-thresh:65536 --cfg=smpi/send-is-detached-thresh:128000 --cfg=smpi/simulate-computation:no "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index f8775ed..841a8f4 100644 (file)
@@ -4,7 +4,7 @@
 
 ! timeout 20
 p Test allreduce
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce 300000 --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce 300000 --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > [rank 2] -> Fafard
index 25e3402..f3eefc0 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test allreduce
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allreduce --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index c6ccf9e..cfbcde3 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test classic - backbone
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> node-0.acme.org
 > [rank 1] -> node-1.acme.org
 > [rank 2] -> node-2.acme.org
@@ -43,7 +43,7 @@ $ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform
 
 ! output sort
 p Test separate clusters
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/two_clusters.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/two_clusters.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> node-0.acme.org
 > [rank 1] -> node-1.acme.org
 > [rank 2] -> node-2.acme.org
@@ -83,7 +83,7 @@ $ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform
 
 ! output sort
 p Test torus
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_torus.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_torus.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> node-0.acme.org
 > [rank 1] -> node-1.acme.org
 > [rank 2] -> node-2.acme.org
@@ -123,7 +123,7 @@ $ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform
 
 ! output sort
 p Test fat tree
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_fat_tree.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_fat_tree.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> node-0.acme.org
 > [rank 1] -> node-1.acme.org
 > [rank 2] -> node-2.acme.org
@@ -163,7 +163,7 @@ $ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform
 
 ! output sort
 p Test fat tree IB
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_fat_tree.xml -np 12 --cfg=network/model:IB --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_fat_tree.xml -np 12 --cfg=network/model:IB --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> node-0.acme.org
 > [rank 1] -> node-1.acme.org
 > [rank 2] -> node-2.acme.org
@@ -203,7 +203,7 @@ $ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform
 
 ! output sort
 p Test Dragonfly
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_dragonfly.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_cluster -platform ../../../examples/platforms/cluster_dragonfly.xml -np 12 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> node-0.acme.org
 > [rank 1] -> node-1.acme.org
 > [rank 2] -> node-2.acme.org
index a54cdc1..d9cf5d2 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test all to all
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoall -q --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index 995a436..dfcf17e 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test all to all
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoallv --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-alltoallv --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index 04cec90..6dd6821 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test barrier
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-barrier --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-barrier --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > ... Barrier ....
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
index 9155454..000ddca 100644 (file)
@@ -2,7 +2,7 @@ p Test Broadcast with more processes than hosts
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
 
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-bcast --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-bcast --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index e320536..6ac136a 100644 (file)
@@ -4,7 +4,7 @@
 ! timeout 30
 
 p Test all to all
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-gather --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-gather --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
index 8530616..557b7c9 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test reduce_scatter
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-reduce-scatter --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-reduce-scatter --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 >  No Errors
 > [rank 0] -> Tremblay
 > [rank 10] -> Fafard
index c9fa212..b33cfb3 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test allreduce
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-reduce --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-reduce --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 > [0] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
 > [0] second sndbuf=[0 ]
 > [0] sndbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]
index b8d3ce4..f1ba5c6 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 p Test scatter
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-scatter --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-scatter --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
 >      [0] ok.
 >      [10] ok.
 >      [11] ok.
index d881695..900597c 100644 (file)
@@ -218,14 +218,14 @@ if(enable_smpi AND enable_model-checking AND enable_smpi_ISP_testsuite)
   foreach (test ${umpire_tests_passing})
     write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! timeout 30")
     write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! output display" APPEND)
-    write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll_selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
+    write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../smpi_script/bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll_selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
   endforeach()
 
   foreach (test ${umpire_tests_deadlock} ${umpire_tests_problematic} )
     write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! timeout 30"     )
     write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! expect return 3" APPEND)
     write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! output display"  APPEND)
-    write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll_selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
+    write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../smpi_script/bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll_selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
   endforeach()
 endif()
 
index 1404acb..563e68b 100644 (file)
@@ -1,7 +1,7 @@
 p Test compute and bench
 ! output sort
 ! timeout 45
-$ ${bindir:=.}/../../../bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform_with_routers.xml -np 3 --log=root.thres:warning ${bindir:=.}/macro-sample quiet --log=smpi_kernel.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform_with_routers.xml -np 3 --log=root.thres:warning ${bindir:=.}/macro-sample quiet --log=smpi_kernel.thres:warning
 > (0) Run the first computation. It's globally benched, and I want no more than 4 benchmarks (thres<0)
 > (0) Run the first computation. It's globally benched, and I want no more than 4 benchmarks (thres<0)
 > (0) Run the first computation. It's globally benched, and I want no more than 4 benchmarks (thres<0)
index d5b868e..2a79f09 100644 (file)
@@ -2,7 +2,7 @@ p Test compute
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
 ! timeout 5
-$ ${bindir:=.}/../../../bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-shared --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-shared --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [0] After change, the value in the shared buffer is: 16053117601147974045
 > [0] The value in the shared buffer is: 4
 > [1] After change, the value in the shared buffer is: 16053117601147974045
index 9496160..b29fc89 100644 (file)
@@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
   include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
   include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
 
-  foreach(file anyall bottom eagerdt inactivereq isendself isendirecv isendselfprobe issendselfcancel cancelanysrc pingping probenull
+  foreach(file anyall bottom eagerdt huge_anysrc huge_underflow inactivereq isendself isendirecv isendselfprobe issendselfcancel cancelanysrc pingping probenull
           dtype_send probe-unexp sendall sendflood sendrecv1 sendrecv2 sendrecv3 waitany-null waittestnull many_isend manylmt recv_any)
     # not compiled files: big_count_status bsend1 bsend2 bsend3 bsend4 bsend5 bsendalign bsendfrag bsendpending mprobe
     # cancelrecv greq1 icsend large_message pscancel rcancel rqfreeb rqstatus scancel2 scancel sendself scancel_unmatch
@@ -23,7 +23,7 @@ if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-pt2pt-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
 endif()
 
-foreach(file anyall bottom eagerdt inactivereq isendself isendirecv isendselfprobe issendselfcancel pingping probenull
+foreach(file anyall bottom eagerdt huge_anysrc huge_underflow inactivereq isendself isendirecv isendselfprobe issendselfcancel pingping probenull
           probe-unexp sendall sendflood sendrecv1 sendrecv2 sendrecv3 waitany-null waittestnull
           big_count_status bsend1 bsend2 bsend3 bsend4 bsend5 bsendalign bsendfrag bsendpending
           cancelrecv cancelanysrc dtype_send greq1 icsend large_message pscancel rcancel rqfreeb rqstatus scancel2 scancel sendself many_isend manylmt mprobe recv_any scancel_unmatch
diff --git a/teshsuite/smpi/mpich3-test/pt2pt/huge_anysrc.c b/teshsuite/smpi/mpich3-test/pt2pt/huge_anysrc.c
new file mode 100644 (file)
index 0000000..4386c29
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  (C) 2017 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ *
+ *  Portions of this code were written by Intel Corporation.
+ *  Copyright (C) 2011-2017 Intel Corporation.  Intel provides this material
+ *  to Argonne National Laboratory subject to Software Grant and Corporate
+ *  Contributor License Agreement dated February 8, 2012.
+ *
+ *  This program checks if MPICH can correctly handle many outstanding large
+ *  message transfers which use wildcard receives.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <mpi.h>
+
+#define N_TRY 16
+#define BLKSIZE (10*1024*1024)
+
+int main(int argc, char *argv[])
+{
+    int size, rank;
+    int dest;
+    int i;
+    char *buff;
+    MPI_Request reqs[N_TRY];
+
+    MPI_Init(&argc, &argv);
+
+    buff = malloc(N_TRY * BLKSIZE);
+    memset(buff, -1, N_TRY * BLKSIZE);
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    dest = size - 1;
+
+    if (rank == 0) {
+        for (i = 0; i < N_TRY; i++)
+            MPI_Isend(buff + BLKSIZE*i, BLKSIZE, MPI_BYTE, dest, 0, MPI_COMM_WORLD, &reqs[i]);
+        MPI_Waitall(N_TRY, reqs, MPI_STATUSES_IGNORE);
+    }
+    else if (rank == dest) {
+        for (i = 0; i < N_TRY; i++)
+            MPI_Irecv(buff + BLKSIZE*i, BLKSIZE, MPI_BYTE, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &reqs[i]);
+        MPI_Waitall(N_TRY, reqs, MPI_STATUSES_IGNORE);
+    }
+
+    free(buff);
+
+    if (rank == 0)
+        puts(" No Errors");
+
+    MPI_Finalize();
+
+    return 0;
+}
diff --git a/teshsuite/smpi/mpich3-test/pt2pt/huge_underflow.c b/teshsuite/smpi/mpich3-test/pt2pt/huge_underflow.c
new file mode 100644 (file)
index 0000000..34c0908
--- /dev/null
@@ -0,0 +1,57 @@
+
+/*
+ *  (C) 2017 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ *
+ *  Portions of this code were written by Intel Corporation.
+ *  Copyright (C) 2011-2017 Intel Corporation.  Intel provides this material
+ *  to Argonne National Laboratory subject to Software Grant and Corporate
+ *  Contributor License Agreement dated February 8, 2012.
+ *
+ *  This program checks if MPICH can correctly handle a huge message receive
+ *  when the sender underflows by sending a much smaller message
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <mpi.h>
+
+#define HUGE_SIZE (10*1024*1024)
+
+int main(int argc, char *argv[])
+{
+    int size, rank;
+    int dest;
+    char *buff;
+
+    MPI_Init(&argc, &argv);
+
+    buff = malloc(HUGE_SIZE);
+    buff[0] = 0;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    dest = size - 1;
+
+    /* Try testing underflow to make sure things work if we try to send 1 byte
+     * when receiving a huge message */
+    if (rank == 0) {
+        MPI_Send(buff, 1, MPI_BYTE, dest, 0, MPI_COMM_WORLD);
+    } else if (rank == dest) {
+        MPI_Recv(buff, HUGE_SIZE, MPI_BYTE, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+    }
+
+    free(buff);
+
+    MPI_Barrier(MPI_COMM_WORLD);
+
+    if (rank == 0)
+        puts(" No Errors");
+
+    MPI_Finalize();
+
+    return 0;
+}
index 5cac6c4..131ae76 100644 (file)
@@ -53,6 +53,8 @@ mprobe 2 mpiversion=3.0
 big_count_status 1 mpiversion=3.0
 many_isend 3
 manylmt 2
+huge_anysrc 2
+huge_underflow 2
 #Needs MPI_Irsend
 #dtype_send 2
 recv_any 2
index 2fab9a5..23f4e20 100644 (file)
@@ -1,7 +1,7 @@
 p Test dsend
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Jupiter:1:(2) 0.000000] [dsend/INFO] rank 1: data exchanged
 > [Tremblay:0:(1) 0.005890] [dsend/INFO] rank 0: data exchanged
 > [rank 0] -> Tremblay
@@ -13,7 +13,7 @@ p process 1 will finish at 0.5+2*4 (send) + 1+0.1*4 (isend) = 9.9s
 p process 2 will finish at 0.5+2*4 (time before first send) + 2*(1+0.5*4) (recv+irecv) + 0.005890 (network time, same as before) = 14.505890s
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -q --log=smpi_kernel.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -q --log=smpi_kernel.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --log=xbt_cfg.thres:warning
 > [Jupiter:1:(2) 9.900000] [dsend/INFO] rank 1: data exchanged
 > [Tremblay:0:(1) 14.505890] [dsend/INFO] rank 0: data exchanged
 > [rank 0] -> Tremblay
index 5780217..41b3d13 100644 (file)
@@ -5,7 +5,7 @@ p Test output of time independent tracing
 p generate a trace with pingpong, and replay itself, then check that output trace of the second run is the same as in the first (once sorted)
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 >
 >
 >
@@ -35,7 +35,7 @@ $ ${bindir:=.}/../../../bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.t
 > [rank 2] -> Fafard
 > [rank 3] -> Ginette
 
-$ ${bindir:=.}/../../../bin/smpirun -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > [rank 2] -> Fafard
@@ -96,7 +96,7 @@ $ rm out_in_ti.txt
 p Same test, but only using one output file for all processes
 p generate a trace with pingpong, and replay itself, then check that output trace of the second run is the same as in the first (once sorted)
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.txt --cfg=tracing/smpi/format/ti-one-file:yes -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.txt --cfg=tracing/smpi/format/ti-one-file:yes -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 >
 >
 >
@@ -126,7 +126,7 @@ $ ${bindir:=.}/../../../bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.t
 > [rank 2] -> Fafard
 > [rank 3] -> Ginette
 
-$ ${bindir:=.}/../../../bin/smpirun -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=tracing/smpi/format/ti-one-file:yes -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=tracing/smpi/format/ti-one-file:yes -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > [rank 2] -> Fafard
index 6a2e302..fe266ef 100644 (file)
@@ -1,8 +1,8 @@
 ! setenv LD_LIBRARY_PATH=../../lib
 ! expect return 1
-$ ${bindir:=.}/../../../bin/smpirun -hostfile ../hostfile_empty  -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile_empty  -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning
 > [smpirun] ** error: the hostfile '../hostfile_empty' is empty. Aborting.
 
 ! expect return 1
-$ ${bindir:=.}/../../../bin/smpirun -hostfile hostfile-does-not-exist.txt -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile hostfile-does-not-exist.txt -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning
 > [smpirun] ** error: the file 'hostfile-does-not-exist.txt' does not exist. Aborting.
index 9c521e0..9bcbfa9 100644 (file)
@@ -1,7 +1,7 @@
 p Test pingpong
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 >     *** Ping-pong test (MPI_Send/MPI_Recv) ***
 >
 >
index 628ef2b..9726e7b 100644 (file)
@@ -1,5 +1,5 @@
 p Test timers
 ! setenv LD_LIBRARY_PATH=../../lib
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 1 ${bindir:=.}/timers -q --log=smpi_kernel.thres:warning --cfg=smpi/simulate-computation:no --cfg=smpi/host-speed:100000 --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 1 ${bindir:=.}/timers -q --log=smpi_kernel.thres:warning --cfg=smpi/simulate-computation:no --cfg=smpi/host-speed:100000 --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 
index 2b1db9a..91bbe67 100644 (file)
@@ -1,7 +1,7 @@
 p Test hvector
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-hvector -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-hvector -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > rank= 0, a[0][0]=0.000000
index c66385a..9bf1d2f 100644 (file)
@@ -1,7 +1,7 @@
 p Test indexed
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-indexed -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-indexed -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > buffer[0] = 0
index 0424d10..6340f92 100644 (file)
@@ -1,7 +1,7 @@
 p Test struct
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-struct -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-struct -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > Process 0 got -2 (-2?) and 8.000000 (8.0?), tab (should be all 0): 0 0 0 0 0 0 
index 438c421..5b23a47 100644 (file)
@@ -1,7 +1,7 @@
 p Test vector
 ! setenv LD_LIBRARY_PATH=../../lib
 ! output sort
-$ ${bindir:=.}/../../../bin/smpirun -map -hostfile ../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-vector -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-vector -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > rank= 0, a[0][0]=0.000000
index c9ebad2..54a297c 100644 (file)
@@ -11,7 +11,7 @@ else()
 endif()
 
 if(NOT enable_memcheck)
-  set(DART_TESTING_TIMEOUT "300") #TIMEOUT FOR EACH TEST
+  set(DART_TESTING_TIMEOUT "500") #TIMEOUT FOR EACH TEST
 else()
   set(DART_TESTING_TIMEOUT "3000") #TIMEOUT FOR EACH TEST
 endif()
index b4a3261..7da60c6 100644 (file)
@@ -229,6 +229,7 @@ set(SMPI_SRC
   src/smpi/smpi_keyvals.hpp
   src/smpi/smpi_datatype_derived.cpp
   src/smpi/smpi_datatype_derived.hpp
+  src/smpi/smpi_main.c
   src/smpi/smpi_op.cpp
   src/smpi/smpi_op.hpp
   src/smpi/smpi_process.cpp
index 485cadb..43e867b 100644 (file)
@@ -13,6 +13,7 @@ if(enable_smpi)
     ${CMAKE_BINARY_DIR}/bin/smpicc
     ${CMAKE_BINARY_DIR}/bin/smpicxx
     ${CMAKE_BINARY_DIR}/bin/smpirun
+    ${CMAKE_BINARY_DIR}/bin/smpimain
     DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
   if(SMPI_FORTRAN)
     install(PROGRAMS
index 0d157fe..c56ab59 100644 (file)
@@ -79,7 +79,7 @@ if(HAVE_GRAPHVIZ)
   endif()
 endif()
 
-if(HAVE_MC AND HAVE_GNU_LD)
+if(HAVE_MC AND HAVE_GNU_LD AND NOT ${DL_LIBRARY} STREQUAL "")
   SET(SIMGRID_DEP "${SIMGRID_DEP} ${DL_LIBRARY}")
 endif()
 
@@ -97,6 +97,17 @@ endif()
 
 # Compute the dependencies of SMPI
 ##################################
+
+if(enable_smpi)
+  if(NOT ${DL_LIBRARY} STREQUAL "")
+    set(SIMGRID_DEP "${SIMGRID_DEP} ${DL_LIBRARY}") # for privatization
+  endif()
+  add_executable(smpimain src/smpi/smpi_main.c)
+  target_link_libraries(smpimain simgrid)
+  set_target_properties(smpimain
+    PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+endif()
+
 if(enable_smpi AND APPLE)
   set(SIMGRID_DEP "${SIMGRID_DEP} -Wl,-U -Wl,_smpi_simulated_main")
 endif()