Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authoretortilopez <ruben-ezequiel.torti-lopez@inria.fr>
Wed, 1 Oct 2014 09:06:03 +0000 (11:06 +0200)
committeretortilopez <ruben-ezequiel.torti-lopez@inria.fr>
Wed, 1 Oct 2014 09:06:03 +0000 (11:06 +0200)
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/Flags.cmake
examples/smpi/CMakeLists.txt
examples/smpi/mc/non_deterministic.tesh
examples/smpi/mc/send_deterministic.tesh
src/smpi/colls/allreduce-ompi-ring-segmented.c
src/smpi/colls/gather-ompi.c
src/smpi/colls/reduce-flat-tree.c
src/smpi/colls/scatter-ompi.c
src/smpi/smpi_base.c
src/smpi/smpi_global.c

index cb5d1ea..b659eb4 100644 (file)
@@ -476,7 +476,9 @@ ENDIF()
       ADD_TESH_FACTORIES(smpi-energy-f90         "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f90/energy.tesh)
     ENDIF()
     ADD_TESH_FACTORIES(smpi-msg-masterslave      "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave --cd ${CMAKE_BINARY_DIR}/examples/smpi/smpi_msg_masterslave ${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh)
-    ADD_TESH(smpi-replay-multiple      --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple --cd ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/replay_multiple.tesh)
+    IF(NOT HAVE_MC)
+      ADD_TESH(smpi-replay-multiple      --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple --cd ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/replay_multiple.tesh)
+    ENDIF()
     IF(HAVE_TRACING)
       ADD_TESH(smpi-tracing-ptp                  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/tracing/smpi_traced.tesh)
       ADD_TESH(smpi-replay                       --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/smpi_replay.tesh)
index b5ea03d..6e50110 100644 (file)
@@ -31,8 +31,9 @@ if(enable_compile_warnings)
 endif()
 
 if(enable_compile_optimizations)
-  set(optCFLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing ")
+  set(optCFLAGS "-O3 -funroll-loops -fno-strict-aliasing ")
   if(CMAKE_COMPILER_IS_GNUCC AND (NOT enable_model-checking))
+    set(optCFLAGS "${optCFLAGS} -finline-functions ")
     if(WIN32)
       if (COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.7")
       # On windows, we need 4.8 or higher to enable lto because of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50293
@@ -64,7 +65,11 @@ if(enable_model-checking AND enable_compile_optimizations)
       src/mc/mc_compare.cpp src/mc/mc_diff.c
       src/mc/mc_dwarf.c src/mc/mc_dwarf_attrnames.h src/mc/mc_dwarf_expression.c src/mc/mc_dwarf_tagnames.h
       src/mc/mc_set.cpp)
-    set_source_files_properties(${s} PROPERTIES COMPILE_FLAGS "-O3 -finline-functions -funroll-loops -fno-strict-aliasing")
+      set (mcCFLAGS "-O3  -funroll-loops -fno-strict-aliasing")
+       if(CMAKE_COMPILER_IS_GNUCC)
+         set (mcCFLAGS "${mcCFLAGS} -finline-functions")
+      endif()
+      set_source_files_properties(${s} PROPERTIES COMPILE_FLAGS ${mcCFLAGS})
   endforeach()
 endif()
 
index b3709c7..c067e74 100644 (file)
@@ -19,28 +19,36 @@ if(enable_smpi)
   add_executable(smpi_traced_simple tracing/smpi_traced_simple.c)
   add_executable(smpi_replay replay/replay.c)
 
-  if(HAVE_MC)
-    add_executable(mc/bugged1 mc/bugged1.c)
-    add_executable(mc/bugged2 mc/bugged2.c)
-    add_executable(mc/bugged1_liveness mc/bugged1_liveness.c)
-    add_executable(mc/send_deterministic mc/send_deterministic.c)
-    add_executable(mc/non_deterministic mc/non_deterministic.c)
-    add_executable(mc/mutual_exclusion mc/mutual_exclusion.c)
-
-    target_link_libraries(mc/bugged1 simgrid)
-    target_link_libraries(mc/bugged2 simgrid)
-    target_link_libraries(mc/bugged1_liveness simgrid)
-    target_link_libraries(mc/send_deterministic simgrid)
-    target_link_libraries(mc/non_deterministic simgrid)
-    target_link_libraries(mc/mutual_exclusion simgrid)
-  endif()
-
   target_link_libraries(bcbench simgrid)
   target_link_libraries(mvmul simgrid)
   target_link_libraries(smpi_traced simgrid)
   target_link_libraries(smpi_traced_simple simgrid)
   target_link_libraries(smpi_replay simgrid)
 
+  if(HAVE_MC)
+    add_executable(smpi_bugged1 mc/bugged1.c)
+    add_executable(smpi_bugged2 mc/bugged2.c)
+    add_executable(smpi_bugged1_liveness mc/bugged1_liveness.c)
+    add_executable(smpi_send_deterministic mc/send_deterministic.c)
+    add_executable(smpi_non_deterministic mc/non_deterministic.c)
+    add_executable(smpi_mutual_exclusion mc/mutual_exclusion.c)
+
+    target_link_libraries(smpi_bugged1 simgrid)
+    target_link_libraries(smpi_bugged2 simgrid)
+    target_link_libraries(smpi_bugged1_liveness simgrid)
+    target_link_libraries(smpi_send_deterministic simgrid)
+    target_link_libraries(smpi_non_deterministic simgrid)
+    target_link_libraries(smpi_mutual_exclusion simgrid)
+    
+    set_target_properties(smpi_bugged1 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./mc")
+    set_target_properties(smpi_bugged2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./mc")
+    set_target_properties(smpi_bugged1_liveness PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./mc")
+    set_target_properties(smpi_send_deterministic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./mc")
+    set_target_properties(smpi_non_deterministic PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./mc")
+    set_target_properties(smpi_mutual_exclusion PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./mc")
+    
+  endif()
+  
 endif()
 
 set(tesh_files
index f4730df..d32f46a 100644 (file)
@@ -1,7 +1,7 @@
 #! ./tesh
 
 ! timeout 60
-$ ../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile_non_deterministic  -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check:1 --cfg=model-check/communications_determinism:1 --cfg=smpi/send_is_detached_thres:0 --cfg=smpi/running_power:1e9 ./non_deterministic
+$ ../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile_non_deterministic  -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check:1 --cfg=model-check/communications_determinism:1 --cfg=smpi/send_is_detached_thres:0 --cfg=smpi/running_power:1e9 ./smpi_non_deterministic
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'surf/precision' to '1e-9'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
index c952d18..6bafa97 100644 (file)
@@ -1,7 +1,7 @@
 #! ./tesh
 
 ! timeout 60
-$ ../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile_send_deterministic  -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check:1 --cfg=model-check/send_determinism:1 --cfg=smpi/send_is_detached_thres:0 --cfg=smpi/running_power:1e9 ./send_deterministic
+$ ../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile_send_deterministic  -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check:1 --cfg=model-check/send_determinism:1 --cfg=smpi/send_is_detached_thres:0 --cfg=smpi/running_power:1e9 ./smpi_send_deterministic
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'surf/precision' to '1e-9'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
index d230b91..2812d86 100644 (file)
@@ -228,10 +228,10 @@ smpi_coll_tuned_allreduce_ompi_ring_segmented(void *sbuf, void *rbuf, int count,
    max_real_segsize = true_extent + (max_segcount - 1) * extent;
 
    /* Allocate and initialize temporary buffers */
-   inbuf[0] = (char*)malloc(max_real_segsize);
+   inbuf[0] = (char*)smpi_get_tmp_sendbuffer(max_real_segsize);
    if (NULL == inbuf[0]) { ret = -1; line = __LINE__; goto error_hndl; }
    if (size > 2) {
-      inbuf[1] = (char*)malloc(max_real_segsize);
+      inbuf[1] = (char*)smpi_get_tmp_recvbuffer(max_real_segsize);
       if (NULL == inbuf[1]) { ret = -1; line = __LINE__; goto error_hndl; }
    }
 
@@ -374,15 +374,15 @@ smpi_coll_tuned_allreduce_ompi_ring_segmented(void *sbuf, void *rbuf, int count,
 
    }
 
-   if (NULL != inbuf[0]) free(inbuf[0]);
-   if (NULL != inbuf[1]) free(inbuf[1]);
+   if (NULL != inbuf[0]) smpi_free_tmp_buffer(inbuf[0]);
+   if (NULL != inbuf[1]) smpi_free_tmp_buffer(inbuf[1]);
 
    return MPI_SUCCESS;
 
  error_hndl:
    XBT_DEBUG("%s:%4d\tRank %d Error occurred %d\n",
                 __FILE__, line, rank, ret);
-   if (NULL != inbuf[0]) free(inbuf[0]);
-   if (NULL != inbuf[1]) free(inbuf[1]);
+   if (NULL != inbuf[0]) smpi_free_tmp_buffer(inbuf[0]);
+   if (NULL != inbuf[1]) smpi_free_tmp_buffer(inbuf[1]);
    return ret;
 }
index 7b4bd61..b0da94d 100644 (file)
@@ -77,7 +77,7 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
        } else {
            /* root is not on 0, allocate temp buffer for recv,
             * rotate data at the end */
-           tempbuf = (char *) malloc(rtrue_extent + (rcount*size - 1) * rextent);
+           tempbuf = (char *) smpi_get_tmp_recvbuffer(rtrue_extent + (rcount*size - 1) * rextent);
            if (NULL == tempbuf) {
                err= MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
            }
@@ -99,7 +99,7 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
        /* other non-leaf nodes, allocate temp buffer for data received from
         * children, the most we need is half of the total data elements due
         * to the property of binimoal tree */
-       tempbuf = (char *) malloc(strue_extent + (scount*size - 1) * sextent);
+       tempbuf = (char *) smpi_get_tmp_sendbuffer(strue_extent + (scount*size - 1) * sextent);
        if (NULL == tempbuf) {
            err= MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
        }
@@ -169,7 +169,7 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
                                                 (char *) rbuf,rcount*root,rdtype);
            if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
-           free(tempbuf);
+           smpi_free_tmp_buffer(tempbuf);
        }
     } else if (!(vrank % 2)) {
        /* other non-leaf nodes */
index 78be7fd..8a3140d 100644 (file)
@@ -35,7 +35,7 @@ smpi_coll_tuned_reduce_flat_tree(void *sbuf, void *rbuf, int count,
      messages. */
 
   if (size > 1)
-    origin = (char *) xbt_malloc(count * extent);
+    origin = (char *) smpi_get_tmp_recvbuffer(count * extent);
 
 
   /* Initialize the receive buffer. */
@@ -61,7 +61,7 @@ smpi_coll_tuned_reduce_flat_tree(void *sbuf, void *rbuf, int count,
   }
 
   if (origin)
-    free(origin);
+    smpi_free_tmp_buffer(origin);
 
   /* All done */
   return 0;
index 2d3dacd..9eace67 100644 (file)
@@ -77,7 +77,7 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
            }
        } else {
            /* root is not on 0, allocate temp buffer for send */
-           tempbuf = (char *) malloc(strue_extent + (scount*size - 1) * sextent);
+           tempbuf = (char *) smpi_get_tmp_sendbuffer(strue_extent + (scount*size - 1) * sextent);
            if (NULL == tempbuf) {
                err = MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
            }
@@ -105,7 +105,7 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
     } else if (!(vrank % 2)) {
        /* non-root, non-leaf nodes, allocate temp buffer for recv
         * the most we need is rcount*size/2 */
-       tempbuf = (char *) malloc(rtrue_extent + (rcount*size - 1) * rextent);
+       tempbuf = (char *) smpi_get_tmp_recvbuffer(rtrue_extent + (rcount*size - 1) * rextent);
        if (NULL == tempbuf) {
            err= MPI_ERR_OTHER; line = __LINE__; goto err_hndl;
        }
@@ -155,7 +155,7 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
     }
 
     if (NULL != tempbuf)
-      free(tempbuf);
+      smpi_free_tmp_buffer(tempbuf);
     //!FIXME : store the tree, as done in ompi, instead of calculating it each time ?
     xbt_free(bmtree);
 
index 035c5ef..940cbe2 100644 (file)
@@ -1372,7 +1372,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
 
   char* sendtmpbuf = (char*) sendbuf;
   if( sendbuf == MPI_IN_PLACE ) {
-    sendtmpbuf = (char *)xbt_malloc(count*smpi_datatype_get_extent(datatype));
+    sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
     smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
   }
 
@@ -1433,7 +1433,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
     xbt_free(requests);
 
     if( sendbuf == MPI_IN_PLACE ) {
-      xbt_free(sendtmpbuf);
+      smpi_free_tmp_buffer(sendtmpbuf);
     }
   }
 }
@@ -1470,7 +1470,7 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
   for(other = 0; other < rank; other++) {
     // FIXME: possibly overkill we we have contiguous/noncontiguous data
     // mapping...
-    tmpbufs[index] = xbt_malloc(count * dataext);
+    tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
     requests[index] =
       smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
                       comm);
@@ -1505,7 +1505,7 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
     }
   }
   for(index = 0; index < rank; index++) {
-    xbt_free(tmpbufs[index]);
+    smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
     smpi_mpi_request_free(&requests[index]);
@@ -1536,7 +1536,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
   for(other = 0; other < rank; other++) {
     // FIXME: possibly overkill we we have contiguous/noncontiguous data
     // mapping...
-    tmpbufs[index] = xbt_malloc(count * dataext);
+    tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
     requests[index] =
       smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
                       comm);
@@ -1577,7 +1577,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
     }
   }
   for(index = 0; index < rank; index++) {
-    xbt_free(tmpbufs[index]);
+    smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
     smpi_mpi_request_free(&requests[index]);
index ca28534..03d06e1 100644 (file)
@@ -169,7 +169,7 @@ int smpi_process_initialized(void)
 void smpi_process_mark_as_initialized(void)
 {
   int index = smpi_process_index();
-  if ((index != MPI_UNDEFINED) && (!process_data[index_to_process_data[index]]->state != SMPI_FINALIZED))
+  if ((index != MPI_UNDEFINED) && (process_data[index_to_process_data[index]]->state != SMPI_FINALIZED))
     process_data[index_to_process_data[index]]->state = SMPI_INITIALIZED;
 }