Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge ../simgrid
authorshenshei <paul.bedaride@gmail.com>
Fri, 30 Nov 2012 14:09:01 +0000 (15:09 +0100)
committershenshei <paul.bedaride@gmail.com>
Fri, 30 Nov 2012 14:09:01 +0000 (15:09 +0100)
36 files changed:
README.coding
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeExe.cmake
buildtools/Cmake/Modules/FindValgrind.cmake
examples/msg/chainsend/CMakeLists.txt [new file with mode: 0644]
examples/msg/chainsend/README [new file with mode: 0644]
examples/msg/chainsend/broadcaster.c [new file with mode: 0644]
examples/msg/chainsend/broadcaster.h [new file with mode: 0644]
examples/msg/chainsend/chainsend.c [new file with mode: 0644]
examples/msg/chainsend/chainsend.tesh [new file with mode: 0644]
examples/msg/chainsend/common.c [new file with mode: 0644]
examples/msg/chainsend/common.h [new file with mode: 0644]
examples/msg/chainsend/deployment_chainsend.xml [new file with mode: 0644]
examples/msg/chainsend/generate_deployment_file.rb [new file with mode: 0755]
examples/msg/chainsend/iterator.c [new file with mode: 0644]
examples/msg/chainsend/iterator.h [new file with mode: 0644]
examples/msg/chainsend/messages.c [new file with mode: 0644]
examples/msg/chainsend/messages.h [new file with mode: 0644]
examples/msg/chainsend/peer.c [new file with mode: 0644]
examples/msg/chainsend/peer.h [new file with mode: 0644]
examples/msg/chainsend/platform_chainsend.xml [new file with mode: 0644]
examples/simdag/dot/dot_test.c
examples/simdag/dot/simulate_dot.c
examples/smpi/replay/actions_bcast.txt
examples/smpi/replay/actions_with_isend.txt [new file with mode: 0644]
examples/smpi/replay/one_trace
examples/smpi/replay/smpi_replay.tesh
src/simdag/sd_dotloader.c
src/smpi/smpi_replay.c
src/xbt/xbt_main.c
teshsuite/smpi/mpich-test/pt2pt/sendcplx.std [moved from teshsuite/smpi/mpich-test/pt2pt/sendcplx.stdo with 100% similarity]
teshsuite/smpi/mpich-test/pt2pt/structlb.c
teshsuite/smpi/mpich-test/pt2pt/testtypes.c
teshsuite/smpi/mpich-test/pt2pt/typelb.c

index 481dfe9..22b9aea 100644 (file)
@@ -16,7 +16,7 @@ having all of them in the same package makes the installation easier
 for end-users. Moreover, it enables to share the compilation chain and
 eases the development.
 
