Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #164 from sthibaul/smpi_user_data
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 3 May 2017 15:53:50 +0000 (17:53 +0200)
committerGitHub <noreply@github.com>
Wed, 3 May 2017 15:53:50 +0000 (17:53 +0200)
restore smpi_process_get_user_data and smpi_process_set_user_data

src/smpi/smpi_global.cpp
src/smpi/smpi_process.cpp
src/smpi/smpi_process.hpp
teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/privatization/privatization.c [new file with mode: 0644]
teshsuite/smpi/privatization/privatization.tesh [new file with mode: 0644]
teshsuite/smpi/privatization/privatization_dlopen.tesh [new file with mode: 0644]

index 7f62db8..7df8301 100644 (file)
@@ -119,6 +119,14 @@ int smpi_process_index(){
   return smpi_process()->index();
 }
 
+void * smpi_process_get_user_data(){
+  return smpi_process()->get_user_data();
+}
+
+void smpi_process_set_user_data(void *data){
+  return smpi_process()->set_user_data(data);
+}
+
 
 int smpi_global_size()
 {
index 92cd1d3..194cca9 100644 (file)
@@ -139,6 +139,16 @@ 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_;
 }
index 9cc8a2a..4bf8d0e 100644 (file)
@@ -28,6 +28,7 @@ class Process {
     MPI_Comm comm_self_   = MPI_COMM_NULL;
     MPI_Comm comm_intra_  = MPI_COMM_NULL;
     MPI_Comm* comm_world_ = nullptr;
+    void* data_           = nullptr; /* user data */
     int index_            = MPI_UNDEFINED;
     char state_;
     int sampling_                   = 0; /* inside an SMPI_SAMPLE_ block? */
@@ -51,6 +52,8 @@ class Process {
     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();
index 8ebe1cb..ed2a264 100644 (file)
@@ -8,7 +8,7 @@ if(enable_smpi)
   include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
   foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast 
             coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong 
-            type-hvector type-indexed type-struct type-vector bug-17132 timers )
+            type-hvector type-indexed type-struct type-vector bug-17132 timers privatization )
     add_executable       (${x}  ${x}/${x}.c)
     target_link_libraries(${x}  simgrid)
     set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
@@ -34,7 +34,8 @@ set(tesh_files    ${tesh_files}     ${CMAKE_CURRENT_SOURCE_DIR}/coll-allreduce/c
                                     ${CMAKE_CURRENT_SOURCE_DIR}/coll-allreduce/coll-allreduce-automatic.tesh
                                     ${CMAKE_CURRENT_SOURCE_DIR}/coll-alltoall/clusters.tesh
                                     ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt-pingpong/broken_hostfiles.tesh
-                                    ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt-pingpong/TI_output.tesh              PARENT_SCOPE)
+                                    ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt-pingpong/TI_output.tesh              
+                                    ${CMAKE_CURRENT_SOURCE_DIR}/privatization/privatization_dlopen.tesh                             PARENT_SCOPE)
 set(bin_files       ${bin_files}    ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
                                     ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_cluster
                                     ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_coll
@@ -116,4 +117,12 @@ if(enable_smpi)
   # Extra pt2pt pingpong test: broken usage ti-tracing
   ADD_TESH_FACTORIES(tesh-smpi-broken  "thread"   --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pt2pt-pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong broken_hostfiles.tesh)
   ADD_TESH(tesh-smpi-replay-ti-tracing            --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pt2pt-pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong TI_output.tesh)
+
+  # Simple privatization tests
+  if(HAVE_PRIVATIZATION)
+    ADD_TESH_FACTORIES(tesh-smpi-privatization-mmap  "thread;ucontext;raw;boost"   --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/privatization --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/privatization privatization.tesh)
+  endif()
+
+    ADD_TESH_FACTORIES(tesh-smpi-privatization-dlopen  "thread;ucontext;raw;boost"   --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/privatization --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/privatization privatization_dlopen.tesh)
+
 endif()
diff --git a/teshsuite/smpi/privatization/privatization.c b/teshsuite/smpi/privatization/privatization.c
new file mode 100644 (file)
index 0000000..07c2b8f
--- /dev/null
@@ -0,0 +1,27 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+
+
+static int myvalue = 0;
+
+int main(int argc, char **argv)
+{
+    int me;
+
+    MPI_Init(&argc, &argv);
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &me);
+
+    MPI_Barrier(MPI_COMM_WORLD);
+
+    myvalue = me;
+
+    MPI_Barrier(MPI_COMM_WORLD);
+
+    if(myvalue!=me)
+      printf("Privatization error - %d != %d\n", myvalue, me);
+    MPI_Finalize();
+    return 0;
+}
diff --git a/teshsuite/smpi/privatization/privatization.tesh b/teshsuite/smpi/privatization/privatization.tesh
new file mode 100644 (file)
index 0000000..83215a6
--- /dev/null
@@ -0,0 +1,5 @@
+p Test privatization
+! setenv LD_LIBRARY_PATH=../../lib
+! timeout 5
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:1
+> You requested to use 32 processes, but there is only 5 processes in your hostfile...
diff --git a/teshsuite/smpi/privatization/privatization_dlopen.tesh b/teshsuite/smpi/privatization/privatization_dlopen.tesh
new file mode 100644 (file)
index 0000000..6d8f954
--- /dev/null
@@ -0,0 +1,5 @@
+p Test privatization with dlopen
+! setenv LD_LIBRARY_PATH=../../lib
+! timeout 5
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:dlopen
+> You requested to use 32 processes, but there is only 5 processes in your hostfile...