Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
wip. revising cmake for smpi.
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 2 Mar 2016 20:58:35 +0000 (21:58 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 2 Mar 2016 20:58:35 +0000 (21:58 +0100)
  have to be discussed

teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/shared/CMakeLists.txt
teshsuite/smpi/shared/shared.c
teshsuite/smpi/struct/CMakeLists.txt
teshsuite/smpi/struct/struct_test.c
teshsuite/smpi/vector/CMakeLists.txt
teshsuite/smpi/vector/vector_test.c
tools/cmake/Tests.cmake

index 00b7004..8c618ea 100644 (file)
@@ -4,10 +4,21 @@ if(enable_smpi)
   else()
     set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
   endif()
+
+#  include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
+#  foreach(x struct vector)
+#     add_executable       (${x}/${x} ${x}/${x}.c)
+#     target_link_libraries(${x}/ ${x} simgrid)
+#
+#     set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
+#     set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
+#
+#     ADD_TESH_FACTORIES(tesh-smpi-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/${x} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/${x} ${x}.tesh)
+#  endforeach()
+
 endif()
 
-set(bin_files
-  ${bin_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
-  ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_coll
-  PARENT_SCOPE)
+set(bin_files       ${bin_files}      ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
+                                      ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_coll  PARENT_SCOPE)
+# set(teshsuite_src ${teshsuite_src}                                             PARENT_SCOPE)
+# set(tesh_files    ${tesh_files}                                                PARENT_SCOPE)
index 2c9be7d..170f5ce 100644 (file)
@@ -9,14 +9,9 @@ if(enable_smpi)
   if(NOT WIN32)
     add_executable       (shared shared.c)
     target_link_libraries(shared simgrid)
+    ADD_TESH_FACTORIES(tesh-smpi-shared "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/shared --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared shared.tesh)
   endif()
 endif()
 
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/shared.tesh
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/shared.c
-  PARENT_SCOPE)
+set(tesh_files    ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/shared.tesh  PARENT_SCOPE)
+set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/shared.c     PARENT_SCOPE)
index 8636be2..f3ac848 100644 (file)
@@ -11,9 +11,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-void* hash(char *str, uint64_t* ans);
-
-void* hash(char *str, uint64_t* ans)
+static void* hash(char *str, uint64_t* ans)
 {
   *ans=5381;
   int c;
@@ -23,7 +21,6 @@ void* hash(char *str, uint64_t* ans)
   return NULL;
 }
 
-
 int main(int argc, char *argv[])
 {
   MPI_Init(&argc, &argv);
@@ -34,29 +31,28 @@ int main(int argc, char *argv[])
   uint64_t* buf = SMPI_SHARED_MALLOC(sizeof(uint64_t));
   //one writes data in it
   if(rank==0){
-    *buf=size;  
+    *buf=size;
   }
-  
+
   MPI_Barrier(MPI_COMM_WORLD);
   //everyone reads from it.
   printf("[%d] The value in the shared buffer is: %" PRIu64"\n", rank, *buf);
-  
-  
+
   MPI_Barrier(MPI_COMM_WORLD);
   //Try SMPI_SHARED_CALL function, which should call hash only once and for all.
   char *str = strdup("onceandforall");
   if(rank==size-1){
     SMPI_SHARED_CALL(hash,str,str,buf);  
   }
-  
+
   MPI_Barrier(MPI_COMM_WORLD);
-  
+
   printf("[%d] After change, the value in the shared buffer is: %" PRIu64"\n", rank, *buf);
-  
-  SMPI_SHARED_FREE(buf);  
-  buf=NULL;  
+
+  SMPI_SHARED_FREE(buf);
+  buf=NULL;
   free(str);
-    
+
   MPI_Finalize();
   return 0;
 }
index 3f0cb7e..cd6c90f 100644 (file)
@@ -8,13 +8,9 @@ if(enable_smpi)
 
   add_executable       (struct_test struct_test.c)
   target_link_libraries(struct_test simgrid)
+
+  ADD_TESH_FACTORIES(tesh-smpi-struct "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/struct --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct struct.tesh)
 endif()
 
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/struct.tesh
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/struct_test.c
-  PARENT_SCOPE)
+set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/struct.tesh    PARENT_SCOPE)
+set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/struct_test.c  PARENT_SCOPE)
index f26ebcc..835b852 100644 (file)
@@ -7,9 +7,7 @@
 #include <stdio.h>
 #include "mpi.h"
 