-The tree is not splited on projects, but on file finality:
+The tree is not split on projects, but on file finality:
  include/            -> all *public* headers
  include/xbt/*.h     -> one file per module
 
@@ -52,11 +52,11 @@ FIXME: this list of arguments is still to be discussed, maybe
 *****************************************************
 
 It may sound strange, but the type naming convention was source of intense
-discution between da SimGrid posse members. The convention we came to may not
+discussion between da SimGrid posse members. The convention we came to may not
 be the best solution, but it has the merit to exist and leave everyone work.
 So please stick to it.
 
-  - ???_t is a valid type (builded with typedef)
+  - ???_t is a valid type (built with typedef)
   - s_toto_t is a structure (access to fields with .)
   - s_toto   is a structure needing 'struct' keyword to be used
   - e_toto_t is an enum
@@ -67,7 +67,7 @@ So please stick to it.
 Please to not call toto_t something else than an 'object' (ie, something you
 have to call _new and _free on it).
 
-Exemple:
+Example:
   typedef struct s_toto {} s_toto_t, *toto_t;
   typedef enum {} e_toto_t;
   
@@ -86,12 +86,12 @@ MALLOC:
  Don't use it, or you'll have to check the result (and do some dirty stuff
  on AIX). Use xbt_malloc (or even better, xbt_new) instead.
 
-SIZE_T
+SIZE_T (FIXME: obsolete?)
  If possible, avoid size_t and use unsigned long instead. If not,
  #include <sys/types.h> in all files manipulating size_t
  do cast it to unsigned long before printing (and use %lu)
  
-PRINTF pointer difference
+PRINTF pointer difference (FIXME: advertise %td instead?)
  printf ("diff = %ld\n", (long) (pointer2 - pointer1));
   
 
@@ -118,11 +118,11 @@ The documentation of each function must be in the C file were it lives.
 Any public element (function, type and macro) must have a @brief part.
 
 **
-** XBT virtualization mecanism (FIXME:this section is deprecated)
+** XBT virtualization mechanism (FIXME: this section is deprecated)
 **
 ****************************************************
 
-There is some functionnalities that we want to virtualize in XBT. We
+There is some functionalities that we want to virtualize in XBT. We
 want xbt_time to give the simulated clock when running on top of the
 simulator, and the host clock when running on a real system. This
 could be placed in GRAS (and was, historically), but there is some
@@ -163,8 +163,25 @@ investigating the portability of the thing to windows.
 * SimGrid Hacker Survival Guide (FIXME: should be betterly placed)
 ********************************
 
+* Before pushing any change, don't forget to check if the compilation
+  passes with compiler optimizations and warnings turned on:
+      cmake -Denable_compile_optimizations=ON \
+            -Denable_compile_warnings=ON
+
+* If you want to debug memory allocation problems, here are a few hints:
+  - disable compiler optimizations, to have better backtraces;
+  - disable the mallocators, or it will be hard to match malloc's with
+    free's;
+  - disable model checking, unless your problem lies in the model
+    checker part of SimGrid (MC brings its own malloc implementation,
+    which valgrind doesn't understand).
+  All this is configured with:
+      cmake -Denable_model-checking=OFF \
+            -Denable_mallocators=OFF \
+            -Denable_compile_optimizations=OFF
+
 * If you break the logs (for example while hacking in the dynars), you
   want to define XBT_LOG_MAYDAY at the beginning of log.h. It will
-  desactivate the whole logging mecanism, switching to printfs
+  deactivate the whole logging mechanism, switching to printfs
   instead. SimGrid becomes incredibly verbose when doing so, but it
-  you let you fixing the dynars.
\ No newline at end of file
+  you let you fixing the dynars.
index f530f1b..759a1f5 100644 (file)
@@ -100,6 +100,7 @@ if(NOT enable_memcheck)
   # MSG examples
   ADD_TEST(msg-file                             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/io/io.tesh)
   ADD_TEST(msg-start-kill-time                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/start_kill_time/start_kill_time.tesh)
+  ADD_TEST(msg-chainsend                        ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chainsend --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/chainsend --cd ${CMAKE_HOME_DIRECTORY}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/chainsend/chainsend.tesh)
 
   ADD_TEST(msg-sendrecv-CLM03-thread            ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_CLM03.tesh)
   ADD_TEST(msg-sendrecv-Vegas-thread            ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Vegas.tesh)
@@ -283,8 +284,12 @@ if(NOT enable_memcheck)
 
   if(HAVE_NS3)
     ADD_TEST(msg-ns3-thread                     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
-    ADD_TEST(msg-ns3-ucontext                   ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
-    ADD_TEST(msg-ns3-raw                        ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
+    if(CONTEXT_UCONTEXT)
+      ADD_TEST(msg-ns3-ucontext                   ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
+    endif()
+    if(HAVE_RAWCTX)
+      ADD_TEST(msg-ns3-raw                        ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
+    endif()
   endif()
 
   IF(HAVE_TRACING)
@@ -322,8 +327,6 @@ if(NOT enable_memcheck)
     set_tests_properties(simdag-test-lua                PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
   endif()
 
-  # END TESH TESTS
-
   if(enable_smpi)
     # smpi examples
     ADD_TEST(smpi-bcast-thread                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast.tesh)
@@ -334,7 +337,16 @@ if(NOT enable_memcheck)
     ADD_TEST(smpi-struct-thread                 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
     ADD_TEST(smpi-pt2pt-thread                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
     ADD_TEST(smpi-compute-thread                ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
-
+    if(CONTEXT_UCONTEXT)
+      ADD_TEST(smpi-bcast-ucontext              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast.tesh)
+      ADD_TEST(smpi-reduce-ucontext             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce.tesh)
+      ADD_TEST(smpi-vector-ucontex              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector.tesh)
+      ADD_TEST(smpi-hvector-ucontex             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hvector.tesh)
+      ADD_TEST(smpi-indexed-ucontext            ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/indexed.tesh)
+      ADD_TEST(smpi-struct-ucontext             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
+      ADD_TEST(smpi-pt2pt-ucontext              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
+      ADD_TEST(smpi-compute-ucontext            ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
+    endif()
     if(HAVE_RAWCTX)
       ADD_TEST(smpi-bcast-raw                   ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast.tesh)
       ADD_TEST(smpi-reduce-raw                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce.tesh)
@@ -344,28 +356,25 @@ if(NOT enable_memcheck)
       ADD_TEST(smpi-struct-raw                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
       ADD_TEST(smpi-pt2pt-raw                   ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
       ADD_TEST(smpi-compute-raw                 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
+    endif()
+    if(HAVE_TRACING)
+      ADD_TEST(smpi-tracing-ptp                 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/tracing/smpi_traced.tesh)
+    endif()
+  endif()
+
+  # END TESH TESTS
+
+  if(enable_smpi)
+    if(HAVE_TRACING)
+      ADD_TEST(smpi-replay                      ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/smpi_replay.tesh)
+    endif()
+    if(HAVE_RAWCTX)
       ADD_TEST(smpi-mpich-env-raw               ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich-test/env ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/env/runtests -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/env -basedir=${CMAKE_BINARY_DIR}/smpi_script/ -fort=${SMPI_F2C})
       ADD_TEST(smpi-mpich-pt2pt-raw             ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich-test/pt2pt ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/pt2pt/runtests -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/pt2pt -basedir=${CMAKE_BINARY_DIR}/smpi_script/ -fort=${SMPI_F2C})
       ADD_TEST(smpi-mpich-context-raw           ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich-test/context ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/context/runtests -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/context -basedir=${CMAKE_BINARY_DIR}/smpi_script/ -fort=${SMPI_F2C})
       ADD_TEST(smpi-mpich-profile-raw           ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich-test/profile  ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/profile/runtests -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/profile -basedir=${CMAKE_BINARY_DIR}/smpi_script/ -fort=${SMPI_F2C} )
-      ADD_TEST(smpi-mpich-coll-raw              ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich-test/coll ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/coll/runtests -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/coll -basedir=${CMAKE_BINARY_DIR}/smpi_script/ -fort=${SMPI_F2C})       
+      ADD_TEST(smpi-mpich-coll-raw              ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich-test/coll ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/coll/runtests -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich-test/coll -basedir=${CMAKE_BINARY_DIR}/smpi_script/ -fort=${SMPI_F2C})
       set_tests_properties(smpi-mpich-env-raw smpi-mpich-context-raw  smpi-mpich-pt2pt-raw smpi-mpich-coll-raw smpi-mpich-profile-raw PROPERTIES PASS_REGULAR_EXPRESSION "-- No differences found; test successful")
-    
-    
-    endif()
-    if(CONTEXT_UCONTEXT)
-      ADD_TEST(smpi-bcast-ucontext              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast.tesh)
-      ADD_TEST(smpi-reduce-ucontext             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce.tesh)
-      ADD_TEST(smpi-vector-ucontex              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector.tesh)
-      ADD_TEST(smpi-hvector-ucontex             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hvector.tesh)
-      ADD_TEST(smpi-indexed-ucontext            ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/indexed.tesh)
-      ADD_TEST(smpi-struct-ucontext             ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
-      ADD_TEST(smpi-pt2pt-ucontext              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
-      ADD_TEST(smpi-compute-ucontext            ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
-    endif()
-    if(HAVE_TRACING)
-      ADD_TEST(smpi-tracing-ptp                 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/tracing/smpi_traced.tesh)
-      ADD_TEST(smpi-replay                      ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/smpi_replay.tesh)
     endif()
   endif()
 
index 9cabdc4..4efb7e8 100644 (file)
@@ -52,7 +52,7 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
   message(STATUS "System processor: sh")
 
-ELSE() #PROCESSOR NOT fIND
+ELSE() #PROCESSOR NOT FOUND
   message(STATUS "PROCESSOR NOT FOUND: ${CMAKE_SYSTEM_PROCESSOR}")
 
 ENDIF()
index 51a92cf..0b956b8 100644 (file)
@@ -671,6 +671,7 @@ set(EXAMPLES_CMAKEFILES_TXT
   examples/msg/priority/CMakeLists.txt
   examples/msg/properties/CMakeLists.txt
   examples/msg/sendrecv/CMakeLists.txt
+  examples/msg/chainsend/CMakeLists.txt
   examples/msg/start_kill_time/CMakeLists.txt
   examples/msg/suspend/CMakeLists.txt
   examples/msg/token_ring/CMakeLists.txt
index 8c1c4f7..b297061 100644 (file)
@@ -35,6 +35,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/properties)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/actions)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/migration)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chainsend)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/suspend)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/parallel_task)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/priority)
index cbb044c..94642d6 100644 (file)
@@ -21,7 +21,7 @@ if(VALGRIND_EXE)
   if(NEW_VALGRIND_VERSION)
     message(STATUS "Valgrind version: ${NEW_VALGRIND_VERSION}")
     exec_program("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Scripts/generate_memcheck_tests.pl ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/AddTests.cmake > ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/memcheck_tests.cmake" OUTPUT_VARIABLE SHUTT)
-    set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-reachable=yes --track-origins=yes --read-var-info=no")
+    set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --trace-children-skip=/usr/bin/*,/bin/* --leak-check=full --show-reachable=yes --track-origins=yes --read-var-info=no")
     message(STATUS "Valgrind options: ${MEMORYCHECK_COMMAND_OPTIONS}")
   else()
     set(enable_memcheck false)
diff --git a/examples/msg/chainsend/CMakeLists.txt b/examples/msg/chainsend/CMakeLists.txt
new file mode 100644 (file)
index 0000000..56d68bb
--- /dev/null
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(chainsend chainsend.c iterator.c common.c messages.c broadcaster.c peer.c)
+
+### Add definitions for compile
+target_link_libraries(chainsend simgrid m )
+
+set(tesh_files
+  ${tesh_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/chainsend.tesh
+  PARENT_SCOPE
+  )
+set(xml_files
+  ${xml_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_chainsend.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/platform_chainsend.xml
+  PARENT_SCOPE
+  )
+set(examples_src
+  ${examples_src}
+  ${CMAKE_CURRENT_SOURCE_DIR}/iterator.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/common.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/messages.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/broadcaster.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/peer.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/kadeploy.c
+  PARENT_SCOPE
+  )
+set(bin_files
+  ${bin_files}
+  PARENT_SCOPE
+  )
+set(txt_files
+  ${txt_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/README
+  PARENT_SCOPE
+  )
diff --git a/examples/msg/chainsend/README b/examples/msg/chainsend/README
new file mode 100644 (file)
index 0000000..37f09ef
--- /dev/null
@@ -0,0 +1,12 @@
+====================================================
+           Chainsend MSG implementation
+====================================================
+Directory : SG_INSTALL_DIR/examples/msg/chainsend
+Content   : Chainsend MSG implementation
+Author    : Maximiliano Geier
+====================================================
+
+
+This directory contains an implementation of a
+file broadcasting system, similar to Kastafior, 
+the one found in Kadeploy, using MSG. 
diff --git a/examples/msg/chainsend/broadcaster.c b/examples/msg/chainsend/broadcaster.c
new file mode 100644 (file)
index 0000000..c87efc9
--- /dev/null
@@ -0,0 +1,154 @@
+#include "broadcaster.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_broadcaster,
+                             "Messages specific for the broadcaster");
+
+xbt_dynar_t build_hostlist_from_hostcount(int hostcount)
+{
+  xbt_dynar_t host_list = xbt_dynar_new(sizeof(char*), NULL);
+  char *hostname = NULL;
+  int i = 1;
+  
+  for (; i < hostcount+1; i++) {
+    hostname = xbt_new(char, HOSTNAME_LENGTH);
+    snprintf(hostname, HOSTNAME_LENGTH, "host%d", i);
+    XBT_DEBUG("%s", hostname);
+    xbt_dynar_push(host_list, &hostname);
+  }
+  return host_list;
+}
+
+int broadcaster_build_chain(broadcaster_t bc)
+{
+  msg_task_t task = NULL;
+  char **cur = (char**)xbt_dynar_iterator_next(bc->it);
+  const char *me = "host0"; /* FIXME: hardcoded*/ /*MSG_host_get_name(MSG_host_self());*/
+  const char *current_host = NULL;
+  const char *prev = NULL;
+  const char *next = NULL;
+  const char *last = NULL;
+
+  /* Build the chain if there's at least one peer */
+  if (cur != NULL) {
+    /* init: prev=NULL, host=current cur, next=next cur */
+    next = *cur;
+    bc->first = next;
+
+    /* This iterator iterates one step ahead: cur is current iterated element, 
+       but it's actually the next one in the chain */
+    do {
+      /* following steps: prev=last, host=next, next=cur */
+      cur = (char**)xbt_dynar_iterator_next(bc->it);
+      prev = last;
+      current_host = next;
+      if (cur != NULL)
+        next = *cur;
+      else
+        next = NULL;
+      XBT_DEBUG("Building chain -- broadcaster:\"%s\" dest:\"%s\" prev:\"%s\" next:\"%s\"", me, current_host, prev, next);
+    
+      /* Send message to current peer */
+      task = task_message_chain_new(me, current_host, prev, next);
+      //MSG_task_set_category(task, current_host);
+      MSG_task_send(task, current_host);
+
+      last = current_host;
+    } while (cur != NULL);
+  }
+
+  return MSG_OK;
+}
+
+int broadcaster_send_file(broadcaster_t bc)
+{
+  const char *me = "host0"; /* FIXME: hardcoded*/ /*MSG_host_get_name(MSG_host_self());*/
+  msg_comm_t comm = NULL;
+  msg_task_t task = NULL;
+
+  bc->current_piece = 0;
+
+  while (bc->current_piece < bc->piece_count) {
+    if (xbt_dynar_length(bc->pending_sends) < bc->max_pending_sends) {
+      task = task_message_data_new(me, bc->first, NULL, PIECE_SIZE);
+      XBT_DEBUG("Sending (isend) piece %d from %s into mailbox %s (current pending %lu)", bc->current_piece, me, bc->first, xbt_dynar_length(bc->pending_sends));
+      comm = MSG_task_isend(task, bc->first);
+      queue_pending_connection(comm, bc->pending_sends);
+      bc->current_piece++;
+    } else {
+      MSG_process_sleep(0.01);
+    }
+    process_pending_connections(bc->pending_sends);
+  }
+
+  return MSG_OK;
+}
+
+int broadcaster_finish(broadcaster_t bc)
+{
+  msg_task_t task = NULL;
+  const char *me = "host0"; /* FIXME: hardcoded*/ /*MSG_host_get_name(MSG_host_self());*/
+  const char *current_host = NULL;
+  char **cur = NULL;
+
+  xbt_dynar_iterator_seek(bc->it, 0);
+
+  /* Send goodbye message to every peer in the order generated by iterator it */
+  for (cur = (char**)xbt_dynar_iterator_next(bc->it); cur != NULL; cur = (char**)xbt_dynar_iterator_next(bc->it)) {
+    /* Send message to current peer */
+    current_host = *cur;
+    task = task_message_end_data_new(me, current_host);
+    //MSG_task_set_category(task, current_host);
+    MSG_task_send(task, current_host);
+  }
+
+  return MSG_OK;
+}
+
+broadcaster_t broadcaster_init(xbt_dynar_t host_list)
+{
+  int status;
+  broadcaster_t bc = xbt_new(s_broadcaster_t, 1);
+
+  bc->piece_count = PIECE_COUNT;
+  bc->current_piece = 0;
+  bc->host_list = host_list;
+  bc->it = xbt_dynar_iterator_new(bc->host_list, forward_indices_list);
+  bc->max_pending_sends = MAX_PENDING_SENDS;
+  bc->pending_sends = xbt_dynar_new(sizeof(msg_comm_t), NULL);
+
+  status = broadcaster_build_chain(bc);
+  xbt_assert(status == MSG_OK, "Chain initialization failed");
+
+  return bc;
+}
+
+static void broadcaster_destroy(broadcaster_t bc)
+{
+  /* Destroy iterator and hostlist */
+  xbt_dynar_iterator_delete(bc->it);
+  xbt_dynar_free(&bc->pending_sends);
+  xbt_dynar_free(&bc->host_list);
+}
+
+/** Emitter function  */
+int broadcaster(int argc, char *argv[])
+{
+  broadcaster_t bc = NULL;
+  xbt_dynar_t host_list = NULL;
+  int status;
+
+  XBT_INFO("broadcaster");
+
+  /* Add every mailbox given by the hostcount in argv[1] to a dynamic array */
+  host_list = build_hostlist_from_hostcount(atoi(argv[1]));
+  
+  bc = broadcaster_init(host_list);
+
+  /* TODO: Error checking */
+  status = broadcaster_send_file(bc);
+  status = broadcaster_finish(bc);
+
+  broadcaster_destroy(bc);
+
+  return status;
+}
diff --git a/examples/msg/chainsend/broadcaster.h b/examples/msg/chainsend/broadcaster.h
new file mode 100644 (file)
index 0000000..e0c026c
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef KADEPLOY_BROADCASTER_H
+#define KADEPLOY_BROADCASTER_H
+
+#include "msg/msg.h"
+#include "xbt/sysdep.h"
+
+/* Create a log channel to have nice outputs. */
+#include "xbt/log.h"
+#include "xbt/asserts.h"
+
+#include "messages.h"
+#include "iterator.h"
+#include "common.h"
+
+/* Connection parameters */
+#define MAX_PENDING_SENDS 10
+
+/* ``File'' details */
+#define PIECE_SIZE 16384
+#define PIECE_COUNT 50
+
+/* Broadcaster struct */
+typedef struct s_broadcaster {
+  const char *first;
+  int piece_count;
+  int current_piece;
+  xbt_dynar_t host_list;
+  xbt_dynar_iterator_t it;
+  int max_pending_sends;
+  xbt_dynar_t pending_sends;
+} s_broadcaster_t, *broadcaster_t;
+
+xbt_dynar_t build_hostlist_from_hostcount(int hostcount); 
+
+/* Broadcaster: helper functions */
+broadcaster_t broadcaster_init(xbt_dynar_t host_list);
+int broadcaster_build_chain(broadcaster_t bc);
+int broadcaster_send_file(broadcaster_t bc);
+int broadcaster_finish(broadcaster_t bc);
+static void broadcaster_destroy(broadcaster_t bc);
+
+/* Tasks */
+int broadcaster(int argc, char *argv[]);
+
+#endif /* KADEPLOY_BROADCASTER_H */
diff --git a/examples/msg/chainsend/chainsend.c b/examples/msg/chainsend/chainsend.c
new file mode 100644 (file)
index 0000000..80ea6fe
--- /dev/null
@@ -0,0 +1,120 @@
+/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+ * Copyright (c) 2012. Maximiliano Geier.
+ * 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 "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc */
+
+/* Create a log channel to have nice outputs. */
+#include "xbt/log.h"
+#include "xbt/asserts.h"
+
+#include "iterator.h"
+#include "messages.h"
+#include "broadcaster.h"
+#include "peer.h"
+
+/** @addtogroup MSG_examples
+ * 
+ *  - <b>chainsend/chainsend.c: Chainsend implementation</b>.
+ */
+
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chainsend,
+                             "Messages specific for chainsend");
+
+/*
+ Data structures
+ */
+
+/* Initialization stuff */
+msg_error_t test_all(const char *platform_file,
+                     const char *application_file);
+
+
+/** Test function */
+msg_error_t test_all(const char *platform_file,
+                     const char *application_file)
+{
+
+  msg_error_t res = MSG_OK;
+
+
+
+  XBT_INFO("test_all");
+
+  /*  Simulation setting */
+  MSG_create_environment(platform_file);
+
+  /* Trace categories */
+  TRACE_category_with_color("host0", "0 0 1");
+  TRACE_category_with_color("host1", "0 1 0");
+  TRACE_category_with_color("host2", "0 1 1");
+  TRACE_category_with_color("host3", "1 0 0");
+  TRACE_category_with_color("host4", "1 0 1");
+  TRACE_category_with_color("host5", "0 0 0");
+  TRACE_category_with_color("host6", "1 1 0");
+  TRACE_category_with_color("host7", "1 1 1");
+  TRACE_category_with_color("host8", "0 1 0");
+
+  /*   Application deployment */
+  MSG_function_register("broadcaster", broadcaster);
+  MSG_function_register("peer", peer);
+
+  MSG_launch_application(application_file);
+
+  res = MSG_main();
+
+  return res;
+}                               /* end_of_test_all */
+
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+  msg_error_t res = MSG_OK;
+
+#ifdef _MSC_VER
+  unsigned int prev_exponent_format =
+      _set_output_format(_TWO_DIGIT_EXPONENT);
+#endif
+
+  MSG_init(&argc, argv);
+
+  /*if (argc <= 3) {
+    XBT_CRITICAL("Usage: %s platform_file deployment_file <model>\n",
+              argv[0]);
+    XBT_CRITICAL
+        ("example: %s msg_platform.xml msg_deployment.xml KCCFLN05_Vegas\n",
+         argv[0]);
+    exit(1);
+  }*/
+
+  /* Options for the workstation/model:
+
+     KCCFLN05              => for maxmin
+     KCCFLN05_proportional => for proportional (Vegas)
+     KCCFLN05_Vegas        => for TCP Vegas
+     KCCFLN05_Reno         => for TCP Reno
+   */
+  //MSG_config("workstation/model", argv[3]);
+
+  res = test_all(argv[1], argv[2]);
+
+  XBT_INFO("Total simulation time: %le", MSG_get_clock());
+
+#ifdef _MSC_VER
+  _set_output_format(prev_exponent_format);
+#endif
+
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
diff --git a/examples/msg/chainsend/chainsend.tesh b/examples/msg/chainsend/chainsend.tesh
new file mode 100644 (file)
index 0000000..a78a40a
--- /dev/null
@@ -0,0 +1,26 @@
+#! ./tesh
+
+p Testing the chainsend MSG implementation
+
+! timeout 10
+! output sort
+$ $SG_TEST_EXENV ${bindir:=.}/chainsend ${srcdir:=.}/platform_chainsend.xml ${srcdir:=.}/deployment_chainsend.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
+> [    0.000000] (0:@) test_all
+> [    0.000000] (1:broadcaster@host0) broadcaster
+> [    0.000000] (2:peer@host1) peer
+> [    0.000000] (3:peer@host2) peer
+> [    0.000000] (4:peer@host3) peer
+> [    0.000000] (5:peer@host4) peer
+> [    0.000000] (6:peer@host5) peer
+> [    0.000000] (7:peer@host6) peer
+> [    0.000000] (8:peer@host7) peer
+> [    0.000000] (9:peer@host8) peer
+> [   88.950000] (2:peer@host1) Waiting for sends to finish before shutdown...
+> [  221.070000] (3:peer@host2) Waiting for sends to finish before shutdown...
+> [  289.980000] (4:peer@host3) Waiting for sends to finish before shutdown...
+> [  293.890000] (5:peer@host4) Waiting for sends to finish before shutdown...
+> [  304.300000] (6:peer@host5) Waiting for sends to finish before shutdown...
+> [  310.940000] (7:peer@host6) Waiting for sends to finish before shutdown...
+> [  314.850000] (8:peer@host7) Waiting for sends to finish before shutdown...
+> [  314.930000] (9:peer@host8) Waiting for sends to finish before shutdown...
+> [  316.850000] (0:@) Total simulation time: 3.168500e+02
diff --git a/examples/msg/chainsend/common.c b/examples/msg/chainsend/common.c
new file mode 100644 (file)
index 0000000..37f2b74
--- /dev/null
@@ -0,0 +1,21 @@
+#include "common.h"
+
+int process_pending_connections(xbt_dynar_t q)
+{
+  unsigned int iter;
+  int status;
+  int empty = 0;
+  msg_comm_t comm;
+
+  xbt_dynar_foreach(q, iter, comm) {
+    empty = 1;
+    if (MSG_comm_test(comm)) {
+      MSG_comm_destroy(comm);
+      status = MSG_comm_get_status(comm);
+      xbt_assert(status == MSG_OK, "process_pending_connections() failed");
+      xbt_dynar_cursor_rm(q, &iter);
+      empty = 0;
+    }
+  }
+  return empty;
+}
diff --git a/examples/msg/chainsend/common.h b/examples/msg/chainsend/common.h
new file mode 100644 (file)
index 0000000..eaf2de1
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef KADEPLOY_COMMON_H
+#define KADEPLOY_COMMON_H
+
+#include "msg/msg.h"
+#include "xbt/sysdep.h"
+
+static XBT_INLINE void queue_pending_connection(msg_comm_t comm, xbt_dynar_t q)
+{
+  xbt_dynar_push(q, &comm);
+}
+
+int process_pending_connections(xbt_dynar_t q);
+
+#define MESSAGE_SIZE 1
+#define HOSTNAME_LENGTH 20
+
+#endif /* KADEPLOY_COMMON_H */
diff --git a/examples/msg/chainsend/deployment_chainsend.xml b/examples/msg/chainsend/deployment_chainsend.xml
new file mode 100644 (file)
index 0000000..e190c88
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3"><!-- For using with chainsend, platform_chainsend.xml -->
+
+  <!-- Broadcaster -->
+  <process host="host0" function="broadcaster">
+       <argument value="8"/> <!-- number of peers -->
+  </process>
+
+  <!-- Peers -->
+  <process host="host1" function="peer">
+       <argument value="1"/>
+  </process>
+  <process host="host2" function="peer">
+       <argument value="2"/>
+  </process>
+  <process host="host3" function="peer">
+       <argument value="3"/>
+  </process>
+  <process host="host4" function="peer">
+       <argument value="4"/>
+  </process>
+  <process host="host5" function="peer">
+       <argument value="5"/>
+  </process>
+  <process host="host6" function="peer">
+       <argument value="6"/>
+  </process>
+  <process host="host7" function="peer">
+       <argument value="7"/>
+  </process>
+  <process host="host8" function="peer">
+       <argument value="8"/>
+  </process>
+  <!--<process host="host9" function="peer">
+       <argument value="9"/>
+  </process>-->
+</platform>
diff --git a/examples/msg/chainsend/generate_deployment_file.rb b/examples/msg/chainsend/generate_deployment_file.rb
new file mode 100755 (executable)
index 0000000..fae59a8
--- /dev/null
@@ -0,0 +1,97 @@
+#!/usr/bin/env ruby
+
+require 'rexml/document'
+
+class HostsExtractor
+  @@doc = nil
+  @@hosts = []
+
+  def initialize(xml)
+    @@doc = REXML::Document.new(xml)
+    @@doc.elements.each('platform') do |platform|
+      extract_hosts(platform)
+    end
+  end
+
+  def extract_hosts(doc)
+    doc.elements.each('AS') do |as|
+      extract_hosts_from_AS(as)
+      extract_hosts(as)
+    end
+  end
+
+  def extract_hosts_from_AS(doc)
+    doc.elements.each('host') do |h|
+      @@hosts << h.attributes['id']
+      puts "hosts %s" % h.attributes['id']
+    end
+
+    doc.elements.each('cluster') do |c|
+      prefix = c.attributes['prefix']
+      suffix = c.attributes['suffix']
+      puts "%s %s %s" % [prefix, c.attributes['radical'], suffix]
+      expand_radical(c.attributes['radical']).each do |num|
+        @@hosts << "%s%s%s" % [prefix, num, suffix]
+      end
+    end
+  end
+
+  def hosts
+    return @@hosts
+  end
+
+  def expand_radical(radical)
+   l = []
+   puts radical
+   radical.split(',').each do |range|
+     range.scan(/^\d+$/) { |x| l << x }
+     range.scan(/^(\d+)-(\d+)$/) { |x, y| (x..y).each do |i| l << i end }
+   end
+   return l
+  end
+end
+
+class DeploymentGenerator
+  @@outfile = nil
+
+  def initialize(fname)
+    @@outfile = File.new(fname, "w")
+  end
+
+  def write_header
+    @@outfile.puts "<?xml version='1.0'?>"
+    @@outfile.puts "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">"
+    @@outfile.puts "<platform version=\"3\">"
+  end
+
+  def write_process(name, function, hosts, args)
+    @@outfile.puts "  <!-- %s -->" % name
+    hosts.zip(args).each do |h, a|
+      @@outfile.puts "  <process host=\"%s\" function=\"%s\">" % [h, function]
+      @@outfile.puts "    <argument value=\"%s\"/>" % [a]
+      @@outfile.puts "  </process>"
+    end
+  end
+
+  def write_footer
+    @@outfile.puts "</platform>"
+  end
+end
+
+xml = File.read(ARGV.shift)
+he = HostsExtractor.new(xml)
+
+raise "Cannot run with less than 2 hosts" unless he.hosts.size > 1
+
+output = ARGV.shift
+dg = DeploymentGenerator.new(output)
+dg.write_header
+
+puts he.hosts
+broadcaster = he.hosts.shift
+peers = he.hosts
+
+dg.write_process("Broadcaster", "broadcaster", [broadcaster], [he.hosts.size])
+dg.write_process("Peers", "peer", peers, (1..he.hosts.size))
+
+dg.write_footer
diff --git a/examples/msg/chainsend/iterator.c b/examples/msg/chainsend/iterator.c
new file mode 100644 (file)
index 0000000..47dfe04
--- /dev/null
@@ -0,0 +1,96 @@
+#include "iterator.h"
+
+/* http://stackoverflow.com/a/3348142 */
+static int rand_int(int n)
+{
+  int limit = RAND_MAX - RAND_MAX % n;
+  int rnd;
+
+  do {
+    rnd = rand();
+  } while (rnd >= limit);
+  
+  return rnd % n;
+}
+
+void xbt_dynar_shuffle_in_place(xbt_dynar_t indices_list)
+{
+  int i, j;
+
+  for (i = xbt_dynar_length(indices_list) - 1; i > 0; i--) {
+    j = rand_int(i + 1);
+    xbt_dynar_swap_elements(indices_list, int, i, j);
+  }
+}
+/**************************************/
+
+/* Allocates and initializes a new xbt_dynar iterator for list, using criteria_fn as iteration criteria
+   criteria_fn: given an array size, it must generate a list containing the indices of every item in some order */
+xbt_dynar_iterator_t xbt_dynar_iterator_new(xbt_dynar_t list, xbt_dynar_t (*criteria_fn)(int))
+{
+  xbt_dynar_iterator_t it = xbt_new(xbt_dynar_iterator_s, 1);
+  
+  it->list = list;
+  it->length = xbt_dynar_length(list);
+  it->indices_list = criteria_fn(it->length); //xbt_dynar_new(sizeof(int), NULL);
+  it->criteria_fn = criteria_fn;
+  it->current = 0;
+
+  return it;
+}
+
+void xbt_dynar_iterator_reset(xbt_dynar_iterator_t it)
+{
+  xbt_dynar_free_container(&(it->indices_list));
+  it->indices_list = it->criteria_fn(it->length);
+  it->current = 0;
+}
+
+void xbt_dynar_iterator_seek(xbt_dynar_iterator_t it, int pos)
+{
+  it->current = pos;
+}
+
+/* Returns the next element iterated by iterator it, NULL if there are no more elements */
+void *xbt_dynar_iterator_next(xbt_dynar_iterator_t it)
+{
+  int *next;
+  if (it->current >= it->length) {
+    return NULL;
+  } else {
+    next = xbt_dynar_get_ptr(it->indices_list, it->current);
+    it->current++;
+    return xbt_dynar_get_ptr(it->list, *next);
+  }
+}
+
+void xbt_dynar_iterator_delete(xbt_dynar_iterator_t it)
+{
+  xbt_dynar_free_container(&(it->indices_list));
+  xbt_free_ref(&it);
+}
+
+xbt_dynar_t forward_indices_list(int size)
+{
+  xbt_dynar_t indices_list = xbt_dynar_new(sizeof(int), NULL);
+  int i;
+  for (i = 0; i < size; i++)
+    xbt_dynar_push_as(indices_list, int, i);
+  return indices_list;
+}
+
+xbt_dynar_t reverse_indices_list(int size)
+{
+  xbt_dynar_t indices_list = xbt_dynar_new(sizeof(int), NULL);
+  int i;
+  for (i = size-1; i >= 0; i--)
+    xbt_dynar_push_as(indices_list, int, i);
+  return indices_list;
+}
+
+xbt_dynar_t random_indices_list(int size)
+{
+  xbt_dynar_t indices_list = forward_indices_list(size);
+  xbt_dynar_shuffle_in_place(indices_list);
+  return indices_list;
+}
diff --git a/examples/msg/chainsend/iterator.h b/examples/msg/chainsend/iterator.h
new file mode 100644 (file)
index 0000000..3267913
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef KADEPLOY_ITERATOR_H
+#define KADEPLOY_ITERATOR_H
+
+#include <stdlib.h>
+
+#include "xbt/dynar.h"
+#include "xbt/sysdep.h"
+
+/* Random iterator for xbt_dynar */
+typedef struct xbt_dynar_iterator_struct {
+  xbt_dynar_t list;
+  xbt_dynar_t indices_list;
+  int current;
+  unsigned long length;
+  xbt_dynar_t (*criteria_fn)(int size);
+} *xbt_dynar_iterator_t;
+typedef struct xbt_dynar_iterator_struct xbt_dynar_iterator_s;
+
+/* Iterator methods */
+xbt_dynar_iterator_t xbt_dynar_iterator_new(xbt_dynar_t list, xbt_dynar_t (*criteria_fn)(int));
+void xbt_dynar_iterator_reset(xbt_dynar_iterator_t it);
+void xbt_dynar_iterator_seek(xbt_dynar_iterator_t it, int pos);
+void *xbt_dynar_iterator_next(xbt_dynar_iterator_t it);
+void xbt_dynar_iterator_delete(xbt_dynar_iterator_t it);
+
+/* Iterator generators */
+xbt_dynar_t forward_indices_list(int size);
+xbt_dynar_t reverse_indices_list(int size);
+xbt_dynar_t random_indices_list(int size);
+
+/* Shuffle */
+/**************************************/
+static int rand_int(int n);
+void xbt_dynar_shuffle_in_place(xbt_dynar_t indices_list);
+
+#define xbt_dynar_swap_elements(d, type, i, j) \
+  type tmp; \
+  tmp = xbt_dynar_get_as(indices_list, (unsigned int)j, type); \
+  xbt_dynar_set_as(indices_list, (unsigned int)j, type, \
+    xbt_dynar_get_as(indices_list, (unsigned int)i, type)); \
+  xbt_dynar_set_as(indices_list, (unsigned int)i, type, tmp);
+
+#endif /* KADEPLOY_ITERATOR_H */
diff --git a/examples/msg/chainsend/messages.c b/examples/msg/chainsend/messages.c
new file mode 100644 (file)
index 0000000..0bc23cd
--- /dev/null
@@ -0,0 +1,46 @@
+#include "messages.h"
+
+msg_task_t task_message_new(e_message_type type, unsigned int len, const char *issuer_hostname, const char *mailbox)
+{
+  message_t msg = xbt_new(s_message_t, 1);
+  msg->type = type;
+  msg->issuer_hostname = issuer_hostname;
+  msg->mailbox = mailbox;
+  msg_task_t task = MSG_task_create(NULL, 0, len, msg);
+
+  return task;
+}
+
+msg_task_t task_message_chain_new(const char *issuer_hostname, const char *mailbox, const char* prev, const char *next)
+{
+  msg_task_t task = task_message_new(MESSAGE_BUILD_CHAIN, MESSAGE_BUILD_CHAIN_SIZE, issuer_hostname, mailbox);
+  message_t msg = MSG_task_get_data(task);
+  msg->prev_hostname = prev;
+  msg->next_hostname = next;
+
+  return task;
+}
+
+msg_task_t task_message_data_new(const char *issuer_hostname, const char *mailbox, const char *block, unsigned int len)
+{
+  msg_task_t task = task_message_new(MESSAGE_SEND_DATA, MESSAGE_SEND_DATA_HEADER_SIZE + len, issuer_hostname, mailbox);
+  //if (strcmp(mailbox, "host4") == 0) 
+  //MSG_task_set_category(task, mailbox);
+  message_t msg = MSG_task_get_data(task);
+  msg->data_block = block;
+  msg->data_length = len;
+
+  return task;
+}
+
+msg_task_t task_message_end_data_new(const char *issuer_hostname, const char *mailbox)
+{
+  return task_message_new(MESSAGE_END_DATA, MESSAGE_END_DATA_SIZE, issuer_hostname, mailbox);
+}
+
+void task_message_delete(void *task)
+{
+  message_t msg = MSG_task_get_data(task);
+  xbt_free(msg);
+  MSG_task_destroy(task);
+}
diff --git a/examples/msg/chainsend/messages.h b/examples/msg/chainsend/messages.h
new file mode 100644 (file)
index 0000000..4421305
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef KADEPLOY_MESSAGES_H
+#define KADEPLOY_MESSAGES_H
+
+#include "msg/msg.h"
+#include "xbt/sysdep.h"
+
+#define MESSAGE_BUILD_CHAIN_SIZE 40
+#define MESSAGE_SEND_DATA_HEADER_SIZE 10
+#define MESSAGE_END_DATA_SIZE 20
+
+/* Messages enum */
+typedef enum {
+  MESSAGE_BUILD_CHAIN = 0,
+  MESSAGE_SEND_DATA,
+  MESSAGE_END_DATA
+} e_message_type;
+
+/* Message struct */
+typedef struct s_message {
+  e_message_type type;
+  const char *issuer_hostname;
+  const char *mailbox;
+  const char *prev_hostname;
+  const char *next_hostname;
+  const char *data_block;
+  unsigned int data_length;
+} s_message_t, *message_t;
+
+/* Message methods */
+msg_task_t task_message_new(e_message_type type, unsigned int len, const char *issuer_hostname, const char *mailbox);
+msg_task_t task_message_chain_new(const char *issuer_hostname, const char *mailbox, const char* prev, const char *next);
+msg_task_t task_message_data_new(const char *issuer_hostname, const char *mailbox, const char *block, unsigned int len);
+msg_task_t task_message_end_data_new(const char *issuer_hostname, const char *mailbox);
+void task_message_delete(void *);
+
+#endif /* KADEPLOY_MESSAGES_H */
diff --git a/examples/msg/chainsend/peer.c b/examples/msg/chainsend/peer.c
new file mode 100644 (file)
index 0000000..5605c88
--- /dev/null
@@ -0,0 +1,133 @@
+#include "peer.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_peer,
+                             "Messages specific for the peer");
+
+/*******************************************************
+ *                     Peer                            *
+ *******************************************************/
+
+void peer_init_chain(peer_t peer, message_t msg)
+{
+  peer->prev = msg->prev_hostname;
+  peer->next = msg->next_hostname;
+  peer->init = 1;
+}
+
+static void peer_forward_msg(peer_t peer, message_t msg)
+{
+  msg_task_t task = task_message_data_new(peer->me, peer->next, NULL, 0);
+  msg_comm_t comm = NULL;
+  XBT_DEBUG("Sending (isend) from %s into mailbox %s", peer->me, peer->next);
+  comm = MSG_task_isend(task, peer->next);
+  queue_pending_connection(comm, peer->pending_sends);
+}
+
+int peer_execute_task(peer_t peer, msg_task_t task)
+{
+  int done = 0;
+  message_t msg = MSG_task_get_data(task);
+  
+  XBT_DEBUG("Peer %s got message of type %d\n", peer->me, msg->type);
+  switch (msg->type) {
+    case MESSAGE_BUILD_CHAIN:
+      peer_init_chain(peer, msg);
+      break;
+    case MESSAGE_SEND_DATA:
+      xbt_assert(peer->init, "peer_execute_task() failed: got msg_type %d before initialization", msg->type);
+      if (peer->next != NULL)
+        peer_forward_msg(peer, msg);
+      peer->pieces++;
+      break;
+    case MESSAGE_END_DATA:
+      xbt_assert(peer->init, "peer_execute_task() failed: got msg_type %d before initialization", msg->type);
+      done = 1;
+      XBT_DEBUG("%d pieces receieved", peer->pieces);
+      break;
+  }
+
+  MSG_task_execute(task);
+
+  return done;
+}
+
+msg_error_t peer_wait_for_message(peer_t peer)
+{
+  msg_error_t status;
+  msg_comm_t comm = NULL;
+  msg_task_t task = NULL;
+  int done = 0;
+
+  while (!done) {
+    if (comm == NULL) // FIXME I should have a recv queue
+      comm = MSG_task_irecv(&task, peer->me);
+
+    if (MSG_comm_test(comm)) {
+      status = MSG_comm_get_status(comm);
+      XBT_DEBUG("peer_wait_for_message: error code = %d", status);
+      xbt_assert(status == MSG_OK, "peer_wait_for_message() failed");
+      MSG_comm_destroy(comm);
+      comm = NULL;
+      done = peer_execute_task(peer, task);
+      task_message_delete(task);
+      task = NULL;
+    } else {
+      process_pending_connections(peer->pending_sends);
+      MSG_process_sleep(0.01);
+    }
+  }
+
+  return status;
+}
+
+void peer_init(peer_t p, int argc, char *argv[])
+{
+  p->init = 0;
+  p->prev = NULL;
+  p->next = NULL;
+  p->pieces = 0;
+  p->close_asap = 0;
+  p->pending_sends = xbt_dynar_new(sizeof(msg_comm_t), NULL);
+  p->me = xbt_new(char, HOSTNAME_LENGTH);
+  /* Set mailbox name: use host number from argv or hostname if no argument given */
+  if (argc > 1) {
+    snprintf(p->me, HOSTNAME_LENGTH, "host%s", argv[1]);
+  } else {
+    strncpy(p->me, MSG_host_get_name(MSG_host_self()), HOSTNAME_LENGTH);
+  }
+}
+
+void peer_shutdown(peer_t p)
+{
+  float start_time = MSG_get_clock();
+  float end_time = start_time + PEER_SHUTDOWN_DEADLINE;
+
+  XBT_INFO("Waiting for sends to finish before shutdown...");
+  while (xbt_dynar_length(p->pending_sends) && MSG_get_clock() < end_time) {
+    process_pending_connections(p->pending_sends);
+    MSG_process_sleep(1);
+  }
+
+  xbt_assert(xbt_dynar_length(p->pending_sends) == 0, "Shutdown failed, sends still pending after deadline");
+  xbt_dynar_free(&p->pending_sends);
+  xbt_free(p->me);
+
+  xbt_free(p);
+}
+
+/** Peer function  */
+int peer(int argc, char *argv[])
+{
+  peer_t p = xbt_new(s_peer_t, 1);
+  msg_error_t status;
+
+  XBT_INFO("peer");
+
+  peer_init(p, argc, argv);
+  status = peer_wait_for_message(p);
+  peer_shutdown(p);
+
+  return status;
+}                               /* end_of_receiver */
+
+
diff --git a/examples/msg/chainsend/peer.h b/examples/msg/chainsend/peer.h
new file mode 100644 (file)
index 0000000..a5d99d3
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef KADEPLOY_PEER_H
+#define KADEPLOY_PEER_H
+
+#include "msg/msg.h"
+#include "xbt/sysdep.h"
+
+#include "messages.h"
+#include "common.h"
+
+#define PEER_SHUTDOWN_DEADLINE 60000
+
+/* Peer struct */
+typedef struct s_peer {
+  int init;
+  const char *prev;
+  const char *next;
+  char *me;
+  int pieces;
+  xbt_dynar_t pending_sends;
+  int close_asap; /* TODO: unused */
+} s_peer_t, *peer_t;
+
+/* Peer: helper functions */
+msg_error_t peer_wait_for_message(peer_t peer);
+int peer_execute_task(peer_t peer, msg_task_t task);
+void peer_init_chain(peer_t peer, message_t msg);
+void peer_shutdown(peer_t p);
+void peer_init(peer_t p, int argc, char *argv[]);
+
+int peer(int argc, char *argv[]);
+
+#endif /* KADEPLOY_PEER_H */
diff --git a/examples/msg/chainsend/platform_chainsend.xml b/examples/msg/chainsend/platform_chainsend.xml
new file mode 100644 (file)
index 0000000..f5c9105
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version='1.0'?>
+ <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+ <platform version="3">
+ <AS  id="AS0"  routing="Floyd">
+   <!-- For using with chainsend, very simple 8-node platform -->
+   <host id="host0" power="98095000"/>
+   <host id="host1" power="76296000"/>
+   <host id="host2" power="96296000"/>
+   <host id="host3" power="97296000"/>
+   <host id="host4" power="97296000"/>
+   <host id="host5" power="97296000"/>
+   <host id="host6" power="97296000"/>
+   <host id="host7" power="97296000"/>
+   <host id="host8" power="97296000"/>
+   <link id="link1" bandwidth="1000000" latency="0.1"/>
+   <link id="link2" bandwidth="1000000" latency="0.2"/>
+   <link id="link3" bandwidth="1000000" latency="0.2"/>
+   <link id="link4" bandwidth="1000000" latency="0.15"/>
+   <link id="link5" bandwidth="1000000" latency="0.4"/>
+   <link id="link6" bandwidth="1000000" latency="0.01"/>
+   <link id="link7" bandwidth="1000000" latency="0.15"/>
+   <link id="link8" bandwidth="1000000" latency="0.003"/>
+   <route src="host0" dst="host1">
+     <link_ctn id="link1"/>
+   </route>
+   <route src="host0" dst="host2">
+     <link_ctn id="link2"/>
+   </route>
+   <route src="host0" dst="host3">
+     <link_ctn id="link3"/>
+   </route>
+   <route src="host0" dst="host4">
+     <link_ctn id="link4"/>
+   </route>
+   <route src="host4" dst="host5">
+     <link_ctn id="link5"/>
+   </route>
+   <route src="host4" dst="host6">
+     <link_ctn id="link6"/>
+   </route>
+   <route src="host4" dst="host7">
+     <link_ctn id="link7"/>
+   </route>
+   <route src="host0" dst="host8">
+     <link_ctn id="link8"/>
+   </route>
+ </AS>
+ </platform>
index 42f661e..58addb1 100644 (file)
@@ -50,6 +50,7 @@ int main(int argc, char **argv)
   /* load the DOT file */
   dot = SD_dotload(argv[2]);
   if(dot == NULL){
+    SD_exit();
     xbt_die("No dot load may be you have a cycle in your graph");
   }
 
index f87bd7f..ff0dd78 100644 (file)
@@ -50,8 +50,8 @@ int main(int argc, char **argv)
   /* load the DOT file  and schedule tasks */
   dot = SD_dotload_with_sched(argv[2]);
   if(!dot){
+    SD_exit();
     xbt_die("The dot file with the provided scheduling is wrong, more information with the option : --log=sd_dotparse.thres:verbose");
-    //return 0;
   }
 
   /* Display all the tasks */
index 5ee22c0..f392b82 100644 (file)
@@ -2,7 +2,6 @@
 1 init
 2 init
 
-0 comm_size 3
 0 bcast 5e8
 1 bcast 5e8
 2 bcast 5e8
diff --git a/examples/smpi/replay/actions_with_isend.txt b/examples/smpi/replay/actions_with_isend.txt
new file mode 100644 (file)
index 0000000..edc93a6
--- /dev/null
@@ -0,0 +1,23 @@
+0 init
+1 init
+2 init
+
+0 send 1 1e9
+0 compute 1e9
+0 recv 2 1e9
+
+1 Irecv 0 1e9
+1 compute 1e9
+1 wait
+1 send 2 1e9
+
+2 Irecv 1 1e9
+2 compute 5e8
+2 wait
+2 Isend 0 1e9
+2 compute 5e8
+
+0 finalize
+1 finalize
+2 finalize
+
index c46e677..088369c 100644 (file)
@@ -1 +1 @@
-replay/actions_bcast.txt
+replay/actions_with_isend.txt
index 11bdb09..8a57397 100644 (file)
@@ -1,14 +1,18 @@
 # use the tested library, not the installed one
 # (since we want to pass it to the child, it has to be redefined before each command)
 # Go for the first test