-int main( argc, argv )
-int argc;
-char **argv;
+int main(int argc, char **argv)
 {
     int          rank;
     struct { int a;int c; double b;int tab[2][3];} value;
@@ -58,14 +56,12 @@ char **argv;
     MPI_Bcast( &value, 1, mystruct, 0, MPI_COMM_WORLD );
 
     printf( "Process %d got %d (-2?) and %f (8.0?), tab (should be all 0): ", rank, value.a, value.b );
-   
+
     for(j=0; j<2;j++ )
       for(i=0; i<3;i++ )
         printf("%d ", tab[j][i]);
-
     printf("\n");
 
-
     /* Clean up the type */
     MPI_Type_free( &mystruct );
     MPI_Type_free( &type2 );
index 9d8960c..f9d1285 100644 (file)
@@ -8,13 +8,9 @@ if(enable_smpi)
 
   add_executable       (vector_test vector_test.c)
   target_link_libraries(vector_test simgrid)
+
+  ADD_TESH_FACTORIES(tesh-smpi-vector "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/vector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector vector.tesh)
 endif()
 
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/vector.tesh
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/vector_test.c
-  PARENT_SCOPE)
+set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/vector.tesh    PARENT_SCOPE)
+set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/vector_test.c  PARENT_SCOPE)
index 1025915..2a9a129 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE 4
 
 int main(int argc, char **argv) {
-
   int rank, i, j;
   double a[SIZE][SIZE] = {{0}};
 
@@ -21,28 +20,23 @@ int main(int argc, char **argv) {
   MPI_Type_vector(SIZE, 1, SIZE, MPI_DOUBLE, &columntype);
   MPI_Type_commit(&columntype);
 
-
     if (rank == 0) {
       for(i=0; i <SIZE;i++)
         for(j=0; j <SIZE;j++)
           a[i][j] = i*SIZE+j;
     }
 
-    /* only one column is send
-     * this is an exemple for non-contignous data*/
+    /* only one column is send this is an exemple for non-contignous data*/
     MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
 
     for(i=0; i<SIZE; i++){
       for (j=0; j < SIZE; j++) {
-        printf("rank= %d, a[%d][%d]=%f\n",
-               rank, i, j, a[i][j]);
+        printf("rank= %d, a[%d][%d]=%f\n", rank, i, j, a[i][j]);
       }
       printf("\n");
     }
 
-
   MPI_Type_free(&columntype);
   MPI_Finalize();
   return 0;
 }
-
index bf7cb3f..08799d8 100644 (file)
@@ -1,4 +1,3 @@
-
 IF(enable_memcheck)
   include(FindValgrind)
 ENDIF()
@@ -113,7 +112,6 @@ IF(NOT enable_memcheck)
     ENDIF()
   ENDIF()
 
-
   ### SIMIX ###
   # BEGIN TESH TESTS
   IF(HAVE_RAW_CONTEXTS)
@@ -311,14 +309,9 @@ IF(NOT enable_memcheck)
     ADD_TESH_FACTORIES(tesh-smpi-pt2pt           "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong pt2pt.tesh)
     ADD_TESH_FACTORIES(tesh-smpi-bcast           "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/bcast --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast bcast.tesh)
     ADD_TESH_FACTORIES(tesh-smpi-reduce          "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/reduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce reduce.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-vector          "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/vector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector vector.tesh)
     ADD_TESH_FACTORIES(tesh-smpi-hvector         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/hvector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hvector hvector.tesh)
     ADD_TESH_FACTORIES(tesh-smpi-indexed         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/indexed --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/indexed indexed.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-struct          "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/struct --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct struct.tesh)
     ADD_TESH_FACTORIES(tesh-smpi-compute         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/compute --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute compute.tesh)
-    IF(NOT WIN32)
-      ADD_TESH_FACTORIES(tesh-smpi-shared        "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/shared --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared shared.tesh)
-    ENDIF()
     # smpi broken usage
     ADD_TESH_FACTORIES(tesh-smpi-broken          "thread"              --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong broken_hostfiles.tesh)
     ADD_TESH(tesh-smpi-replay-ti-tracing       --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong TI_output.tesh)