+
 p Test of trace replay with SMPI (one trace for all processes)
+
+< replay/actions_bcast.txt
+$ mkfile replay/one_trace
+
 $ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/cpu_threshold:1 -np 3 -platform ${srcdir:=.}/replay/replay_platform.xml -hostfile ${srcdir:=.}/hostfile ./smpi_replay ${srcdir:=.}/replay/one_trace
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/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'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '1'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
-> [Tremblay:0:(0) 0.000000] [smpi_replay/VERBOSE] 0 comm_size 3 0.000000
 > [Fafard:2:(0) 65.176535] [smpi_replay/VERBOSE] 2 bcast 5e8 65.176535
 > [Fafard:2:(0) 71.729958] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
 > [Jupiter:1:(0) 73.739750] [smpi_replay/VERBOSE] 1 bcast 5e8 73.739750
@@ -26,8 +30,13 @@ $ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_rep
 > [Tremblay:0:(0) 231.413449] [smpi_replay/VERBOSE] 0 reduce 5e8 5e8 73.739750
 > [Tremblay:0:(0) 231.413449] [smpi_replay/INFO] Simulation time 231.413
 
+$ rm -f replay/one_trace
 
 p The same with tracing activated
+
+< replay/actions_bcast.txt
+$ mkfile replay/one_trace
+
 $ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=no_loc  --cfg=tracing:1 --cfg=tracing/smpi:1 --cfg=tracing/smpi/computing:1 --cfg=smpi/cpu_threshold:1 -np 3 -platform ${srcdir:=.}/replay/replay_platform.xml -hostfile ${srcdir:=.}/hostfile ./smpi_replay ${srcdir:=.}/replay/one_trace
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
@@ -39,6 +48,8 @@ $ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=no_loc
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
 > [Tremblay:0:(0) 231.413449] [smpi_replay/INFO] Simulation time 231.413
 
+$ rm -f replay/one_trace
+
 
 $ tail -n +3 ./simgrid.trace
 > %EventDef PajeDefineContainerType 0
@@ -222,3 +233,52 @@ $ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_rep
 > [Jupiter:1:(0) 13.600235] [smpi_replay/VERBOSE] 1 wait 0.328926
 > [Tremblay:0:(0) 13.600235] [smpi_replay/VERBOSE] 0 send 1 1e6 0.164463
 > [Tremblay:0:(0) 13.600235] [smpi_replay/INFO] Simulation time 13.6002
+
+
+p Test of barrier replay with SMPI (one trace for all processes)
+
+< replay/actions_barrier.txt
+$ mkfile replay/one_trace
+
+$ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/cpu_threshold:1 -np 3 -platform ${srcdir:=.}/replay/replay_platform.xml -hostfile ${srcdir:=.}/hostfile ./smpi_replay ${srcdir:=.}/replay/one_trace
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/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'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '1'
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> [Tremblay:0:(0) 1.491472] [smpi_replay/VERBOSE] 0 send 1 1e7 1.491472
+> [Jupiter:1:(0) 1.491472] [smpi_replay/VERBOSE] 1 recv 0 1e7 1.491472
+> [Tremblay:0:(0) 1.495453] [smpi_replay/VERBOSE] 0 barrier 0.003981
+> [Jupiter:1:(0) 1.498398] [smpi_replay/VERBOSE] 1 barrier 0.006926
+> [Fafard:2:(0) 1.499434] [smpi_replay/VERBOSE] 2 barrier 1.499434
+> [Tremblay:0:(0) 2.495453] [smpi_replay/VERBOSE] 0 compute 98095000 1.000000
+> [Jupiter:1:(0) 2.498398] [smpi_replay/VERBOSE] 1 compute 76296000 1.000000
+> [Fafard:2:(0) 2.499434] [smpi_replay/VERBOSE] 2 compute 76296000 1.000000
+> [Fafard:2:(0) 2.499434] [smpi_replay/INFO] Simulation time 2.49943
+
+$ rm -f replay/one_trace
+
+p Test of Isend replay with SMPI (one trace for all processes)
+
+< replay/actions_with_isend.txt
+$ mkfile replay/one_trace
+
+$ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/cpu_threshold:1 -np 3 -platform ${srcdir:=.}/replay/replay_platform.xml -hostfile ${srcdir:=.}/hostfile ./smpi_replay ${srcdir:=.}/replay/one_trace
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/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'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '1'
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> [Jupiter:1:(0) 0.000000] [smpi_replay/VERBOSE] 1 Irecv 0 1e9 0.000000
+> [Fafard:2:(0) 0.000000] [smpi_replay/VERBOSE] 2 Irecv 1 1e9 0.000000
+> [Fafard:2:(0) 6.553424] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
+> [Jupiter:1:(0) 13.106847] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847
+> [Tremblay:0:(0) 147.462483] [smpi_replay/VERBOSE] 0 send 1 1e9 147.462483
+> [Jupiter:1:(0) 147.462483] [smpi_replay/VERBOSE] 1 wait 134.355636
+> [Tremblay:0:(0) 157.656682] [smpi_replay/VERBOSE] 0 compute 1e9 10.194200
+> [Fafard:2:(0) 294.947973] [smpi_replay/VERBOSE] 2 wait 288.394550
+> [Jupiter:1:(0) 294.947973] [smpi_replay/VERBOSE] 1 send 2 1e9 147.485491
+> [Fafard:2:(0) 294.947973] [smpi_replay/VERBOSE] 2 Isend 0 1e9 0.000000
+> [Fafard:2:(0) 301.501397] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
+> [Tremblay:0:(0) 425.278035] [smpi_replay/VERBOSE] 0 recv 2 1e9 267.621353
+> [Tremblay:0:(0) 425.278035] [smpi_replay/INFO] Simulation time 425.278
index 9402eaa..5faa6c4 100644 (file)
@@ -161,6 +161,18 @@ xbt_dynar_t SD_dotload_with_sched(const char *filename){
   }else{
     XBT_WARN("The scheduling is ignored");
   }
+  SD_task_t task;
+  unsigned int count;
+  xbt_dynar_t computer = NULL;
+  xbt_dict_cursor_t dict_cursor;
+  char *computer_name;
+  xbt_dict_foreach(computers,dict_cursor,computer_name,computer){
+    xbt_dynar_free(&computer);
+  }
+  xbt_dict_free(&computers);
+  xbt_dynar_foreach(result,count,task){
+     SD_task_destroy(task);
+  }
   return NULL;
 }
 
index 7214b99..4af254f 100644 (file)
@@ -13,6 +13,7 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
 
 int communicator_size = 0;
+static int active_processes = 0;
 
 typedef struct {
   xbt_dynar_t isends; /* of MPI_Request */
@@ -41,11 +42,12 @@ static void action_init(const char *const *action)
 
   /* start a simulated timer */
   smpi_process_simulated_start();
+  /*initialize the number of active processes */
+  active_processes = smpi_process_count();
 }
 
 static void action_finalize(const char *const *action)
 {
-  double sim_time= 1.;
   smpi_replay_globals_t globals =
       (smpi_replay_globals_t) smpi_process_get_user_data();
 
@@ -56,12 +58,6 @@ static void action_finalize(const char *const *action)
     xbt_dynar_free_container(&(globals->irecvs));
   }
   free(globals);
-  /* end the simulated timer */
-  sim_time = smpi_process_simulated_elapsed();
-  if (!smpi_process_index())
-    XBT_INFO("Simulation time %g", sim_time);
-  smpi_process_finalize();
-  smpi_process_destroy();
 }
 
 static void action_comm_size(const char *const *action)
@@ -362,7 +358,16 @@ void smpi_replay_init(int *argc, char***argv){
 }
 
 int smpi_replay_finalize(){
-  if(!smpi_process_index())
-     _xbt_replay_action_exit();
+  double sim_time= 1.;
+  /* One active process will stop. Decrease the counter*/
+  active_processes--;
+
+  if(!active_processes){
+    /* Last process alive speaking */
+    /* end the simulated timer */
+    sim_time = smpi_process_simulated_elapsed();
+    XBT_INFO("Simulation time %g", sim_time);
+    _xbt_replay_action_exit();
+  }
   return PMPI_Finalize();
 }
index 3b453c6..653546a 100644 (file)
@@ -89,30 +89,22 @@ static void xbt_preinit(void)
   mmalloc_preinit();
 #endif
   xbt_log_preinit();
-
   xbt_backtrace_preinit();
   xbt_os_thread_mod_preinit();
   xbt_fifo_preinit();
   xbt_dict_preinit();
-
   atexit(xbt_postexit);
 }
 
 static void xbt_postexit(void)
 {
   xbt_backtrace_postexit();
-
   xbt_fifo_postexit();
   xbt_dict_postexit();
-
   xbt_os_thread_mod_postexit();
-
   xbt_dynar_free(&xbt_cmdline);
-
   xbt_log_postexit();
-
   free(xbt_binary_name);
-
 #ifdef MMALLOC_WANT_OVERRIDE_LEGACY
   mmalloc_postexit();
 #endif
index a28d295..4e54094 100644 (file)
@@ -23,8 +23,8 @@ int main( int argc, char **argv)
     MPI_Type_ub(tmptype, &ub);
     MPI_Type_extent(tmptype, &extent);
 #ifdef DEBUG
-    printf("tmptype: size: %d lb: %ld ub: %ld ex: %ld\n", size, lb, ub, 
-          extent);
+    printf("tmptype: size: %d lb: %ld ub: %ld ex: %ld\n",
+           size, (long)lb, (long)ub, (long)extent);
 #endif
        
     blockcnt[0] = 1;
@@ -38,13 +38,13 @@ int main( int argc, char **argv)
     MPI_Type_ub(newtype, &ub);
     MPI_Type_extent(newtype, &extent);
 #ifdef DEBUG
-    printf("newtype: size: %ld lb: %ld ub: %ld ex: %d\n", size, lb, ub, 
-          extent);
+    printf("newtype: size: %d lb: %ld ub: %ld ex: %ld\n",
+           size, (long)lb, (long)ub, (long)extent);
 #endif 
     if (size != 1 || lb != 2 || ub != 3 || extent != 1) {
-           printf ("lb = %ld (should be 2), ub = %ld (should be 3) extent = %ld should be 1, size = %d (should be 1)\n", lb, ub, extent, size) ;
-    }
-    else {
+        printf("lb = %ld (should be 2), ub = %ld (should be 3) extent = %ld should be 1, size = %d (should be 1)\n",
+               (long)lb, (long)ub, (long)extent, size);
+    else {
        printf( " No Errors\n" );
     }
     MPI_Type_free(&tmptype);
index be04181..c87788e 100644 (file)
@@ -11,21 +11,21 @@ int main( int argc, char **argv )
 
 
   MPI_Type_extent(MPI_INT, &i_extent);
-  printf("MPI_Type_extent (MPI_INT) = %ld\n", i_extent);
+  printf("MPI_Type_extent (MPI_INT) = %ld\n", (long)i_extent);
 
   MPI_Type_size(MPI_INT, &i_size);
   printf("MPI_Type_size (MPI_INT) = %d\n", i_size);
 
 
   MPI_Type_extent(MPI_UNSIGNED, &i_extent);
-  printf("MPI_Type_extent (MPI_UNSIGNED) = %ld\n", i_extent);
+  printf("MPI_Type_extent (MPI_UNSIGNED) = %ld\n", (long)i_extent);
 
   MPI_Type_size(MPI_UNSIGNED, &i_size);
   printf("MPI_Type_size (MPI_UNSIGNED) = %d\n", i_size);
 
 #if defined(HAVE_LONG_DOUBLE)
   MPI_Type_extent(MPI_LONG_DOUBLE, &i_extent);
-  printf("MPI_Type_extent (MPI_LONG_DOUBLE) = %ld\n", i_extent);
+  printf("MPI_Type_extent (MPI_LONG_DOUBLE) = %ld\n", (long)i_extent);
 
   MPI_Type_size(MPI_LONG_DOUBLE, &i_size);
   printf("MPI_Type_size (MPI_LONG_DOUBLE) = %d\n", i_size);
index 1da6964..edcb2bb 100644 (file)
@@ -26,13 +26,14 @@ main( int argc, char **argv)
        
        /* Check that the results are correct */
 #ifdef DEBUG
-       printf("lb=%ld, ub=%ld, extent=%ld\n", lb, ub, extent);
+       printf("lb=%ld, ub=%ld, extent=%ld\n",
+               (long)lb, (long)ub, (long)extent);
        printf("Should be lb=4, ub=5, extent=1\n");
 #endif
        if (lb != 4 || ub != 5 || extent != 1) {
-           printf ("lb = %ld (should be 4), ub = %ld (should be 5) extent = %ld should be 1\n", lb, ub, extent) ;
-       }
-       else {
+            printf("lb = %ld (should be 4), ub = %ld (should be 5) extent = %ld should be 1\n",
+                   (long)lb, (long)ub, (long)extent) ;
+       else {
            printf( " No Errors\n" );
        }