Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
authordegomme <augustin.degomme@unibas.ch>
Mon, 7 Mar 2016 15:55:23 +0000 (16:55 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Mon, 7 Mar 2016 15:55:23 +0000 (16:55 +0100)
79 files changed:
.gitignore
CMakeLists.txt
examples/java/async/CMakeLists.txt
examples/java/bittorrent/CMakeLists.txt
examples/java/chord/CMakeLists.txt
examples/java/cloud/CMakeLists.txt
examples/java/cloud/energy/CMakeLists.txt
examples/java/cloud/migration/CMakeLists.txt
examples/java/commTime/CMakeLists.txt
examples/java/energy/CMakeLists.txt
examples/java/io/CMakeLists.txt
examples/java/kademlia/CMakeLists.txt
examples/java/master_slave_bypass/CMakeLists.txt
examples/java/master_slave_kill/CMakeLists.txt
examples/java/masterslave/CMakeLists.txt
examples/java/migration/CMakeLists.txt
examples/java/mutualExclusion/CMakeLists.txt
examples/java/pingPong/CMakeLists.txt
examples/java/priority/CMakeLists.txt
examples/java/startKillTime/CMakeLists.txt
examples/java/suspend/CMakeLists.txt
examples/java/tracing/CMakeLists.txt
examples/msg/masterslave/CMakeLists.txt
examples/msg/tracing/CMakeLists.txt
examples/msg/tracing/categories.c
examples/msg/tracing/deployment.xml
examples/msg/tracing/link_srcdst_user_variables.c
examples/msg/tracing/link_user_variables.c
examples/msg/tracing/ms.c
examples/msg/tracing/procmig.c
examples/msg/tracing/simple.c
examples/msg/tracing/trace_platform.c
examples/msg/tracing/user_variables.c
examples/s4u/CMakeLists.txt
examples/s4u/README
examples/s4u/basic/CMakeLists.txt [deleted file]
examples/s4u/io/CMakeLists.txt [deleted file]
examples/s4u/io/s4u_io.cpp [moved from examples/s4u/io/s4u_io_test.cpp with 100% similarity]
examples/s4u/io/s4u_io.tesh
src/mc/Process.cpp
src/mc/mc_dwarf.cpp
src/smpi/instr_smpi.cpp
src/smpi/private.h
src/smpi/smpi_base.cpp
src/smpi/smpi_bench.cpp
src/smpi/smpi_coll.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_deployment.cpp
src/smpi/smpi_dvfs.cpp
src/smpi/smpi_f77.cpp
src/smpi/smpi_global.cpp
src/smpi/smpi_group.cpp
src/smpi/smpi_memory.cpp
src/smpi/smpi_mpi.cpp
src/smpi/smpi_mpi_dt.cpp
src/smpi/smpi_mpi_dt_private.h
src/smpi/smpi_pmpi.cpp
src/smpi/smpi_replay.cpp
src/smpi/smpi_rma.cpp
src/smpi/smpi_topo.cpp
src/smpi/smpitools.sh
src/xbt/mmalloc/mm_legacy.c
src/xbt/xbt_main.c
tools/MSG_visualization/colorize.pl
tools/MSG_visualization/trace2fig.pl
tools/cmake/DefinePackages.cmake
tools/cmake/MakeLib.cmake
tools/cmake/Tests.cmake
tools/cmake/src/internal_config.h.in
tools/doxygen/index_create.pl
tools/doxygen/xbt_log_extract_hierarchy.pl
tools/graphicator/CMakeLists.txt
tools/internal/README
tools/internal/check_dist_archive.exclude
tools/jenkins/build.sh
tools/normalize-pointers.py
tools/sg_unit_extractor.pl
tools/stack-cleaner/README
tools/stack-cleaner/clean-stack-filter

index 5ea3ec4..541308e 100644 (file)
@@ -189,6 +189,7 @@ examples/msg/properties/msg_prop
 examples/msg/semaphores/synchro
 examples/msg/sendrecv/sendrecv
 examples/msg/sendrecv/sendrecv_main
+examples/msg/set-maestro/set-maestro
 examples/msg/simulation.trace
 examples/msg/start_kill_time/sk_time
 examples/msg/suspend/suspend
@@ -209,6 +210,8 @@ examples/msg/tracing/volume
 examples/msg/volume.trace
 examples/msg/z_gtnets.trace
 examples/msg/zmsg_test.trace
+examples/s4u/basic/s4u_basic
+examples/s4u/io/s4u_io
 examples/simdag/dax/dax_test
 examples/simdag/dot/dot_test
 examples/simdag/dot/dot_test2
index 0217261..4459d8d 100644 (file)
@@ -336,9 +336,6 @@ else()
   SET(HAVE_MMALLOC 0)
 endif()
 
-set(HAVE_UCONTEXT_CONTEXTS 0)
-set(HAVE_THREAD_CONTEXTS 0)
-
 if(enable_jedule)
   set(HAVE_JEDULE 1)
 endif()
@@ -351,7 +348,6 @@ endif()
 
 if(enable_model-checking AND HAVE_MMALLOC)
   SET(HAVE_MC 1)
-  SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
   include(FindLibunwind)
   include(FindLibdw)
 else()
@@ -360,7 +356,6 @@ else()
   endif()
   SET(HAVE_MC 0)
   SET(HAVE_MMALLOC 0)
-  SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
 endif()
 
 if(enable_smpi)
@@ -415,6 +410,8 @@ endif()
 #--------------------------------------------------------------------------------------------------
 ### Initialize of CONTEXT THREADS
 
+set(HAVE_THREAD_CONTEXTS 0)
+
 if(HAVE_PTHREAD)
   ### Test that we have a way to create semaphores
 
@@ -506,14 +503,12 @@ if(HAVE_PTHREAD)
     message(FATAL_ERROR "Semaphores are not usable (neither sem_open nor sem_init is both compilable and executable), but they are mandatory to threads (you may need to mount /dev).")
   endif()
 
-endif()
-
-if(HAVE_PTHREAD)
   set(HAVE_THREAD_CONTEXTS 1)
   message("-- Support for thread context factory ok.")
 endif()
 
 
+set(HAVE_UCONTEXT_CONTEXTS 0)
 if(NOT HAVE_UCONTEXT_H)
   message("-- No ucontext factory: <ucontext.h> not found.")
 elseif(APPLE)
@@ -546,30 +541,30 @@ else()
   else()
     message(FATAL_ERROR "Could not figure out the stack setup. Compil: ${RUN_makecontext_VAR}. Exec: ${COMPILE_makecontext_VAR}. Output: ${stack_setup}")
   endif()
-  
-  # Stack growth direction (upward or downward)
-  try_run(RUN_stackgrowth_VAR COMPILE_stackgrowth_VAR
-    ${CMAKE_BINARY_DIR}
-    ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stackgrowth.c
-    RUN_OUTPUT_VARIABLE stack
-    COPY_FILE test_stackgrowth)
-
-  if("${stack}" STREQUAL "down")
+endif()
+
+# Stack growth direction (upward or downward). Used for the following contexts: SysV, raw, Boost
+try_run(RUN_stackgrowth_VAR COMPILE_stackgrowth_VAR
+  ${CMAKE_BINARY_DIR}
+  ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stackgrowth.c
+  RUN_OUTPUT_VARIABLE stack
+  COPY_FILE test_stackgrowth)
+
+if("${stack}" STREQUAL "down")
+  set(PTH_STACKGROWTH "-1")
+elseif("${stack}" STREQUAL "up")
+  set(PTH_STACKGROWTH "1")
+else()
+  if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
+    set(PTH_STACKGROWTH "-1")
+  elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
     set(PTH_STACKGROWTH "-1")
-  elseif("${stack}" STREQUAL "up")
-    set(PTH_STACKGROWTH "1")
   else()
-    if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
-      set(PTH_STACKGROWTH "-1")
-    elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
-      set(PTH_STACKGROWTH "-1")
-    else()
-      message(FATAL_ERROR "Could not figure out the stack direction. Test prog returned: ${stack}; CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}.")
-    endif()
+    message(FATAL_ERROR "Could not figure out the stack direction. Test prog returned: ${stack}; CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}.")
   endif()
-  # If the test ran well, remove the test binary
-  execute_process(COMMAND ${CMAKE_COMMAND} -E remove test_stackgrowth)
 endif()
+# If the test ran well, remove the test binary
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove test_stackgrowth)
 #--------------------------------------------------------------------------------------------------
 
 ### check for addr2line
index aca0ef1..4167099 100644 (file)
@@ -13,8 +13,10 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-async --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/async/async.tesh)
 endif()
 
+
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/async.tesh           PARENT_SCOPE)
 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/asyncDeployment.xml  PARENT_SCOPE)
 set(examples_src  ${examples_src}  ${sources}                                       PARENT_SCOPE)
index 96906da..d97de6d 100644 (file)
@@ -14,8 +14,10 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-bittorrent --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/bittorrent/bittorrent.tesh)
 endif()
 
+
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/bittorrent.tesh  PARENT_SCOPE)
 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/bittorrent.xml   PARENT_SCOPE)
 set(examples_src  ${examples_src}  ${sources}                                   PARENT_SCOPE)
index 076b4b1..7bc76b8 100644 (file)
@@ -15,6 +15,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-chord --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/chord/chord.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/chord.tesh  PARENT_SCOPE)
index 4fd806d..6ffe068 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-cloud --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/cloud/cloud.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/cloud.tesh  PARENT_SCOPE)
index c13e68f..0f32ce7 100644 (file)
@@ -11,6 +11,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-cloud-energy --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/cloud/energy/energy.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/energy.tesh  PARENT_SCOPE)
index 04799a6..104b39e 100644 (file)
@@ -13,6 +13,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-cloud-migration --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/cloud/migration/migration.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/migration.tesh     PARENT_SCOPE)
index ba6db1f..c00a943 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-commTime --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/commTime/commtime.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/commtime.tesh           PARENT_SCOPE)
index f24d28a..a31ded4 100644 (file)
@@ -11,6 +11,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-energy --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/energy/energy.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/energy.tesh  PARENT_SCOPE)
index 606bd31..b59c2bb 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-storage --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/io/storage.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/storage.tesh  PARENT_SCOPE)
index ec0270f..bd2b6f6 100644 (file)
@@ -16,6 +16,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-kademlia --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/kademlia/kademlia.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/kademlia.tesh  PARENT_SCOPE)
index 7b30e8e..f02e02c 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-bypass --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/master_slave_bypass/bypass.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/bypass.tesh  PARENT_SCOPE)
index de8f0d4..20cae75 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-kill --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/master_slave_kill/kill.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/kill.tesh  PARENT_SCOPE)
index c79b99c..fb8fa97 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-masterslave --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/masterslave/masterslave.tesh)
 endif()
 
 set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave.tesh           PARENT_SCOPE)
index b7b100f..486b642 100644 (file)
@@ -11,6 +11,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-migration --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/migration/migration.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/migration.tesh           PARENT_SCOPE)
index f664af1..a5e9bed 100644 (file)
@@ -13,6 +13,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-mutualExclusion --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/mutualExclusion/mutualexclusion.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/mutualexclusion.tesh              PARENT_SCOPE)
index 1943dfa..910bedb 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-pingPong --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/pingPong/pingpong.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/pingpong.tesh           PARENT_SCOPE)
index 0141aff..f254e91 100644 (file)
@@ -11,6 +11,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-priority --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/priority/priority.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/priority.tesh           PARENT_SCOPE)
index 71300cc..1191d06 100644 (file)
@@ -11,6 +11,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-startKillTime --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/startKillTime/startKillTime.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/startKillTime.tesh         PARENT_SCOPE)
index 086fcd4..2e05729 100644 (file)
@@ -11,6 +11,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
   )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-suspend --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/suspend/suspend.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/suspend.tesh           PARENT_SCOPE)
index 8a18864..1bb938c 100644 (file)
@@ -12,6 +12,7 @@ if(enable_java)
     COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
     )
   add_custom_target(${example} ALL DEPENDS ${example}_compiled)
+  ADD_TESH(java-tracing --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/tracing/tracingPingPong.tesh)
 endif()
 
 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/tracingPingPong.tesh           PARENT_SCOPE)
index bd7a720..61c4c46 100644 (file)
@@ -1,46 +1,39 @@
-add_executable       (masterslave_failure   masterslave_failure.c)
-target_link_libraries(masterslave_failure   simgrid)
-add_executable       (masterslave_forwarder masterslave_forwarder.c)
-target_link_libraries(masterslave_forwarder simgrid )
-add_executable       (masterslave_mailbox   masterslave_mailbox.c)
-target_link_libraries(masterslave_mailbox   simgrid)
-add_executable       (masterslave_kill      masterslave_kill.c)
-target_link_libraries(masterslave_kill      simgrid)
+foreach (example masterslave_failure masterslave_forwarder masterslave_mailbox)
+  add_executable       (${example} ${example}.c)
+  target_link_libraries(${example} simgrid)
+  set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.c)
+  set(tesh_files  ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.tesh 
+                                ${CMAKE_CURRENT_SOURCE_DIR}/${example}_crosstraffic.tesh)
+
+  ADD_TESH_FACTORIES(msg-${example} "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/${example}_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-${example}-no-crosstraffic   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/${example}.tesh)
+endforeach()
+
 add_executable       (masterslave_arg       masterslave_arg.c)
 target_link_libraries(masterslave_arg       simgrid)
+add_executable       (masterslave_kill      masterslave_kill.c)
+target_link_libraries(masterslave_kill      simgrid)
 
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cpu_ti.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_forwarder_crosstraffic.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_mailbox.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cas01_im.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_crosstraffic.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_forwarder.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_multicore.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_failure_crosstraffic.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cpu_ti_crosstraffic.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_failure.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_mailbox_crosstraffic.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_vivaldi.tesh
-  PARENT_SCOPE)
-set(xml_files
-  ${xml_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_forwarder.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox_multicore.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_vivaldi.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_kill.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave.xml
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_arg.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_failure.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_forwarder.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_mailbox.c
-  PARENT_SCOPE)
+ADD_TESH_FACTORIES(msg-masterslave             "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_crosstraffic.tesh)
+ADD_TESH_FACTORIES(msg-masterslave-kill        "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_kill.tesh)
+ADD_TESH_FACTORIES(msg-masterslave-multicore   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_multicore.tesh)
+ADD_TESH_FACTORIES(msg-masterslave-cpu-ti      "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/masterslave --cd ${CMAKE_HOME_DIRECTORY}/examples/msg masterslave/masterslave_cpu_ti_crosstraffic.tesh)
+ADD_TESH_FACTORIES(msg-masterslave-vivaldi     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_vivaldi.tesh)
+ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave.tesh)
 
+set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_arg.c
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.c                          PARENT_SCOPE)
+set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/masterslave.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_crosstraffic.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cpu_ti.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cpu_ti_crosstraffic.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_cas01_im.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_multicore.tesh
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_vivaldi.tesh                    PARENT_SCOPE)
+set(xml_files   ${xml_files}       ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_forwarder.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_kill.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox_multicore.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_vivaldi.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave.xml                  PARENT_SCOPE)
index 4711217..3be1e6b 100644 (file)
@@ -1,50 +1,20 @@
-add_executable       (ms                         ms.c)
-target_link_libraries(ms                         simgrid)
-add_executable       (categories                 categories.c)
-target_link_libraries(categories                 simgrid)
-add_executable       (procmig                    procmig.c)
-target_link_libraries(procmig                    simgrid)
+foreach (example ms categories procmig trace_platform user_variables link_user_variables link_srcdst_user_variables)
+  add_executable       (${example} ${example}.c)
+  target_link_libraries(${example} simgrid)
+  set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.c)
+  set(tesh_files  ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.tesh)
+
+  ADD_TESH(tracing-${example} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/${example}.tesh)
+endforeach()
+
 add_executable       (simple                     simple.c)
 target_link_libraries(simple                     simgrid)
-add_executable       (trace_platform             trace_platform.c)
-target_link_libraries(trace_platform             simgrid)
-add_executable       (user_variables             user_variables.c)
-target_link_libraries(user_variables             simgrid)
-add_executable       (link_user_variables        link_user_variables.c)
-target_link_libraries(link_user_variables        simgrid)
-add_executable       (link_srcdst_user_variables link_srcdst_user_variables.c)
-target_link_libraries(link_srcdst_user_variables simgrid)
 
 ## Clean generated files
 get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
-set_directory_properties(
-  PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
-  "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/ms.cat.plist;${CMAKE_CURRENT_BINARY_DIR}/ms.trace;${CMAKE_CURRENT_BINARY_DIR}/ms.uncat.plist;"
-  )
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/ms.cat.plist;${CMAKE_CURRENT_BINARY_DIR}/ms.trace;${CMAKE_CURRENT_BINARY_DIR}/ms.uncat.plist;")
 
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/categories.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/link_srcdst_user_variables.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/link_user_variables.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/ms.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/procmig.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/trace_platform.tesh
-  ${CMAKE_CURRENT_SOURCE_DIR}/user_variables.tesh
-  PARENT_SCOPE)
-set(xml_files
-  ${xml_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/deployment.xml
-  ${CMAKE_CURRENT_SOURCE_DIR}/procmig-deploy.xml
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/categories.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/link_srcdst_user_variables.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/link_user_variables.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/ms.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/procmig.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/simple.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/trace_platform.c
-  ${CMAKE_CURRENT_SOURCE_DIR}/user_variables.c
-  PARENT_SCOPE)
+set(tesh_files    ${tesh_files}                                                    PARENT_SCOPE)
+set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/simple.c            PARENT_SCOPE)
+set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/deployment.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/procmig-deploy.xml  PARENT_SCOPE)
index f5e3fc9..43963e3 100644 (file)
@@ -6,12 +6,11 @@
 
 /** @addtogroup MSG_examples
  * 
- * - <b>tracing/categories.c</b> This is a master/slave program where the master creates
- * tasks, send them to the slaves. For each task received, the slave executes
- * it and then destroys it. This program declares several tracing categories that are
- * used to classify tasks. When the program is executed, the tracing mechanism registers
- * the resource utilization of hosts and links according to these categories. You might
- * want to run this program with the following parameters:
+ * - <b>tracing/categories.c</b> This is a master/slave program where the master creates tasks, send them to the slaves.
+ * For each task received, the slave executes it and then destroys it. This program declares several tracing categories
+ * that are used to classify tasks. When the program is executed, the tracing mechanism registers the resource
+ * utilization of hosts and links according to these categories. You might want to run this program with the following
+ * parameters:
  * --cfg=tracing:yes
  * --cfg=tracing/categorized:yes
  * --cfg=tracing/uncategorized:yes
 
 #include <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-
-/** sender function  */
-int master(int argc, char *argv[])
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+
+static int master(int argc, char *argv[])
 {
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   long slaves_count = xbt_str_parse_int(argv[4], "Invalid amount of slaves: %s");
@@ -65,8 +56,7 @@ int master(int argc, char *argv[])
   return 0;
 }
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
   msg_task_t task = NULL;
 
@@ -85,7 +75,6 @@ int slave(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -94,9 +83,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   //declaring user categories with RGB colors
   TRACE_category_with_color ("compute", "1 0 0"); //red
@@ -106,7 +93,7 @@ int main(int argc, char *argv[])
 
   MSG_function_register("master", master);
   MSG_function_register("slave", slave);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
   return 0;
index 1efc8a7..3c2a758 100644 (file)
@@ -8,7 +8,6 @@
      <argument value="1000000"/>   <!-- Communication size of tasks -->
      <argument value="5"/>         <!-- Number of slaves -->
   </process>
-  <!-- The slave processes (with mailbox to listen on as argument) -->
   <process host="Tremblay" function="slave"/>
   <process host="Jupiter" function="slave"/>
   <process host="Fafard" function="slave"/>
index aa1caf6..632f2d3 100644 (file)
@@ -8,21 +8,17 @@
 
 /** @addtogroup MSG_examples
  *
- * - <b>tracing/link_srcdst_user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the links of the platform file. Instead of
- * providing the name of the link to update one of its variable, this example shows
- * how to provide two hosts as parameter (source and destination, use their names as
- * defined in the platform file). The tracing mechanism will get the route between
- * these two hosts, if there is one defined in the platform file, and update the variable
- * of all the links of that route to the value provided.
+ * - <b>tracing/link_srcdst_user_variables.c</b>: This program demonstrates how to trace user variables associated to
+ * the links of the platform file. Instead of providing the name of the link to update one of its variable, this
+ * example shows how to provide two hosts as parameter (source and destination, use their names as defined in the
+ * platform file). The tracing mechanism will get the route between these two hosts, if there is one defined in the
+ * platform file, and update the variable of all the links of that route to the value provided.
  * You might want to run this program with the following parameters:
  * --cfg=tracing:yes
  * --cfg=tracing/platform:yes
  * (See \ref tracing_tracing_options for details)
  */
 
-int master(int argc, char *argv[]);
-
 //dump function to create and execute a task
 static void create_and_execute_task (void)
 {
@@ -31,18 +27,11 @@ static void create_and_execute_task (void)
   MSG_task_destroy (task);
 }
 
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
-  int i;
-
   //Set initial values for the link user variables
-  //
-  //This example uses source and destination where
-  //source and destination are the name of hosts in
-  //the platform file.
-  //
-  //The functions will set/change the value of the variable
-  //for all links in the route between source and destination.
+  //This example uses source and destination wheresource and destination are the name of hosts inthe platform file.
+  //The functions will set/change the value of the variablefor all links in the route between source and destination.
 
   //Set the Link_Capacity variable
   TRACE_link_srcdst_variable_set("Tremblay", "Bourassa", "Link_Capacity", 12.34);
@@ -53,7 +42,7 @@ int master(int argc, char *argv[])
   TRACE_link_srcdst_variable_set("Fafard", "Ginette", "Link_Utilization", 3.4);
 
   //run the simulation, update my variables accordingly
-  for (i = 0; i < 10; i++) {
+  for (int i = 0; i < 10; i++) {
     create_and_execute_task ();
 
     //Add to link user variables
@@ -61,7 +50,7 @@ int master(int argc, char *argv[])
     TRACE_link_srcdst_variable_add ("Fafard", "Ginette", "Link_Utilization", 7.8);
   }
 
-  for (i = 0; i < 10; i++) {
+  for (int i = 0; i < 10; i++) {
     create_and_execute_task ();
 
     //Subtract from link user variables
@@ -72,7 +61,6 @@ int master(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -81,9 +69,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   //declaring link user variables (one without, another with a RGB color)
   TRACE_link_variable_declare("Link_Capacity");
@@ -92,7 +78,7 @@ int main(int argc, char *argv[])
   //register "master" and "slave" functions and launch deployment
   MSG_function_register("master", master);
   MSG_function_register("slave", master);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
   return 0;
index 2c6fb26..5c08fc6 100644 (file)
@@ -8,18 +8,14 @@
 
 /** @addtogroup MSG_examples
  *
- * - <b>tracing/link_user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the links of the platform file. You need
- * to provide the name of the link to update the value of the variable associated
- * to that link.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/link_user_variables.c</b>: This program demonstrates how to trace user variables associated to the
+ * links of the platform file. You need to provide the name of the link to update the value of the variable associated
+ * to that link. You might want to run this program with the following parameters:
  * --cfg=tracing:yes
  * --cfg=tracing/platform:yes
  * (See \ref tracing_tracing_options for details)
  */
 
-int master(int argc, char *argv[]);
-
 //dump function to create and execute a task
 static void create_and_execute_task (void)
 {
@@ -28,13 +24,10 @@ static void create_and_execute_task (void)
   MSG_task_destroy (task);
 }
 
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
-  int i;
-
-  //set initial values for the link user variables
-  //this example only shows for links
-  //identified by "6" and "3" in the platform file
+  //set initial values for the link user variables this example only shows for links identified by "6" and "3" in the
+  //platform file
 
   //Set the Link_Capacity variable
   TRACE_link_variable_set("6", "Link_Capacity", 12.34);
@@ -45,7 +38,7 @@ int master(int argc, char *argv[])
   TRACE_link_variable_set("6", "Link_Utilization", 3.4);
 
   //run the simulation, update my variables accordingly
-  for (i = 0; i < 10; i++) {
+  for (int i = 0; i < 10; i++) {
     create_and_execute_task ();
 
     //Add to link user variables
@@ -53,7 +46,7 @@ int master(int argc, char *argv[])
     TRACE_link_variable_add ("6", "Link_Utilization", 7.8);
   }
 
-  for (i = 0; i < 10; i++) {
+  for (int i = 0; i < 10; i++) {
     create_and_execute_task ();
 
     //Subtract from link user variables
@@ -64,7 +57,6 @@ int master(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -73,9 +65,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   //declaring link user variables (one without, another with a RGB color)
   TRACE_link_variable_declare("Link_Capacity");
@@ -84,7 +74,7 @@ int main(int argc, char *argv[])
   //register "master" and "slave" functions and launch deployment
   MSG_function_register("master", master);
   MSG_function_register("slave", master);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
   return 0;
index 697a814..eb9deaf 100644 (file)
@@ -6,12 +6,10 @@
 
 /** @addtogroup MSG_examples
  * 
- * - <b>tracing/ms.c</b> This is a master/slave program where the master creates
- * tasks, send them to the slaves. For each task received, the slave executes
- * it and then destroys it. This program uses several tracing functions that
- * enable the tracing of categorized resource utilization, the use of trace marks,
- * and user variables associated to the hosts of the platform file.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/ms.c</b> This is a master/slave program where the master creates tasks, send them to the slaves. For
+ * each task received, the slave executes it and then destroys it. This program uses several tracing functions that
+ * enable the tracing of categorized resource utilization, the use of trace marks, and user variables associated to the
+ * hosts of the platform file. You might want to run this program with the following parameters:
  * --cfg=tracing/categorized:yes
  * --cfg=tracing/uncategorized:yes
  * --cfg=viva/categorized:viva_cat.plist
  * (See \ref tracing_tracing_options for details)
  */
 
-#include <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-
-/** sender function  */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
@@ -68,15 +56,12 @@ int master(int argc, char *argv[])
   return 0;
 }
 
-/** Receiver function  */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
 {
   msg_task_t task = NULL;
 
   TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_slave", 1);
-  TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()),
-                          "task_computation",
-                          0);
+  TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "task_computation", 0);
   while (1) {
     MSG_task_receive(&(task), "master_mailbox");
 
@@ -86,9 +71,7 @@ int slave(int argc, char *argv[])
     }
     //adding the value returned by MSG_task_get_compute_duration(task)
     //to the variable "task_computation"
-    TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()),
-                            "task_computation",
-                            MSG_task_get_flops_amount(task));
+    TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", MSG_task_get_flops_amount(task));
     MSG_task_execute(task);
     MSG_task_destroy(task);
     task = NULL;
@@ -96,7 +79,6 @@ int slave(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -105,9 +87,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   //declaring user variables
   TRACE_host_variable_declare("is_slave");
@@ -123,14 +103,13 @@ int main(int argc, char *argv[])
   //declaring user categories with RGB colors (values from 0 to 1)
   TRACE_category_with_color ("compute", "1 0 0");  //compute is red
   TRACE_category_with_color ("finalize", "0 1 0"); //finalize is green
-  //categories without user-defined colors receive
-  //random colors generated by the tracing system
+  //categories without user-defined colors receive random colors generated by the tracing system
   TRACE_category ("request");
   TRACE_category_with_color ("report", NULL);
 
   MSG_function_register("master", master);
   MSG_function_register("slave", slave);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
 
@@ -156,4 +135,4 @@ int main(int argc, char *argv[])
   }
 
   return 0;
-}                               /* end_of_main */
+}
index 5be002b..a98786e 100644 (file)
@@ -6,23 +6,17 @@
 
 /** @addtogroup MSG_examples
  * 
- * - <b>tracing/procmig.c</b> This program shows a process migration. Tracing
- * this program with the options below enables a gantt-chart visualization
- * of where the process has been during its execution. Migrations are represented by
- * arrows from the origin to the destination host.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/procmig.c</b> This program shows a process migration. Tracing this program with the options below
+ * enables a gantt-chart visualization of where the process has been during its execution. Migrations are represented by
+ * arrows from the origin to the destination host. You might want to run this program with the following parameters:
  * --cfg=tracing:yes
  * --cfg=tracing/msg/process:yes
  * (See \ref tracing_tracing_options for details)
  */
 
-#include "simgrid/msg.h"            /* core library */
-#include "xbt/sysdep.h"         /* calloc */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /** The guy we will move from host to host. It move alone and then is moved by policeman back  */
 static int emigrant(int argc, char *argv[])
@@ -77,26 +71,22 @@ static int master(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
-  /* Argument checking */
   MSG_init(&argc, argv);
   if (argc < 3) {
     XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   TRACE_category ("migration_order");
 
   /* Application deployment */
   MSG_function_register("emigrant", emigrant);
   MSG_function_register("master", master);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
   return 0;
index 774cdca..876828f 100644 (file)
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                             "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-int simple_func(int argc, char *argv[]);
-
-/** Emitter function  */
-int simple_func(int argc, char *argv[])
+static int simple_func(int argc, char *argv[])
 {
   msg_task_t task = MSG_task_create("task", 100, 0, NULL);
   MSG_task_execute (task);
@@ -35,7 +31,6 @@ int simple_func(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -44,13 +39,11 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   MSG_function_register("master", simple_func);
   MSG_function_register("slave", simple_func);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
   return 0;
index 9411bdf..9431a5f 100644 (file)
@@ -6,24 +6,17 @@
 
 /** @addtogroup MSG_examples
  * 
- * - <b>tracing/trace_platform.c</b>: This program demonstrates how a
- * platform file is traced to a Paje trace file format using the tracing
- * mechanism of Simgrid.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/trace_platform.c</b>: This program demonstrates how a platform file is traced to a Paje trace file
+ * format using the tracing mechanism of Simgrid. You might want to run this program with the following parameters:
  * --cfg=tracing:yes
  * --cfg=tracing/categorized:yes
  * (See \ref tracing_tracing_options for details)
  */
 
-#include <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
 
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -32,8 +25,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
   MSG_main();
   return 0;
 }
index 5a3255b..b338130 100644 (file)
@@ -6,26 +6,18 @@
 
 /** @addtogroup MSG_examples
  * 
- * - <b>tracing/user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the hosts of the platform file.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/user_variables.c</b>: This program demonstrates how to trace user variables associated to the hosts of
+ * the platform file. You might want to run this program with the following parameters:
  * --cfg=tracing:yes
  * --cfg=tracing/platform:yes
  * (See \ref tracing_tracing_options for details)
  */
 
-#include <stdio.h>
 #include "simgrid/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-int master(int argc, char *argv[]);
-
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   const char *hostname = MSG_host_get_name(MSG_host_self());
   int i;
@@ -56,7 +48,6 @@ int master(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -65,9 +56,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   //declaring user variables
   TRACE_host_variable_declare("HDD_capacity");
@@ -76,7 +65,7 @@ int main(int argc, char *argv[])
   //register functions and launch deployment
   MSG_function_register("master", master);
   MSG_function_register("slave", master);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
 
index a092a3d..8576a7d 100644 (file)
@@ -1,4 +1,13 @@
-set(txt_files
-  ${txt_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/README
-  PARENT_SCOPE)
\ No newline at end of file
+foreach (example basic io)
+  add_executable       (s4u_${example}  ${example}/s4u_${example}.cpp)
+  target_link_libraries(s4u_${example}  simgrid)
+  set_target_properties(s4u_${example}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
+
+  set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u_${example}.tesh)
+  set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u_${example}.cpp)
+  ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/s4u/${example} --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example} s4u_${example}.tesh)
+endforeach()
+
+set(examples_src  ${examples_src}                                     PARENT_SCOPE)
+set(tesh_files    ${tesh_files}                                       PARENT_SCOPE)
+set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/README  PARENT_SCOPE)
\ No newline at end of file
index 48f7ff4..6c6dc9c 100644 (file)
@@ -1,7 +1,5 @@
-S4U (Simgrid for you) is the next interface of SimGrid, expected to be
-released with SimGrid 4.0.
+S4U (Simgrid for you) is the next interface of SimGrid, expected to be released with SimGrid 4.0.
 
-Even if it's in a very preliminary state so far, you are welcome to
-try it and report any interface glitches that you see. Be however
-warned that the interface will be modified until its final release.
+Even if it's in a very preliminary state so far, you are welcome to try it and report any interface glitches that you 
+see. Be however warned that the interface will be modified until its final release. 
 You will have to adapt your code on the way.
\ No newline at end of file
diff --git a/examples/s4u/basic/CMakeLists.txt b/examples/s4u/basic/CMakeLists.txt
deleted file mode 100644 (file)
index 272b302..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-add_executable       (s4u_basic s4u_basic.cpp)
-target_link_libraries(s4u_basic simgrid)
-
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/s4u_basic.tesh
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/s4u_basic.cpp
-  PARENT_SCOPE)
diff --git a/examples/s4u/io/CMakeLists.txt b/examples/s4u/io/CMakeLists.txt
deleted file mode 100644 (file)
index d61f16b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-add_executable       (s4u_io_test s4u_io_test.cpp)
-target_link_libraries(s4u_io_test simgrid)
-
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/s4u_io.tesh
-  PARENT_SCOPE)
-set(examples_src
-  ${examples_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/s4u_io_test.cpp
-  PARENT_SCOPE)
index 7557d49..0a17043 100644 (file)
@@ -1,6 +1,6 @@
 #! ./tesh
 
-$ $SG_TEST_EXENV ${bindir:=.}/s4u_io_test
+$ $SG_TEST_EXENV ${bindir:=.}/s4u_io
 > [denise:host:(0) 0.000000] [s4u_test/INFO] Storage info on denise:
 > [denise:host:(0) 0.000000] [s4u_test/INFO]     Disk4 (/home) Used: 13221994; Free: 536857690006; Total: 536870912000.
 > [denise:host:(0) 0.000000] [s4u_test/INFO]     Disk2 (c:) Used: 2391537133; Free: 534479374867; Total: 536870912000.
index 80fa3f2..9465c6b 100644 (file)
@@ -52,6 +52,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_process, mc,
 #define SO_RE "\\.so[\\.0-9]*$"
 #define VERSION_RE "-[\\.0-9-]*$"
 
+// In lexicographic order (but this is currently not used in the code):
 static const char *const FILTERED_LIBS[] = {
   "ld",
   "libbz2",
index 5e1b5e5..a8f58bb 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <algorithm>
 #include <memory>
+#include <utility>
 
 #include <cstdlib>
 #define DW_LANG_Objc DW_LANG_ObjC       /* fix spelling error in older dwarf.h */
@@ -978,9 +979,8 @@ static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die
 }
 
 static
-Elf64_Half MC_dwarf_elf_type(Dwarf* dwarf)
+Elf64_Half get_type(Elf* elf)
 {
-  Elf* elf = dwarf_getelf(dwarf);
   Elf64_Ehdr* ehdr64 = elf64_getehdr(elf);
   if (ehdr64)
     return ehdr64->e_type;
@@ -990,28 +990,9 @@ Elf64_Half MC_dwarf_elf_type(Dwarf* dwarf)
   xbt_die("Could not get ELF heeader");
 }
 
-/** \brief Populate the debugging informations of the given ELF object
- *
- *  Read the DWARf information of the EFFL object and populate the
- *  lists of types, variables, functions.
- */
 static
-void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
+void read_dwarf_info(simgrid::mc::ObjectInformation* info, Dwarf* dwarf)
 {
-  int fd = open(info->file_name.c_str(), O_RDONLY);
-  if (fd < 0)
-    xbt_die("Could not open file %s", info->file_name.c_str());
-  Dwarf *dwarf = dwarf_begin(fd, DWARF_C_READ);
-  if (dwarf == nullptr)
-    xbt_die("Missing debugging information in %s\n"
-      "Your program and its dependencies must have debugging information.\n"
-      "You might want to recompile with -g or install the suitable debugging package.\n",
-      info->file_name.c_str());
-
-  Elf64_Half elf_type = MC_dwarf_elf_type(dwarf);
-  if (elf_type == ET_EXEC)
-    info->flags |= simgrid::mc::ObjectInformation::Executable;
-
   // For each compilation unit:
   Dwarf_Off offset = 0;
   Dwarf_Off next_offset = 0;
@@ -1024,9 +1005,193 @@ void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
       MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, NULL);
     offset = next_offset;
   }
+}
+
+/** Get the build-id (NT_GNU_BUILD_ID) from the ELF file
+ *
+ *  This build-id may is used to locate an external debug (DWARF) file
+ *  for this ELF file.
+ *
+ *  @param  elf libelf handle for an ELF file
+ *  @return build-id for this ELF file (or an empty vector if none is found)
+ */
+static
+std::vector<char> get_build_id(Elf* elf)
+{
+  size_t phnum;
+  if (elf_getphdrnum (elf, &phnum) != 0)
+    xbt_die("Could not read program headers");
+
+  // Iterate over the program headers and find the PT_NOTE ones:
+  for (size_t i = 0; i < phnum; ++i) {
+    GElf_Phdr phdr_temp;
+    GElf_Phdr *phdr = gelf_getphdr(elf, i, &phdr_temp);
+    if (phdr->p_type != PT_NOTE)
+      continue;
+
+    Elf_Data* data = elf_getdata_rawchunk(elf, phdr->p_offset, phdr->p_filesz, ELF_T_NHDR);
+
+    // Iterate over the notes and find the NT_GNU_BUILD_ID one:
+    size_t pos = 0;
+    while (1) {
+      GElf_Nhdr nhdr;
+      size_t name_pos;
+      size_t desc_pos;
+      pos = gelf_getnote(data, pos, &nhdr, &name_pos, &desc_pos);
+      // A note is identified by a name "GNU" and a integer type within
+      // the namespace defined by this name (here NT_GNU_BUILD_ID):
+      if (nhdr.n_type == NT_GNU_BUILD_ID
+          && nhdr.n_namesz == sizeof("GNU")
+          && memcmp((char*) data->d_buf + name_pos, "GNU", sizeof("GNU")) == 0) {
+
+        // Found the NT_GNU_BUILD_ID note:
+        char* start = (char*) data->d_buf + desc_pos;
+        char* end = (char*) start + nhdr.n_descsz;
+        return std::vector<char>(start, end);
+
+      }
+    }
+
+  }
+  return std::vector<char>();
+}
+
+static char hexdigits[16] = {
+  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+  'a', 'b', 'c', 'd', 'e', 'f'
+};
+
+/** Binary data to hexadecimal */
+static inline
+std::array<char, 2> to_hex(std::uint8_t byte)
+{
+  return { hexdigits[byte >> 4], hexdigits[byte & 0xF] };
+}
+
+/** Binary data to hexadecimal */
+static
+std::string to_hex(const char* data, std::size_t count)
+{
+  std::string res;
+  res.resize(2*count);
+  for (std::size_t i = 0; i < count; i++) {
+    std::array<char, 2> hex_byte = to_hex(data[i]);
+    for (int j = 0; j < 2; ++j)
+      res[2 * i + j] = hex_byte[j];
+  }
+  return std::move(res);
+}
+
+/** Binary data to hexadecimal */
+static
+std::string to_hex(std::vector<char> const& data)
+{
+  return to_hex(data.data(), data.size());
+}
+
+/** Base directories for external debug files */
+const char* debug_paths[] = {
+  "/usr/lib/debug/",
+  "/usr/local/lib/debug/",
+};
+
+/** Locate an external debug file from the NT_GNU_BUILD_ID
+ *
+ *  This is one of the mechanisms used for
+ *  [separate debug files](https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html).
+ */
+static
+std::string find_by_build_id(std::vector<char> id)
+{
+  std::string filename;
+  for (const char* debug_path : debug_paths) {
+    filename = debug_path;
+    filename += ".build-id/" + to_hex(id.data(), 1) + '/'
+      + to_hex(id.data() + 1, id.size() - 1) + ".debug";
+    XBT_DEBUG("Checking debug file: %s", filename.c_str());
+    if (access(filename.c_str(), F_OK) == 0)
+      return std::move(filename);
+  }
+  return std::string();
+}
+
+/** \brief Populate the debugging informations of the given ELF object
+ *
+ *  Read the DWARf information of the EFFL object and populate the
+ *  lists of types, variables, functions.
+ */
+static
+void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
+{
+  if (elf_version(EV_CURRENT) == EV_NONE)
+    xbt_die("libelf initialization error");
+
+  // Open the ELF file:
+  int fd = open(info->file_name.c_str(), O_RDONLY);
+  if (fd < 0)
+    xbt_die("Could not open file %s", info->file_name.c_str());
+  Elf* elf = elf_begin(fd, ELF_C_READ, nullptr);
+  if (elf == nullptr)
+    xbt_die("Not an ELF file 1");
+  Elf_Kind kind = elf_kind(elf);
+  if (kind != ELF_K_ELF)
+    xbt_die("Not an ELF file 2");
+
+  // Remember if this is a `ET_EXEC` (fixed location) or `ET_DYN` (relocatable):
+  Elf64_Half type = get_type(elf);
+  if (type == ET_EXEC)
+    info->flags |= simgrid::mc::ObjectInformation::Executable;
 
+  // Read DWARF debug information in the file:
+  Dwarf* dwarf = dwarf_begin_elf (elf, DWARF_C_READ, nullptr);
+  if (dwarf != nullptr) {
+    read_dwarf_info(info, dwarf);
+    dwarf_end(dwarf);
+    elf_end(elf);
+    close(fd);
+    return;
+  }
   dwarf_end(dwarf);
-  close(fd);
+
+  // If there was no DWARF in the file, try to find it in a separate file
+  // with NT_GNU_BUILD_ID:
+  std::vector<char> build_id = get_build_id(elf);
+  if (!build_id.empty()) {
+    elf_end(elf);
+    close(fd);
+
+    // Find the debug file using the build id:
+    std::string debug_file = find_by_build_id(build_id);
+    if (debug_file.empty()) {
+      std::string hex = to_hex(build_id);
+      xbt_die(
+        "Missing debug info for %s with build-id %s\n"
+        "You might want to install the suitable debugging package.\n",
+        info->file_name.c_str(), hex.c_str());
+    }
+
+    // Load the DWARF info from this file:
+    XBT_DEBUG("Load DWARF for %s from %s",
+      info->file_name.c_str(), debug_file.c_str());
+    fd = open(debug_file.c_str(), O_RDONLY);
+    if (fd < 0)
+      xbt_die("Could not open file %s", debug_file.c_str());
+    Dwarf* dwarf = dwarf_begin(fd, DWARF_C_READ);
+    if (dwarf == nullptr)
+      xbt_die("No DWARF info in %s for %s",
+        debug_file.c_str(), info->file_name.c_str());
+    read_dwarf_info(info, dwarf);
+    dwarf_end(dwarf);
+    close(fd);
+    return;
+  }
+
+  // TODO, try to find DWARF info using debug-link.
+  // Is this method really used anywhere?
+
+  xbt_die("Debugging information not found for %s\n"
+    "Try recompiling with -g\n",
+    info->file_name.c_str());
 }
 
 // ***** Functions index
index 9c8448d..1141a22 100644 (file)
@@ -82,7 +82,6 @@ static const char *instr_find_color (const char *state)
   return ret;
 }
 
-
 static char *smpi_container(int rank, char *container, int n)
 {
   snprintf(container, n, "rank-%d", rank);
@@ -91,7 +90,6 @@ static char *smpi_container(int rank, char *container, int n)
 
 static char *TRACE_smpi_get_key(int src, int dst, char *key, int n);
 
-
 static char *TRACE_smpi_put_key(int src, int dst, char *key, int n)
 {
   //get the dynar for src#dst
@@ -99,7 +97,6 @@ static char *TRACE_smpi_put_key(int src, int dst, char *key, int n)
   snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
   xbt_dynar_t d = static_cast<xbt_dynar_t>(xbt_dict_get_or_null(keys, aux));
 
-
   if(!xbt_dynar_is_empty(d)){
     //receive was already pushed, perform a get instead
     TRACE_smpi_get_key(src , dst, key ,n);
@@ -236,7 +233,6 @@ void TRACE_smpi_collective_in(int rank, int root, const char *operation, instr_e
    new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, (void*)extra);
 }
 
-
 void TRACE_smpi_collective_out(int rank, int root, const char *operation)
 {
   if (!TRACE_smpi_is_enabled()) return;
@@ -333,7 +329,6 @@ void TRACE_smpi_sleeping_out(int rank)
   new_pajePopState (SIMIX_get_clock(), container, type);
 }
 
-
 void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
 {
   //do not forget to set the color first, otherwise this will explode
index cf6c55c..f6245b5 100644 (file)
@@ -34,7 +34,6 @@ typedef struct s_smpi_process_data *smpi_process_data_t;
 #define RMA            0x200
 #define ACCUMULATE     0x400
 
-
 enum smpi_process_state{
   SMPI_UNINITIALIZED,
   SMPI_INITIALIZED,
@@ -64,7 +63,6 @@ typedef struct s_smpi_mpi_datatype{
   int in_use;
 } s_smpi_mpi_datatype_t;
 
-
 #define COLL_TAG_REDUCE -112
 #define COLL_TAG_SCATTER -223
 #define COLL_TAG_SCATTERV -334
@@ -81,8 +79,6 @@ typedef struct s_smpi_mpi_datatype{
 
 #define MPI_COMM_UNINITIALIZED ((MPI_Comm)-1)
 
-//*****************************************************************************************
-
 typedef struct s_smpi_mpi_request {
   void *buf;
   /* in the case of non-contiguous memory the user address should be keep
@@ -129,14 +125,12 @@ typedef struct s_smpi_mpi_info {
   int refcount;
 } s_smpi_mpi_info_t; 
 
-
 XBT_PRIVATE void smpi_process_destroy(void);
 XBT_PRIVATE void smpi_process_finalize(void);
 XBT_PRIVATE int smpi_process_finalized(void);
 XBT_PRIVATE int smpi_process_initialized(void);
 XBT_PRIVATE void smpi_process_mark_as_initialized(void);
 
-
 struct s_smpi_mpi_cart_topology;
 typedef struct s_smpi_mpi_cart_topology *MPIR_Cart_Topology;
 
@@ -152,20 +146,16 @@ XBT_PRIVATE void smpi_topo_destroy(MPI_Topology topo);
 XBT_PRIVATE MPI_Topology smpi_topo_create(MPIR_Topo_type kind);
 XBT_PRIVATE void smpi_cart_topo_destroy(MPIR_Cart_Topology cart);
 XBT_PRIVATE MPI_Topology smpi_cart_topo_create(int ndims);
-XBT_PRIVATE int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[],
-                         int periods[], int reorder, MPI_Comm *comm_cart);
+XBT_PRIVATE int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder,
+                                     MPI_Comm *comm_cart);
 XBT_PRIVATE int smpi_mpi_cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm);
-XBT_PRIVATE int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims,
-                         int coords[]);
-XBT_PRIVATE int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods,
-                      int* coords);
+XBT_PRIVATE int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]);
+XBT_PRIVATE int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords);
 XBT_PRIVATE int smpi_mpi_cart_rank(MPI_Comm comm, int* coords, int* rank);
-XBT_PRIVATE int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp,
-                        int *rank_source, int *rank_dest);
+XBT_PRIVATE int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source, int *rank_dest);
 XBT_PRIVATE int smpi_mpi_cartdim_get(MPI_Comm comm, int *ndims);
 XBT_PRIVATE int smpi_mpi_dims_create(int nnodes, int ndims, int dims[]);
 
-
 XBT_PRIVATE smpi_process_data_t smpi_process_data(void);
 XBT_PRIVATE smpi_process_data_t smpi_process_remote_data(int index);
 // smpi_process_[set/get]_user_data must be public
@@ -192,11 +182,9 @@ XBT_PRIVATE int smpi_process_get_replaying(void);
 XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm**, xbt_bar_t*);
 XBT_PRIVATE void smpi_deployment_cleanup_instances(void);
 
-XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_synchro_t comm,
-                                           void *buff, size_t buff_size);
+XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size);
 
-XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm,
-                                           void *buff, size_t buff_size);
+XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size);
 
 XBT_PRIVATE void print_request(const char *message, MPI_Request request);
 
@@ -211,46 +199,44 @@ XBT_PRIVATE size_t smpi_datatype_size(MPI_Datatype datatype);
 XBT_PRIVATE MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
 XBT_PRIVATE MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
 XBT_PRIVATE int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t);
-XBT_PRIVATE int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
-                         MPI_Aint * extent);
+XBT_PRIVATE int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent);
 XBT_PRIVATE MPI_Aint smpi_datatype_get_extent(MPI_Datatype datatype);
 XBT_PRIVATE void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length);
 XBT_PRIVATE void smpi_datatype_set_name(MPI_Datatype datatype, char* name);
-XBT_PRIVATE int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                       void *recvbuf, int recvcount,
+XBT_PRIVATE int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount,
                        MPI_Datatype recvtype);
 XBT_PRIVATE void smpi_datatype_use(MPI_Datatype type);
 XBT_PRIVATE void smpi_datatype_unuse(MPI_Datatype type);
 
-XBT_PRIVATE int smpi_datatype_contiguous(int count, MPI_Datatype old_type,
-                       MPI_Datatype* new_type, MPI_Aint lb);
-XBT_PRIVATE int smpi_datatype_vector(int count, int blocklen, int stride,
-                      MPI_Datatype old_type, MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type, MPI_Aint lb);
+XBT_PRIVATE int smpi_datatype_vector(int count, int blocklen, int stride, MPI_Datatype old_type,
+                       MPI_Datatype* new_type);
 
-XBT_PRIVATE int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride,
-                      MPI_Datatype old_type, MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_indexed(int count, int* blocklens, int* indices,
-                     MPI_Datatype old_type, MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices,
-                     MPI_Datatype old_type, MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices,
-                    MPI_Datatype* old_types, MPI_Datatype* new_type);
-
-XBT_PRIVATE void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype, void *struct_type, int flags);
+XBT_PRIVATE int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride,MPI_Datatype old_type,
+                       MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type,
+                       MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+                       MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+                       MPI_Datatype* new_type);
 
+XBT_PRIVATE void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype,
+                       void *struct_type, int flags);
 
 XBT_PRIVATE void smpi_datatype_free(MPI_Datatype* type);
 XBT_PRIVATE void smpi_datatype_commit(MPI_Datatype* datatype);
 
-XBT_PRIVATE int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm);
-XBT_PRIVATE int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm);
+XBT_PRIVATE int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type,
+                       MPI_Comm comm);
+XBT_PRIVATE int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position,
+                       MPI_Comm comm);
 
 XBT_PRIVATE void smpi_empty_status(MPI_Status * status);
 XBT_PRIVATE MPI_Op smpi_op_new(MPI_User_function * function, int commute);
 XBT_PRIVATE int smpi_op_is_commute(MPI_Op op);
 XBT_PRIVATE void smpi_op_destroy(MPI_Op op);
-XBT_PRIVATE void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
-                   MPI_Datatype * datatype);
+XBT_PRIVATE void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len, MPI_Datatype * datatype);
 
 XBT_PRIVATE MPI_Group smpi_group_new(int size);
 XBT_PRIVATE MPI_Group smpi_group_copy(MPI_Group origin);
@@ -264,7 +250,6 @@ XBT_PRIVATE int smpi_group_size(MPI_Group group);
 XBT_PRIVATE int smpi_group_compare(MPI_Group group1, MPI_Group group2);
 XBT_PRIVATE int smpi_group_incl(MPI_Group group, int n, int* ranks, MPI_Group* newgroup);
 
-
 XBT_PRIVATE MPI_Topology smpi_comm_topo(MPI_Comm comm);
 XBT_PRIVATE MPI_Comm smpi_comm_new(MPI_Group group, MPI_Topology topo);
 XBT_PRIVATE void smpi_comm_destroy(MPI_Comm comm);
@@ -301,93 +286,66 @@ XBT_PRIVATE MPI_Win smpi_win_f2c(int win);
 XBT_PRIVATE int smpi_info_c2f(MPI_Info info);
 XBT_PRIVATE MPI_Info smpi_info_f2c(int info);
 
-XBT_PRIVATE MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
-                               int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
-                               int src, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype,
-                               int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
+                                           MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag,
+                                           MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
+                                            MPI_Comm comm);
 XBT_PRIVATE void smpi_mpi_start(MPI_Request request);
 XBT_PRIVATE void smpi_mpi_startall(int count, MPI_Request * requests);
 XBT_PRIVATE void smpi_mpi_request_free(MPI_Request * request);
-XBT_PRIVATE MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
-                            int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
-                           int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_issend_init(void *buf, int count, MPI_Datatype datatype,
-                            int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype,
-                           int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
-                            int src, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
-                           int src, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype,
-                            int src, int dst, int tag, MPI_Comm comm, MPI_Op op);
-XBT_PRIVATE MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype,
-                            int src, int dst, int tag, MPI_Comm comm, MPI_Op op);
-XBT_PRIVATE void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
-                   int tag, MPI_Comm comm, MPI_Status * status);
-XBT_PRIVATE void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
-                   int tag, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst,
-                   int tag, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                       int dst, int sendtag, void *recvbuf, int recvcount,
-                       MPI_Datatype recvtype, int src, int recvtag,
-                       MPI_Comm comm, MPI_Status * status);
+XBT_PRIVATE MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_issend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag,
+                                           MPI_Comm comm, MPI_Op op);
+XBT_PRIVATE MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag,
+                                           MPI_Comm comm, MPI_Op op);
+XBT_PRIVATE void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,int tag, MPI_Comm comm,
+                               MPI_Status * status);
+XBT_PRIVATE void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag,
+                                   void *recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag,
+                                   MPI_Comm comm, MPI_Status * status);
 XBT_PRIVATE int smpi_mpi_test(MPI_Request * request, MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
-                     MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_testall(int count, MPI_Request requests[],
-                     MPI_Status status[]);
+XBT_PRIVATE int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * status);
+XBT_PRIVATE int smpi_mpi_testall(int count, MPI_Request requests[], MPI_Status status[]);
 XBT_PRIVATE void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status);
-XBT_PRIVATE void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
-                    MPI_Status* status);
+XBT_PRIVATE void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status);
 XBT_PRIVATE int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
 XBT_PRIVATE void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_waitany(int count, MPI_Request requests[],
-                     MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_waitall(int count, MPI_Request requests[],
-                      MPI_Status status[]);
-XBT_PRIVATE int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
-                      MPI_Status status[]);
-XBT_PRIVATE int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
-                      MPI_Status status[]);
-XBT_PRIVATE void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
-                    MPI_Comm comm);
+XBT_PRIVATE int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status * status);
+XBT_PRIVATE int smpi_mpi_waitall(int count, MPI_Request requests[], MPI_Status status[]);
+XBT_PRIVATE int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[]);
+XBT_PRIVATE int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[]);
+XBT_PRIVATE void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
 XBT_PRIVATE void smpi_mpi_barrier(MPI_Comm comm);
 XBT_PRIVATE void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                     void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                     int root, MPI_Comm comm);
+                     void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
 XBT_PRIVATE void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
                        MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
 XBT_PRIVATE void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                      void *recvbuf, int *recvcounts, int *displs,
-                      MPI_Datatype recvtype, int root, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_allgather(void *sendbuf, int sendcount,
-                        MPI_Datatype sendtype, void *recvbuf,
-                        int recvcount, MPI_Datatype recvtype,
-                        MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
-                         MPI_Datatype sendtype, void *recvbuf,
-                         int *recvcounts, int *displs,
-                         MPI_Datatype recvtype, MPI_Comm comm);
+                      void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                        int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                         int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm);
 XBT_PRIVATE void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                      void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                      int root, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
-                       MPI_Datatype sendtype, void *recvbuf, int recvcount,
-                       MPI_Datatype recvtype, int root, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
-                     MPI_Datatype datatype, MPI_Op op, int root,
-                     MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
-                        MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
-                   MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
-                   MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+                      void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype,
+                      void *recvbuf, int recvcount,MPI_Datatype recvtype, int root, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
+                      MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,MPI_Datatype datatype, MPI_Op op,
+                      MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
+                      MPI_Comm comm);
 
 XBT_PRIVATE int smpi_mpi_win_free( MPI_Win* win);
 
@@ -411,30 +369,20 @@ XBT_PRIVATE int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype
 XBT_PRIVATE int smpi_mpi_accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win);
 
-XBT_PRIVATE void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root,
-                     MPI_Comm comm, int arity);
+XBT_PRIVATE void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm, int arity);
 XBT_PRIVATE void nary_tree_barrier(MPI_Comm comm, int arity);
 
-XBT_PRIVATE int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount,
-                                      MPI_Datatype sendtype, void *recvbuf,
-                                      int recvcount, MPI_Datatype recvtype,
-                                      MPI_Comm comm);
-XBT_PRIVATE int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
-                                   MPI_Datatype sendtype, void *recvbuf,
-                                   int recvcount, MPI_Datatype recvtype,
-                                   MPI_Comm comm);
-XBT_PRIVATE int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
-                                          MPI_Datatype sendtype,
-                                          void *recvbuf, int recvcount,
-                                          MPI_Datatype recvtype,
-                                          MPI_Comm comm);
-XBT_PRIVATE int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
-                              int *senddisps, MPI_Datatype sendtype,
-                              void *recvbuf, int *recvcounts,
-                              int *recvdisps, MPI_Datatype recvtype,
-                              MPI_Comm comm);
-                              
-XBT_PRIVATE int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state);
+XBT_PRIVATE int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                                      int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                                   int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+                                          void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MPI_Datatype sendtype,
+                              void *recvbuf, int *recvcounts, int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm);
+
+XBT_PRIVATE int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn,
+                                        int* keyval, void* extra_state);
 XBT_PRIVATE int smpi_comm_keyval_free(int* keyval);
 XBT_PRIVATE int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag);
 XBT_PRIVATE int smpi_comm_attr_delete(MPI_Comm comm, int keyval);
@@ -442,7 +390,8 @@ XBT_PRIVATE int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value);
 XBT_PRIVATE int smpi_type_attr_delete(MPI_Datatype type, int keyval);
 XBT_PRIVATE int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag);
 XBT_PRIVATE int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value);
-XBT_PRIVATE int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state);
+XBT_PRIVATE int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn,
+                                        int* keyval, void* extra_state);
 XBT_PRIVATE int smpi_type_keyval_free(int* keyval);
 // utilities
 extern XBT_PRIVATE double smpi_cpu_threshold;
@@ -451,7 +400,6 @@ extern XBT_PRIVATE int smpi_privatize_global_variables;
 extern XBT_PRIVATE char* smpi_start_data_exe; //start of the data+bss segment of the executable
 extern XBT_PRIVATE int smpi_size_data_exe; //size of the data+bss segment of the executable
 
-
 XBT_PRIVATE void smpi_switch_data_segment(int dest);
 XBT_PRIVATE void smpi_really_switch_data_segment(int dest);
 XBT_PRIVATE int smpi_is_privatisation_file(char* file);
@@ -471,8 +419,6 @@ XBT_PRIVATE int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value,
 XBT_PRIVATE XBT_PRIVATE int smpi_comm_attr_delete(MPI_Comm comm, int keyval);
 XBT_PRIVATE int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value);
 
-
-
 // f77 wrappers
 void mpi_init_(int*);
 void mpi_finalize_(int*);
@@ -489,22 +435,14 @@ void mpi_comm_free_(int* comm, int* ierr);
 void mpi_comm_split_(int* comm, int* color, int* key, int* comm_out, int* ierr);
 void mpi_group_incl_(int* group, int* n, int* key, int* group_out, int* ierr) ;
 void mpi_comm_group_(int* comm, int* group_out,  int* ierr);
-void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag,
-                     int* comm, int* request, int* ierr);
-void mpi_isend_(void *buf, int* count, int* datatype, int* dst,
-                 int* tag, int* comm, int* request, int* ierr);
-void mpi_irsend_(void *buf, int* count, int* datatype, int* dst,
-                 int* tag, int* comm, int* request, int* ierr);
-void mpi_send_(void* buf, int* count, int* datatype, int* dst,
-                int* tag, int* comm, int* ierr);
-void mpi_rsend_(void* buf, int* count, int* datatype, int* dst,
-                int* tag, int* comm, int* ierr);
-void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag,
-                     int* comm, int* request, int* ierr);
-void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag,
-                 int* comm, int* request, int* ierr);
-void mpi_recv_(void* buf, int* count, int* datatype, int* src,
-                int* tag, int* comm, MPI_Status* status, int* ierr);
+void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr);
+void mpi_isend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr);
+void mpi_irsend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr);
+void mpi_send_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr);
+void mpi_rsend_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr);
+void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr);
+void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr);
+void mpi_recv_(void* buf, int* count, int* datatype, int* src, int* tag, int* comm, MPI_Status* status, int* ierr);
 void mpi_start_(int* request, int* ierr);
 void mpi_startall_(int* count, int* requests, int* ierr);
 void mpi_wait_(int* request, MPI_Status* status, int* ierr);
@@ -513,34 +451,24 @@ void mpi_waitall_(int* count, int* requests, MPI_Status* status, int* ierr);
 
 void mpi_barrier_(int* comm, int* ierr);
 void mpi_bcast_(void* buf, int* count, int* datatype, int* root, int* comm, int* ierr);
-void mpi_reduce_(void* sendbuf, void* recvbuf, int* count,
-                  int* datatype, int* op, int* root, int* comm, int* ierr);
-void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype,
-                     int* op, int* comm, int* ierr);
-void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
-                     int* op, int* comm, int* ierr) ;
-void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype,
-                   void* recvbuf, int* recvcount, int* recvtype,
+void mpi_reduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* ierr);
+void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
+void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* ierr) ;
+void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
                    int* root, int* comm, int* ierr);
 void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
-                   void* recvbuf, int* recvcount, int* recvtype,
-                   int* root, int* comm, int* ierr);
-void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype,
-                  void* recvbuf, int* recvcount, int* recvtype,
+                   void* recvbuf, int* recvcount, int* recvtype, int* root, int* comm, int* ierr);
+void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
                   int* root, int* comm, int* ierr);
 void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
-                  void* recvbuf, int* recvcounts, int* displs, int* recvtype,
-                  int* root, int* comm, int* ierr);
+                  void* recvbuf, int* recvcounts, int* displs, int* recvtype, int* root, int* comm, int* ierr);
 void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype,
-                     void* recvbuf, int* recvcount, int* recvtype,
-                     int* comm, int* ierr);
+                     void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
 void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype,
-                     void* recvbuf, int* recvcount,int* displs, int* recvtype,
-                     int* comm, int* ierr) ;
+                     void* recvbuf, int* recvcount,int* displs, int* recvtype, int* comm, int* ierr) ;
 void mpi_type_size_(int* datatype, int *size, int* ierr);
 
-void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype,
-                int* op, int* comm, int* ierr);
+void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
 void mpi_alltoall_(void* sendbuf, int* sendcount, int* sendtype,
                     void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
 void mpi_alltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendtype,
@@ -578,10 +506,8 @@ void mpi_put_( int *origin_addr, int* origin_count, int* origin_datatype, int* t
 void mpi_accumulate_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank,
     MPI_Aint* target_disp, int* target_count, int* target_datatype, int* op, int* win, int* ierr);
 void mpi_error_string_(int* errorcode, char* string, int* resultlen, int* ierr);
-void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst,
-                int* sendtag, void *recvbuf, int* recvcount,
-                int* recvtype, int* src, int* recvtag,
-                int* comm, MPI_Status* status, int* ierr);
+void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst, int* sendtag, void *recvbuf, int* recvcount,
+                int* recvtype, int* src, int* recvtag, int* comm, MPI_Status* status, int* ierr);
 
 void mpi_finalized_ (int * flag, int* ierr);
 void mpi_init_thread_ (int *required, int *provided, int* ierr);
@@ -627,7 +553,8 @@ void mpi_sendrecv_replace_ (void *buf, int* count, int* datatype, int* dst, int*
 void mpi_testany_ (int* count, int* requests, int *index, int *flag, MPI_Status* status, int* ierr);
 void mpi_waitsome_ (int* incount, int* requests, int *outcount, int *indices, MPI_Status* status, int* ierr);
 void mpi_reduce_local_ (void *inbuf, void *inoutbuf, int* count, int* datatype, int* op, int* ierr);
-void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm, int* ierr);
+void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm,
+                                int* ierr);
 void mpi_pack_size_ (int* incount, int* datatype, int* comm, int* size, int* ierr) ;
 void mpi_cart_coords_ (int* comm, int* rank, int* maxdims, int* coords, int* ierr) ;
 void mpi_cart_create_ (int* comm_old, int* ndims, int* dims, int* periods, int* reorder, int*  comm_cart, int* ierr) ;
@@ -657,20 +584,26 @@ void mpi_buffer_attach_ (void* buffer, int* size, int* ierr) ;
 void mpi_buffer_detach_ (void* buffer, int* size, int* ierr) ;
 void mpi_testsome_ (int* incount, int*  requests, int* outcount, int* indices, MPI_Status*  statuses, int* ierr) ;
 void mpi_comm_test_inter_ (int* comm, int* flag, int* ierr) ;
-void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm, int* ierr) ;
+void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm,
+                  int* ierr) ;
 void mpi_pack_external_size_ (char *datarep, int* incount, int* datatype, MPI_Aint *size, int* ierr);
-void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount, MPI_Aint *position, int* ierr);
-void mpi_unpack_external_ ( char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf, int* outcount, int* datatype, int* ierr);
+void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount,
+                         MPI_Aint *position, int* ierr);
+void mpi_unpack_external_ (char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf,
+                           int* outcount, int* datatype, int* ierr);
 void mpi_type_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr) ;
-void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr) ;
-void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr) ;
+void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr);
+void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int*  newtype,
+                                      int* ierr) ;
 void mpi_type_indexed_ (int* count, int* blocklens, int* indices, int* old_type, int*  newtype, int* ierr) ;
-void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices,  int* old_type,  int*newtype, int* ierr);
+void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices,  int* old_type,  int*newtype,
+                                     int* ierr);
 void mpi_type_struct_ (int* count, int* blocklens, MPI_Aint* indices, int*  old_types, int*  newtype, int* ierr) ;
-void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int*  old_types, int*  newtype, int* ierr) ;
+void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int*  old_types, int*  newtype, int* ierr);
 void mpi_ssend_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr) ;
 void mpi_ssend_init_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int*  request, int* ierr) ;
-void mpi_intercomm_create_ (int* local_comm, int* local_leader, int* peer_comm, int* remote_leader, int* tag, int*  comm_out, int* ierr) ;
+void mpi_intercomm_create_ (int* local_comm, int* local_leader, int* peer_comm, int* remote_leader, int* tag,
+                            int* comm_out, int* ierr) ;
 void mpi_intercomm_merge_ (int* comm, int* high, int*  comm_out, int* ierr) ;
 void mpi_bsend_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr) ;
 void mpi_bsend_init_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int*  request, int* ierr) ;
@@ -685,20 +618,24 @@ void mpi_rsend_init_ (void* buf, int* count, int* datatype, int* dest, int* tag,
 void mpi_keyval_create_ (void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr) ;
 void mpi_keyval_free_ (int* keyval, int* ierr) ;
 void mpi_test_cancelled_ (MPI_Status* status, int* flag, int* ierr) ;
-void mpi_pack_ (void* inbuf, int* incount, int* type, void* outbuf, int* outcount, int* position, int* comm, int* ierr) ;
+void mpi_pack_ (void* inbuf, int* incount, int* type, void* outbuf, int* outcount, int* position, int* comm, int* ierr);
 void mpi_get_elements_ (MPI_Status* status, int* datatype, int* elements, int* ierr) ;
 void mpi_dims_create_ (int* nnodes, int* ndims, int* dims, int* ierr) ;
 void mpi_iprobe_ (int* source, int* tag, int* comm, int* flag, MPI_Status* status, int* ierr) ;
-void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner, int* ierr);
-void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
+void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner,
+                              int* ierr);
+void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes,
+                             int* array_of_integers, MPI_Aint* array_of_addresses,
  int*array_of_datatypes, int* ierr);
-void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
+void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs,
+                              int* array_of_dargs, int* array_of_psizes,
  int* order, int* oldtype, int*newtype, int* ierr) ;
 void mpi_type_create_resized_ (int* oldtype,MPI_Aint* lb, MPI_Aint* extent, int*newtype, int* ierr);
-void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int* order, int* oldtype, int*newtype, int* ierr);
+void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts,
+                                int* order, int* oldtype, int*newtype, int* ierr);
 void mpi_type_match_size_ (int* typeclass,int* size,int*datatype, int* ierr);
-void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int*sendtypes, void *recvbuf, int *recvcnts, int *rdispls, int*recvtypes,
- int* comm, int* ierr);
+void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int*sendtypes, void *recvbuf, int *recvcnts,
                     int *rdispls, int*recvtypes, int* comm, int* ierr);
 void mpi_exscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
 void mpi_comm_set_name_ (int* comm, char* name, int* ierr, int size);
 void mpi_comm_dup_with_info_ (int* comm, int* info, int* newcomm, int* ierr);
@@ -731,12 +668,12 @@ void mpi_comm_join_ ( int* fd, int*intercomm, int* ierr);
 void mpi_open_port_ ( int* info, char *port_name, int* ierr);
 void mpi_close_port_ ( char *port_name, int* ierr);
 void mpi_comm_accept_ ( char *port_name, int* info, int* root, int* comm, int* newcomm, int* ierr);
-void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int*intercomm, int* array_of_errcodes, int* ierr);
-void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs, int* array_of_info, int* root,
- int* comm, int*intercomm, int* array_of_errcodes, int* ierr);
+void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int*intercomm,
+                       int* array_of_errcodes, int* ierr);
+void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs,
+                       int* array_of_info, int* root, int* comm, int*intercomm, int* array_of_errcodes, int* ierr);
 void mpi_comm_get_parent_ ( int*parent, int* ierr);
 
-
 /********** Tracing **********/
 /* from instr_smpi.c */
 XBT_PRIVATE void TRACE_internal_smpi_set_category (const char *category);
@@ -781,5 +718,4 @@ int smpi_process_index_of_smx_process(smx_process_t process) {
 }
 
 SG_END_DECL()
-
 #endif
index f2eda2f..d9ae5ee 100644 (file)
@@ -17,7 +17,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi, "Logging specific to SMPI (base)");
 
-
 static int match_recv(void* a, void* b, smx_synchro_t ignored) {
    MPI_Request ref = (MPI_Request)a;
    MPI_Request req = (MPI_Request)b;
@@ -61,7 +60,6 @@ static int match_send(void* a, void* b,smx_synchro_t ignored) {
    } else return 0;
 }
 
-
 // Methods used to parse and store the values for timing injections in smpi
 // These are taken from surf/network.c and generalized to have more values for each factor
 typedef struct s_smpi_factor_multival *smpi_os_factor_multival_t;
@@ -84,7 +82,6 @@ static int factor_cmp(const void *pa, const void *pb)
          (((s_smpi_factor_multival_t*)pa)->factor < ((s_smpi_factor_multival_t*)pb)->factor) ? -1 : 0;
 }
 
-
 static xbt_dynar_t parse_factor(const char *smpi_coef_string)
 {
   char *value = NULL;
@@ -164,13 +161,11 @@ static double smpi_ois(double size)
   unsigned int iter = 0;
   s_smpi_factor_multival_t fact;
   double current=0.0;
-  // Iterate over all the sections that were specified and find the right
-  // value. (fact.factor represents the interval sizes; we want to find the
-  // section that has fact.factor <= size and no other such fact.factor <= size)
+  // Iterate over all the sections that were specified and find the right value. (fact.factor represents the interval
+  // sizes; we want to find the section that has fact.factor <= size and no other such fact.factor <= size)
   // Note: parse_factor() (used before) already sorts the dynar we iterate over!
   xbt_dynar_foreach(smpi_ois_values, iter, fact) {
-    if (size <= fact.factor) { // Values already too large, use the previously
-                               // computed value of current!
+    if (size <= fact.factor) { // Values already too large, use the previously  computed value of current!
         XBT_DEBUG("ois : %f <= %ld return %f", size, fact.factor, current);
       return current;
     }else{
@@ -193,9 +188,8 @@ static double smpi_or(double size)
   unsigned int iter = 0;
   s_smpi_factor_multival_t fact;
   double current=0.0;
-  // Iterate over all the sections that were specified and find the right
-  // value. (fact.factor represents the interval sizes; we want to find the
-  // section that has fact.factor <= size and no other such fact.factor <= size)
+  // Iterate over all the sections that were specified and find the right value. (fact.factor represents the interval
+  // sizes; we want to find the section that has fact.factor <= size and no other such fact.factor <= size)
   // Note: parse_factor() (used before) already sorts the dynar we iterate over!
   xbt_dynar_foreach(smpi_or_values, iter, fact) {
     if (size <= fact.factor) { // Values already too large, use the previously
@@ -232,9 +226,8 @@ double smpi_mpi_wtime(){
   return time;
 }
 
-static MPI_Request build_request(void *buf, int count,
-                                 MPI_Datatype datatype, int src, int dst,
-                                 int tag, MPI_Comm comm, unsigned flags)
+static MPI_Request build_request(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
+                                 unsigned flags)
 {
   MPI_Request request = NULL;
 
@@ -254,8 +247,7 @@ static MPI_Request build_request(void *buf, int count,
   }
 
   request->buf = buf;
-  // This part handles the problem of non-contiguous memory (for the
-  // unserialisation at the reception)
+  // This part handles the problem of non-contiguous memory (for the unserialisation at the reception)
   request->old_buf = old_buf;
   request->old_type = datatype;
 
@@ -285,7 +277,6 @@ static MPI_Request build_request(void *buf, int count,
   return request;
 }
 
-
 void smpi_empty_status(MPI_Status * status)
 {
   if(status != MPI_STATUS_IGNORE) {
@@ -307,8 +298,8 @@ MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
                                int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                          comm, PERSISTENT | SEND | PREPARED);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+                          smpi_group_index(smpi_comm_group(comm), dst), tag, comm, PERSISTENT | SEND | PREPARED);
   return request;
 }
 
@@ -316,8 +307,8 @@ MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype,
                                int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                          comm, PERSISTENT | SSEND | SEND | PREPARED);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+                        smpi_group_index(smpi_comm_group(comm), dst), tag, comm, PERSISTENT | SSEND | SEND | PREPARED);
   return request;
 }
 
@@ -325,15 +316,16 @@ MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
                                int src, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
-                          comm, PERSISTENT | RECV | PREPARED);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype,
+                          src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src),
+                          smpi_process_index(), tag, comm, PERSISTENT | RECV | PREPARED);
   return request;
 }
 
 void smpi_mpi_start(MPI_Request request)
 {
   smx_mailbox_t mailbox;
-  
+
   xbt_assert(!request->action, "Cannot (re)start a non-finished communication");
   request->flags &= ~PREPARED;
   request->flags &= ~FINISHED;
@@ -350,9 +342,9 @@ void smpi_mpi_start(MPI_Request request)
 
     if (async_small_thresh == 0 && !(request->flags & RMA)) {
       mailbox = smpi_process_mailbox();
-    }
-    else if (request->flags & RMA || static_cast<int>(request->size) < async_small_thresh){
-    //We have to check both mailboxes (because SSEND messages are sent to the large mbox). begin with the more appropriate one : the small one.
+    } else if (request->flags & RMA || static_cast<int>(request->size) < async_small_thresh){
+    //We have to check both mailboxes (because SSEND messages are sent to the large mbox).
+    //begin with the more appropriate one : the small one.
       mailbox = smpi_process_mailbox_small();
       XBT_DEBUG("Is there a corresponding send already posted in the small mailbox %p (in case of SSEND)?", mailbox);
       smx_synchro_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
@@ -387,23 +379,19 @@ void smpi_mpi_start(MPI_Request request)
         simcall_process_sleep(sleeptime);
         XBT_DEBUG("receiving size of %zu : sleep %f ", request->size, smpi_or(request->size));
     }
-    
+
     // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
     request->real_size=request->size;
     smpi_datatype_use(request->old_type);
     smpi_comm_use(request->comm);
-    request->action = simcall_comm_irecv(SIMIX_process_self(), mailbox, request->buf,
-                                         &request->real_size, &match_recv,
+    request->action = simcall_comm_irecv(SIMIX_process_self(), mailbox, request->buf, &request->real_size, &match_recv,
                                          !smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
-                                         : &smpi_comm_null_copy_buffer_callback,
-                                         request, -1.0);
+                                         : &smpi_comm_null_copy_buffer_callback, request, -1.0);
         XBT_DEBUG("recv simcall posted");
 
     if (async_small_thresh != 0 || (request->flags & RMA))
       xbt_mutex_release(mut);
   } else {
-
-
     int receiver = request->dst;
 
     int rank = request->src;
@@ -411,8 +399,8 @@ void smpi_mpi_start(MPI_Request request)
       TRACE_smpi_send(rank, rank, receiver,request->size);
     }
     print_request("New send", request);
-    
-        //if we are giving back the control to the user without waiting for completion, we have to inject timings
+
+    //if we are giving back the control to the user without waiting for completion, we have to inject timings
     double sleeptime = 0.0;
     if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend
       //isend and send timings may be different
@@ -460,7 +448,8 @@ void smpi_mpi_start(MPI_Request request)
     }
 
     void* buf = request->buf;
-    if ( (! (request->flags & SSEND)) && (static_cast<int>(request->size) < sg_cfg_get_int("smpi/send_is_detached_thresh"))) {
+    if ( (! (request->flags & SSEND)) &&
+         (static_cast<int>(request->size) < sg_cfg_get_int("smpi/send_is_detached_thresh"))) {
       void *oldbuf = NULL;
       request->detached = 1;
       XBT_DEBUG("Send request %p is detached", request);
@@ -485,20 +474,15 @@ void smpi_mpi_start(MPI_Request request)
     request->real_size=request->size;
     smpi_datatype_use(request->old_type);
     smpi_comm_use(request->comm);
-    request->action =
-      simcall_comm_isend(SIMIX_process_from_PID(request->src+1), mailbox, request->size, -1.0,
-                         buf, request->real_size,
-                         &match_send,
+    request->action = simcall_comm_isend(SIMIX_process_from_PID(request->src+1), mailbox, request->size, -1.0,
+                                         buf, request->real_size, &match_send,
                          &xbt_free_f, // how to free the userdata if a detached send fails
                          !smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
-                         : &smpi_comm_null_copy_buffer_callback,
-                         request,
+                         : &smpi_comm_null_copy_buffer_callback, request,
                          // detach if msg size < eager/rdv switch limit
                          request->detached);
     XBT_DEBUG("send simcall posted");
 
-
-
     /* FIXME: detached sends are not traceable (request->action == NULL) */
     if (request->action)
       simcall_set_category(request->action, TRACE_internal_smpi_get_category());
@@ -506,15 +490,13 @@ void smpi_mpi_start(MPI_Request request)
     if (async_small_thresh != 0 || request->flags & RMA)
       xbt_mutex_release(mut);
   }
-
 }
 
 void smpi_mpi_startall(int count, MPI_Request * requests)
 {
-  int i;
   if(requests==NULL) return;
 
-  for(i = 0; i < count; i++) {
+  for(int i = 0; i < count; i++) {
     smpi_mpi_start(requests[i]);
   }
 }
@@ -537,9 +519,8 @@ void smpi_mpi_request_free(MPI_Request * request)
   }
 }
 
-
-MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype,
-                            int src, int dst, int tag, MPI_Comm comm, MPI_Op op)
+MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
+                               MPI_Op op)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
   if(op==MPI_OP_NULL){
@@ -553,8 +534,8 @@ MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype,
   return request;
 }
 
-MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype,
-                            int src, int dst, int tag, MPI_Comm comm, MPI_Op op)
+MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
+                               MPI_Op op)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
   if(op==MPI_OP_NULL){
@@ -568,57 +549,52 @@ MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype,
   return request;
 }
 
-
-MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
-                            int dst, int tag, MPI_Comm comm)
+MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf , count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                          comm, PERSISTENT | ISEND | SEND | PREPARED);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf , count, datatype, smpi_process_index(),
+                          smpi_group_index(smpi_comm_group(comm), dst), tag,comm, PERSISTENT | ISEND | SEND | PREPARED);
   return request;
 }
 
-MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
-                           int dst, int tag, MPI_Comm comm)
+MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request =  build_request(buf==MPI_BOTTOM?(void*)0:buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                           comm, NON_PERSISTENT | ISEND | SEND);
+  request =  build_request(buf==MPI_BOTTOM?(void*)0:buf, count, datatype, smpi_process_index(),
+                           smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | ISEND | SEND);
   smpi_mpi_start(request);
   return request;
 }
 
-MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype,
-                           int dst, int tag, MPI_Comm comm)
+MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                          comm, NON_PERSISTENT | ISEND | SSEND | SEND);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+                        smpi_group_index(smpi_comm_group(comm), dst), tag,comm, NON_PERSISTENT | ISEND | SSEND | SEND);
   smpi_mpi_start(request);
   return request;
 }
 
-MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
-                            int src, int tag, MPI_Comm comm)
+MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+                          smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
                           comm, PERSISTENT | RECV | PREPARED);
   return request;
 }
 
-MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
-                           int src, int tag, MPI_Comm comm)
+MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
-                          comm, NON_PERSISTENT | RECV);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+                          smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag, comm,
+                          NON_PERSISTENT | RECV);
   smpi_mpi_start(request);
   return request;
 }
 
-void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
-                   int tag, MPI_Comm comm, MPI_Status * status)
+void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
   request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
@@ -626,49 +602,41 @@ void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
   request = NULL;
 }
 
-
-
-void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
-                   int tag, MPI_Comm comm)
+void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                          comm, NON_PERSISTENT | SEND);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+                          smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | SEND);
 
   smpi_mpi_start(request);
   smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
   request = NULL;
 }
 
-void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype,
-                           int dst, int tag, MPI_Comm comm)
+void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
-  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
-                comm, NON_PERSISTENT | SSEND | SEND);
+  request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+                          smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | SSEND | SEND);
 
   smpi_mpi_start(request);
   smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
   request = NULL;
 }
 
-void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                       int dst, int sendtag, void *recvbuf, int recvcount,
-                       MPI_Datatype recvtype, int src, int recvtag,
+void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int dst, int sendtag,
+                       void *recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag,
                        MPI_Comm comm, MPI_Status * status)
 {
   MPI_Request requests[2];
   MPI_Status stats[2];
   int myid=smpi_process_index();
-  if ((smpi_group_index(smpi_comm_group(comm), dst) == myid) && (smpi_group_index(smpi_comm_group(comm), src) == myid)) {
-      smpi_datatype_copy(sendbuf, sendcount, sendtype,
-                                     recvbuf, recvcount, recvtype);
+  if ((smpi_group_index(smpi_comm_group(comm), dst) == myid) && (smpi_group_index(smpi_comm_group(comm), src) == myid)){
+      smpi_datatype_copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
       return;
   }
-  requests[0] =
-    smpi_isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm);
-  requests[1] =
-    smpi_irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
+  requests[0] = smpi_isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm);
+  requests[1] = smpi_irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
   smpi_mpi_startall(2, requests);
   smpi_mpi_waitall(2, requests, stats);
   smpi_mpi_request_free(&requests[0]);
@@ -689,16 +657,14 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
   MPI_Request req = *request;
   smpi_empty_status(status);
 
-  if(!(req->detached && req->flags & SEND)
-      && !(req->flags & PREPARED)){
+  if(!(req->detached && req->flags & SEND) && !(req->flags & PREPARED)){
     if(status != MPI_STATUS_IGNORE) {
       int src = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
       status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(req->comm), src);
       status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
       status->MPI_ERROR = req->truncated ? MPI_ERR_TRUNCATE : MPI_SUCCESS;
       // this handles the case were size in receive differs from size in send
-      // FIXME: really this should just contain the count of receive-type blocks,
-      // right?
+      // FIXME: really this should just contain the count of receive-type blocks, right?
       status->count = req->real_size;
     }
 
@@ -707,21 +673,19 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
 
     if((req->flags & ACCUMULATE) || (datatype->has_subtype == 1)){
       if (!smpi_process_get_replaying()){
-        if( smpi_privatize_global_variables
-            && ((char*)req->old_buf >= smpi_start_data_exe)
-            && ((char*)req->old_buf < smpi_start_data_exe + smpi_size_data_exe )
-        ){
+        if( smpi_privatize_global_variables && ((char*)req->old_buf >= smpi_start_data_exe)
+            && ((char*)req->old_buf < smpi_start_data_exe + smpi_size_data_exe )){
             XBT_VERB("Privatization : We are unserializing to a zone in global memory - Switch data segment ");
             smpi_switch_data_segment(smpi_process_index());
         }
       }
 
       if(datatype->has_subtype == 1){
-        // This part handles the problem of non-contignous memory
-        // the unserialization at the reception
+        // This part handles the problem of non-contignous memory the unserialization at the reception
         s_smpi_subtype_t *subtype = static_cast<s_smpi_subtype_t*>(datatype->substruct);
         if(req->flags & RECV)
-          subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) , datatype->substruct, req->op);
+          subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) ,
+                               datatype->substruct, req->op);
         if(req->detached == 0) free(req->buf);
       }else if(req->flags & RECV){//apply op on contiguous buffer for accumulate
           int n =req->real_size/smpi_datatype_size(datatype);
@@ -730,7 +694,6 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
     }
     smpi_comm_unuse(req->comm);
     smpi_datatype_unuse(datatype);
-
   }
 
   if (TRACE_smpi_view_internals()) {
@@ -749,25 +712,21 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
   req->flags |= FINISHED;
 
   smpi_mpi_request_free(request);
-
 }
 
 int smpi_mpi_test(MPI_Request * request, MPI_Status * status) {
-  int flag;
-
   //assume that request is not MPI_REQUEST_NULL (filtered in PMPI_Test or smpi_mpi_testall before)
 
   // to avoid deadlocks if used as a break condition, such as
   //     while (MPI_Test(request, flag, status) && flag) {
   //     }
-  // because the time will not normally advance when only calls to MPI_Test
-  // are made -> deadlock
+  // because the time will not normally advance when only calls to MPI_Test are made -> deadlock
   // multiplier to the sleeptime, to increase speed of execution, each failed test will increase it
   static int nsleeps = 1;
   if(smpi_test_sleep > 0)  simcall_process_sleep(nsleeps*smpi_test_sleep);
 
   smpi_empty_status(status);
-  flag = 1;
+  int flag = 1;
   if (!((*request)->flags & PREPARED)) {
     if ((*request)->action != NULL)
       flag = simcall_comm_test((*request)->action);
@@ -783,8 +742,7 @@ int smpi_mpi_test(MPI_Request * request, MPI_Status * status) {
   return flag;
 }
 
-int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
-                     MPI_Status * status)
+int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * status)
 {
   xbt_dynar_t comms;
   int i, flag, size;
@@ -796,8 +754,7 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
   map = xbt_new(int, count);
   size = 0;
   for(i = 0; i < count; i++) {
-    if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action &&
-        !(requests[i]->flags & PREPARED)) {
+    if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action && !(requests[i]->flags & PREPARED)) {
        xbt_dynar_push(comms, &requests[i]->action);
        map[size] = i;
        size++;
@@ -831,9 +788,7 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
   return flag;
 }
 
-
-int smpi_mpi_testall(int count, MPI_Request requests[],
-                     MPI_Status status[])
+int smpi_mpi_testall(int count, MPI_Request requests[], MPI_Status status[])
 {
   MPI_Status stat;
   MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
@@ -868,8 +823,8 @@ void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status){
 
 void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status){
 
-  MPI_Request request =build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), source), smpi_comm_rank(comm), tag,
-            comm, PERSISTENT | RECV);
+  MPI_Request request =build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+                 smpi_group_index(smpi_comm_group(comm), source), smpi_comm_rank(comm), tag, comm, PERSISTENT | RECV);
 
   // to avoid deadlock, we have to sleep some time here, or the timer won't advance and we will only do iprobe simcalls
   // (especially when used as a break condition, such as while(MPI_Iprobe(...)) ... )
@@ -924,7 +879,8 @@ void smpi_mpi_wait(MPI_Request * request, MPI_Status * status)
     simcall_comm_wait((*request)->action, -1.0);
 
   if((MC_is_active() || MC_record_replay_is_active()) && (*request)->action)
-    (*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to NULL for system state comparison
+    (*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to
+                                              // NULL for system state comparison
   }
 
   finish_wait(request, status);
@@ -933,8 +889,7 @@ void smpi_mpi_wait(MPI_Request * request, MPI_Status * status)
   // FIXME for a detached send, finish_wait is not called:
 }
 
-int smpi_mpi_waitany(int count, MPI_Request requests[],
-                     MPI_Status * status)
+int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status * status)
 {
   xbt_dynar_t comms;
   int i, size, index;
@@ -948,9 +903,7 @@ int smpi_mpi_waitany(int count, MPI_Request requests[],
     size = 0;
     XBT_DEBUG("Wait for one of %d", count);
     for(i = 0; i < count; i++) {
-      if (requests[i] != MPI_REQUEST_NULL
-          && !(requests[i]->flags & PREPARED)
-          && !(requests[i]->flags & FINISHED)) {
+      if (requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags & PREPARED) && !(requests[i]->flags & FINISHED)) {
         if (requests[i]->action != NULL) {
           XBT_DEBUG("Waiting any %p ", requests[i]);
           xbt_dynar_push(comms, &requests[i]->action);
@@ -988,8 +941,7 @@ int smpi_mpi_waitany(int count, MPI_Request requests[],
   return index;
 }
 
-int smpi_mpi_waitall(int count, MPI_Request requests[],
-                      MPI_Status status[])
+int smpi_mpi_waitall(int count, MPI_Request requests[], MPI_Status status[])
 {
   int  index, c;
   MPI_Status stat;
@@ -998,8 +950,7 @@ int smpi_mpi_waitall(int count, MPI_Request requests[],
   //tag invalid requests in the set
   if (status != MPI_STATUSES_IGNORE) {
     for (c = 0; c < count; c++) {
-      if (requests[c] == MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL ||
-          (requests[c]->flags & PREPARED)) {
+      if (requests[c] == MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL || (requests[c]->flags & PREPARED)) {
         smpi_empty_status(&status[c]);
       } else if (requests[c]->src == MPI_PROC_NULL) {
         smpi_empty_status(&status[c]);
@@ -1029,8 +980,7 @@ int smpi_mpi_waitall(int count, MPI_Request requests[],
   return retvalue;
 }
 
-int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
-                      MPI_Status status[])
+int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[])
 {
   int i, count, index;
   MPI_Status stat;
@@ -1055,8 +1005,7 @@ int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
   return count;
 }
 
-int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
-                      MPI_Status status[])
+int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[])
 {
   int i, count, count_dead;
   MPI_Status stat;
@@ -1083,8 +1032,7 @@ int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
   else return count;
 }
 
-void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
-                    MPI_Comm comm)
+void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
 {
     smpi_coll_tuned_bcast_binomial_tree(buf, count, datatype, root, comm);
 }
@@ -1095,8 +1043,7 @@ void smpi_mpi_barrier(MPI_Comm comm)
 }
 
 void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                     void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                     int root, MPI_Comm comm)
+                     void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_GATHER;
   int rank, size, src, index;
@@ -1112,15 +1059,13 @@ void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     // FIXME: check for errors
     smpi_datatype_extent(recvtype, &lb, &recvext);
     // Local copy from root
-    smpi_datatype_copy(sendbuf, sendcount, sendtype,
-                       (char *)recvbuf + root * recvcount * recvext, recvcount, recvtype);
+    smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + root * recvcount * recvext, recvcount, recvtype);
     // Receive buffers from senders
     requests = xbt_new(MPI_Request, size - 1);
     index = 0;
     for(src = 0; src < size; src++) {
       if(src != root) {
-        requests[index] = smpi_irecv_init((char *)recvbuf + src * recvcount * recvext,
-                                          recvcount, recvtype,
+        requests[index] = smpi_irecv_init((char *)recvbuf + src * recvcount * recvext, recvcount, recvtype,
                                           src, system_tag, comm);
         index++;
       }
@@ -1135,9 +1080,8 @@ void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   }
 }
 
-
-void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
-                       MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op,
+                             MPI_Comm comm)
 {
     int i, size, count;
     int *displs;
@@ -1155,14 +1099,12 @@ void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
     tmpbuf=(void*)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
 
     mpi_coll_reduce_fun(sendbuf, tmpbuf, count, datatype, op, 0, comm);
-    smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf,
-                      recvcounts[rank], datatype, 0, comm);
+    smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf, recvcounts[rank], datatype, 0, comm);
     xbt_free(displs);
     smpi_free_tmp_buffer(tmpbuf);
 }
 
-void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                      void *recvbuf, int *recvcounts, int *displs,
+void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
                       MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_GATHERV;
@@ -1179,16 +1121,14 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     // FIXME: check for errors
     smpi_datatype_extent(recvtype, &lb, &recvext);
     // Local copy from root
-    smpi_datatype_copy(sendbuf, sendcount, sendtype,
-                       (char *)recvbuf + displs[root] * recvext,
+    smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + displs[root] * recvext,
                        recvcounts[root], recvtype);
     // Receive buffers from senders
     requests = xbt_new(MPI_Request, size - 1);
     index = 0;
     for(src = 0; src < size; src++) {
       if(src != root) {
-        requests[index] =
-          smpi_irecv_init((char *)recvbuf + displs[src] * recvext,
+        requests[index] = smpi_irecv_init((char *)recvbuf + displs[src] * recvext,
                           recvcounts[src], recvtype, src, system_tag, comm);
         index++;
       }
@@ -1203,10 +1143,8 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   }
 }
 
-void smpi_mpi_allgather(void *sendbuf, int sendcount,
-                        MPI_Datatype sendtype, void *recvbuf,
-                        int recvcount, MPI_Datatype recvtype,
-                        MPI_Comm comm)
+void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+                        void *recvbuf,int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_ALLGATHER;
   int rank, size, other, index;
@@ -1218,20 +1156,15 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount,
   // FIXME: check for errors
   smpi_datatype_extent(recvtype, &lb, &recvext);
   // Local copy from self
-  smpi_datatype_copy(sendbuf, sendcount, sendtype,
-                     (char *)recvbuf + rank * recvcount * recvext, recvcount,
-                     recvtype);
+  smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + rank * recvcount * recvext, recvcount, recvtype);
   // Send/Recv buffers to/from others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
   index = 0;
   for(other = 0; other < size; other++) {
     if(other != rank) {
-      requests[index] =
-        smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,
-                        comm);
+      requests[index] = smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,comm);
       index++;
-      requests[index] = smpi_irecv_init((char *)recvbuf + other * recvcount * recvext,
-                                        recvcount, recvtype, other,
+      requests[index] = smpi_irecv_init((char *)recvbuf + other * recvcount * recvext, recvcount, recvtype, other,
                                         system_tag, comm);
       index++;
     }
@@ -1245,10 +1178,8 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount,
   xbt_free(requests);
 }
 
-void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
-                         MPI_Datatype sendtype, void *recvbuf,
-                         int *recvcounts, int *displs,
-                         MPI_Datatype recvtype, MPI_Comm comm)
+void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                         int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_ALLGATHERV;
   int rank, size, other, index;
@@ -1260,21 +1191,17 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
   // FIXME: check for errors
   smpi_datatype_extent(recvtype, &lb, &recvext);
   // Local copy from self
-  smpi_datatype_copy(sendbuf, sendcount, sendtype,
-                     (char *)recvbuf + displs[rank] * recvext,
-                     recvcounts[rank], recvtype);
+  smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + displs[rank] * recvext,recvcounts[rank], recvtype);
   // Send buffers to others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
   index = 0;
   for(other = 0; other < size; other++) {
     if(other != rank) {
       requests[index] =
-        smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,
-                        comm);
+        smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag, comm);
       index++;
-      requests[index] =
-        smpi_irecv_init((char *)recvbuf + displs[other] * recvext, recvcounts[other],
-                        recvtype, other, system_tag, comm);
+      requests[index] = smpi_irecv_init((char *)recvbuf + displs[other] * recvext, recvcounts[other],
+                          recvtype, other, system_tag, comm);
       index++;
     }
   }
@@ -1288,8 +1215,7 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
 }
 
 void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                      void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                      int root, MPI_Comm comm)
+                      void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_SCATTER;
   int rank, size, dst, index;
@@ -1300,8 +1226,7 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   size = smpi_comm_size(comm);
   if(rank != root) {
     // Recv buffer from root
-    smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm,
-                  MPI_STATUS_IGNORE);
+    smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE);
   } else {
     // FIXME: check for errors
     smpi_datatype_extent(sendtype, &lb, &sendext);
@@ -1315,8 +1240,7 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     index = 0;
     for(dst = 0; dst < size; dst++) {
       if(dst != root) {
-        requests[index] = smpi_isend_init((char *)sendbuf + dst * sendcount * sendext,
-                                          sendcount, sendtype, dst,
+        requests[index] = smpi_isend_init((char *)sendbuf + dst * sendcount * sendext, sendcount, sendtype, dst,
                                           system_tag, comm);
         index++;
       }
@@ -1331,8 +1255,7 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   }
 }
 
-void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
-                       MPI_Datatype sendtype, void *recvbuf, int recvcount,
+void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount,
                        MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_SCATTERV;
@@ -1344,8 +1267,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
   size = smpi_comm_size(comm);
   if(rank != root) {
     // Recv buffer from root
-    smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm,
-                  MPI_STATUS_IGNORE);
+    smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE);
   } else {
     // FIXME: check for errors
     smpi_datatype_extent(sendtype, &lb, &sendext);
@@ -1359,9 +1281,8 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
     index = 0;
     for(dst = 0; dst < size; dst++) {
       if(dst != root) {
-        requests[index] =
-          smpi_isend_init((char *)sendbuf + displs[dst] * sendext, sendcounts[dst],
-                          sendtype, dst, system_tag, comm);
+        requests[index] = smpi_isend_init((char *)sendbuf + displs[dst] * sendext, sendcounts[dst],
+                            sendtype, dst, system_tag, comm);
         index++;
       }
     }
@@ -1375,8 +1296,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
   }
 }
 
-void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
-                     MPI_Datatype datatype, MPI_Op op, int root,
+void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
                      MPI_Comm comm)
 {
   int system_tag = COLL_TAG_REDUCE;
@@ -1385,7 +1305,6 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
   MPI_Request *requests;
   void **tmpbufs;
 
-
   char* sendtmpbuf = (char*) sendbuf;
   if( sendbuf == MPI_IN_PLACE ) {
     sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
@@ -1396,8 +1315,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
   size = smpi_comm_size(comm);
   //non commutative case, use a working algo from openmpi
   if(!smpi_op_is_commute(op)){
-    smpi_coll_tuned_reduce_ompi_basic_linear(sendtmpbuf, recvbuf, count,
-                     datatype, op, root, comm);
+    smpi_coll_tuned_reduce_ompi_basic_linear(sendtmpbuf, recvbuf, count, datatype, op, root, comm);
     return;
   }
   
@@ -1424,8 +1342,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
          else
            tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
         requests[index] =
-          smpi_irecv_init(tmpbufs[index], count, datatype, src,
-                          system_tag, comm);
+          smpi_irecv_init(tmpbufs[index], count, datatype, src, system_tag, comm);
         index++;
       }
     }
@@ -1454,15 +1371,13 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
   }
 }
 
-void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
-                        MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
   smpi_mpi_bcast(recvbuf, count, datatype, 0, comm);
 }
 
-void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
-                   MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   int system_tag = -888;
   int rank, size, other, index;
@@ -1487,14 +1402,11 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
     // FIXME: possibly overkill we we have contiguous/noncontiguous data
     // mapping...
     tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
-    requests[index] =
-      smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
-                      comm);
+    requests[index] = smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag, comm);
     index++;
   }
   for(other = rank + 1; other < size; other++) {
-    requests[index] =
-      smpi_isend_init(sendbuf, count, datatype, other, system_tag, comm);
+    requests[index] = smpi_isend_init(sendbuf, count, datatype, other, system_tag, comm);
     index++;
   }
   // Wait for completion of all comms.
@@ -1530,8 +1442,7 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
   xbt_free(requests);
 }
 
-void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
-                   MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   int system_tag = -888;
   int rank, size, other, index;
@@ -1554,8 +1465,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
     // mapping...
     tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
     requests[index] =
-      smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
-                      comm);
+      smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag, comm);
     index++;
   }
   for(other = rank + 1; other < size; other++) {
index bbc31dc..e5d3510 100644 (file)
@@ -35,8 +35,7 @@
 #define MAP_ANONYMOUS MAP_ANON
 #endif
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi,
-                                "Logging specific to SMPI (benchmarking)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi, "Logging specific to SMPI (benchmarking)");
 
 /* Shared allocations are handled through shared memory segments.
  * Associated data and metadata are used as follows:
@@ -88,8 +87,7 @@ namespace {
 
 /** Some location in the source code
  *
- *  This information is used by SMPI_SHARED_MALLOC to allocate
- *  some shared memory for all simulated processes.
+ *  This information is used by SMPI_SHARED_MALLOC to allocate  some shared memory for all simulated processes.
  */
 class smpi_source_location {
 public:
@@ -300,7 +298,6 @@ int smpi_usleep(useconds_t usecs)
   return (int)private_sleep((double)usecs / 1000000.0);
 }
 
-
 int smpi_gettimeofday(struct timeval *tv, void* tz)
 {
   double now;
@@ -357,6 +354,7 @@ static char *sample_location(int global, const char *file, int line) {
     return bprintf("%s:%d:%d", file, line, smpi_process_index());
   }
 }
+
 static int sample_enough_benchs(local_data_t *data) {
   int res = data->count >= data->iters;
   if (data->threshold>0.0) {
@@ -366,8 +364,7 @@ static int sample_enough_benchs(local_data_t *data) {
       res = 0; // stderr too high yet
   }
   XBT_DEBUG("%s (count:%d iter:%d stderr:%f thres:%f mean:%fs)",
-      (res?"enough benchs":"need more data"),
-      data->count, data->iters, data->relstderr, data->threshold, data->mean);
+      (res?"enough benchs":"need more data"), data->count, data->iters, data->relstderr, data->threshold, data->mean);
   return res;
 }
 
@@ -398,14 +395,17 @@ void smpi_sample_1(int global, const char *file, int line, int iters, double thr
     XBT_DEBUG("XXXXX First time ever on benched nest %s.",loc);
   } else {
     if (data->iters != iters || data->threshold != threshold) {
-      XBT_ERROR("Asked to bench block %s with different settings %d, %f is not %d, %f. How did you manage to give two numbers at the same line??",
-          loc, data->iters, data->threshold, iters,threshold);
+      XBT_ERROR("Asked to bench block %s with different settings %d, %f is not %d, %f. "
+                "How did you manage to give two numbers at the same line??",
+                loc, data->iters, data->threshold, iters,threshold);
       THROW_IMPOSSIBLE;
     }
 
-    // if we already have some data, check whether sample_2 should get one more bench or whether it should emulate the computation instead
+    // if we already have some data, check whether sample_2 should get one more bench or whether it should emulate
+    // the computation instead
     data->benching = !sample_enough_benchs(data);
-    XBT_DEBUG("XXXX Re-entering the benched nest %s. %s",loc, (data->benching?"more benching needed":"we have enough data, skip computes"));
+    XBT_DEBUG("XXXX Re-entering the benched nest %s. %s",loc,
+             (data->benching?"more benching needed":"we have enough data, skip computes"));
   }
   xbt_free(loc);
 }
@@ -427,10 +427,10 @@ int smpi_sample_2(int global, const char *file, int line)
         data->count, data->iters, data->relstderr, data->threshold, data->mean);
     res = 1;
   } else {
-    // Enough data, no more bench (either we got enough data from previous visits to this benched nest, or we just ran one bench and need to bail out now that our job is done).
-    // Just sleep instead
-    XBT_DEBUG("No benchmark (either no need, or just ran one): count >= iter (%d >= %d) or stderr<thres (%f<=%f). apply the %fs delay instead",
-        data->count, data->iters, data->relstderr, data->threshold, data->mean);
+    // Enough data, no more bench (either we got enough data from previous visits to this benched nest, or we just
+    //ran one bench and need to bail out now that our job is done). Just sleep instead
+    XBT_DEBUG("No benchmark (either no need, or just ran one): count >= iter (%d >= %d) or stderr<thres (%f<=%f)."
+              " apply the %fs delay instead", data->count, data->iters, data->relstderr, data->threshold, data->mean);
     smpi_execute(data->mean);
     smpi_process_set_sampling(0);
     res = 0; // prepare to capture future, unrelated computations
@@ -439,7 +439,6 @@ int smpi_sample_2(int global, const char *file, int line)
   return res;
 }
 
-
 void smpi_sample_3(int global, const char *file, int line)
 {
   char *loc = sample_location(global, file, line);
@@ -467,7 +466,8 @@ void smpi_sample_3(int global, const char *file, int line)
   data->mean = data->sum / n;
   data->relstderr = sqrt((data->sum_pow2 / n - data->mean * data->mean) / n) / data->mean;
   if (!sample_enough_benchs(data)) {
-    data->mean = sample; // Still in benching process; We want sample_2 to simulate the exact time of this loop occurrence before leaving, not the mean over the history
+    data->mean = sample; // Still in benching process; We want sample_2 to simulate the exact time of this loop
+                         // occurrence before leaving, not the mean over the history
   }
   XBT_DEBUG("Average mean after %d steps is %f, relative standard error is %f (sample was %f)", data->count,
       data->mean, data->relstderr, sample);
@@ -491,8 +491,7 @@ void *smpi_shared_malloc(size_t size, const char *file, int line)
       // Generate a shared memory name from the address of the shared_data:
       char shmname[32]; // cannot be longer than PSHMNAMLEN = 31 on Mac OS X (shm_open raises ENAMETOOLONG otherwise)
       snprintf(shmname, 31, "/shmalloc%p", &*data);
-      fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL,
-                    S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+      fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
       if (fd < 0) {
         switch(errno) {
           case EEXIST:
@@ -597,16 +596,10 @@ void* smpi_shared_set_call(const char* func, const char* input, void* data) {
    return data;
 }
 
-
-
-
 #define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
 
-
-/** Map a given SMPI privatization segment (make a SMPI process active)
- */
+/** Map a given SMPI privatization segment (make a SMPI process active) */
 void smpi_switch_data_segment(int dest){
-
   if (smpi_loaded_page==dest)//no need to switch either
    return;
 
@@ -614,24 +607,19 @@ void smpi_switch_data_segment(int dest){
   smpi_really_switch_data_segment(dest);
 }
 
-/** Map a given SMPI privatization segment (make a SMPI process active)
- *  even if SMPI thinks it is already active
+/** Map a given SMPI privatization segment (make a SMPI process active)  even if SMPI thinks it is already active
  *
- *  When doing a state restoration, the state of the restored variables
- *  might not be consistent with the state of the virtual memory.
- *  In this case, we to change the data segment.
+ *  When doing a state restoration, the state of the restored variables  might not be consistent with the state of the
+ *  virtual memory. In this case, we to change the data segment.
  */
 void smpi_really_switch_data_segment(int dest) {
-
   if(smpi_size_data_exe == 0)//no need to switch
     return;
 
 #ifdef HAVE_PRIVATIZATION
-  int i;
   if(smpi_loaded_page==-1){//initial switch, do the copy from the real page here
-    for (i=0; i< smpi_process_count(); i++){
-      memcpy(smpi_privatisation_regions[i].address,
-        TOPAGE(smpi_start_data_exe), smpi_size_data_exe);
+    for (int i=0; i< smpi_process_count(); i++){
+      memcpy(smpi_privatisation_regions[i].address, TOPAGE(smpi_start_data_exe), smpi_size_data_exe);
     }
   }
 
@@ -659,21 +647,19 @@ void smpi_initialize_global_memory_segments(){
   return;
 #else
 
-  int i = 0;
   smpi_get_executable_global_size();
 
-  XBT_DEBUG ("bss+data segment found : size %d starting at %p",
-    smpi_size_data_exe, smpi_start_data_exe );
+  XBT_DEBUG ("bss+data segment found : size %d starting at %p", smpi_size_data_exe, smpi_start_data_exe );
 
   if (smpi_size_data_exe == 0){//no need to switch
     smpi_privatize_global_variables=0;
     return;
   }
 
-  smpi_privatisation_regions = (smpi_privatisation_region_t) malloc(
-    smpi_process_count() * sizeof(struct s_smpi_privatisation_region));
+  smpi_privatisation_regions =
+    (smpi_privatisation_region_t) malloc(smpi_process_count() * sizeof(struct s_smpi_privatisation_region));
 
-  for (i=0; i< smpi_process_count(); i++){
+  for (int i=0; i< smpi_process_count(); i++){
       //create SIMIX_process_count() mappings of this size with the same data inside
       void *address = NULL;
       char path[] = "/dev/shm/my-buffer-XXXXXX";
@@ -720,9 +706,7 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt
       smpi_privatisation_regions[i].file_descriptor = file_descriptor;
       smpi_privatisation_regions[i].address = address;
   }
-
 #endif
-
 }
 
 void smpi_destroy_global_memory_segments(){
@@ -732,12 +716,10 @@ void smpi_destroy_global_memory_segments(){
   int i;
   for (i=0; i< smpi_process_count(); i++){
     if(munmap(smpi_privatisation_regions[i].address, smpi_size_data_exe) < 0) {
-      XBT_WARN("Unmapping of fd %d failed: %s",
-        smpi_privatisation_regions[i].file_descriptor, strerror(errno));
+      XBT_WARN("Unmapping of fd %d failed: %s", smpi_privatisation_regions[i].file_descriptor, strerror(errno));
     }
     close(smpi_privatisation_regions[i].file_descriptor);
   }
   xbt_free(smpi_privatisation_regions);
 #endif
-
 }
index faa8d3c..1df9861 100644 (file)
 #include "colls/colls.h"
 #include "simgrid/sg_config.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi,
-                                "Logging specific to SMPI (coll)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll)");
 
 s_mpi_coll_description_t mpi_coll_gather_description[] = {
-  {"default",
-   "gather default collective",
-   (void*)smpi_mpi_gather},
-COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA),
-  {NULL, NULL, NULL}      /* this array must be NULL terminated */
+  {"default", "gather default collective", (void*)smpi_mpi_gather},
+   COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA), {NULL, NULL, NULL}      /* this array must be NULL terminated */
 };
 
 
index c3937c2..a4f0468 100644 (file)
 #include "colls/colls.h"
 #include "xbt/ex.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi,
-                                "Logging specific to SMPI (comm)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)");
 
 xbt_dict_t smpi_comm_keyvals = NULL;
 int comm_keyval_id = 0;//avoid collisions
 
-/* Support for cartesian topology was added, but there are 2 other types of
- * topology, graph et dist graph. In order to support them, we have to add a
- * field MPIR_Topo_type, and replace the MPI_Topology field by an union. */
+/* Support for cartesian topology was added, but there are 2 other types of topology, graph et dist graph. In order to
+ * support them, we have to add a field MPIR_Topo_type, and replace the MPI_Topology field by an union. */
 
 typedef struct s_smpi_mpi_communicator {
   MPI_Group group;
@@ -89,7 +87,7 @@ void smpi_comm_destroy(MPI_Comm comm)
 }
 
 int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){
-  if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process_index());
    }
   (*newcomm) = smpi_comm_new(smpi_comm_group(comm), smpi_comm_topo(comm));
@@ -121,7 +119,8 @@ int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){
       void* value_in;
       void* value_out;
       xbt_dict_foreach(comm->attributes, cursor, key, value_in){
-        smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)key, sizeof(int)));
+        smpi_comm_key_elem elem =
+           static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)key, sizeof(int)));
         if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){
           ret = elem->copy_fn(comm, *key, NULL, value_in, &value_out, &flag );
           if(ret!=MPI_SUCCESS){
@@ -137,12 +136,10 @@ int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){
   return ret;
 }
 
-
 MPI_Group smpi_comm_group(MPI_Comm comm)
 {
   if (comm == MPI_COMM_UNINITIALIZED)
     comm = smpi_process_comm_world();
-
   return comm->group;
 }
 
@@ -156,7 +153,6 @@ int smpi_comm_size(MPI_Comm comm)
 {
   if (comm == MPI_COMM_UNINITIALIZED)
     comm = smpi_process_comm_world();
-
   return smpi_group_size(smpi_comm_group(comm));
 }
 
@@ -333,7 +329,8 @@ void smpi_comm_unuse(MPI_Comm comm){
       void * value;
       int flag;
       xbt_dict_foreach(comm->attributes, cursor, key, value){
-        smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
+        smpi_comm_key_elem elem =
+           static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
         if(elem &&  elem->delete_fn)
           elem->delete_fn(comm, *key, value, &flag);
       }
@@ -342,8 +339,7 @@ void smpi_comm_unuse(MPI_Comm comm){
   }
 }
 
-static int
-compare_ints (const void *a, const void *b)
+static int compare_ints (const void *a, const void *b)
 {
   const int *da = (const int *) a;
   const int *db = (const int *) b;
@@ -360,15 +356,14 @@ void smpi_comm_init_smp(MPI_Comm comm){
   int comm_size =smpi_comm_size(comm);
   
   // If we are in replay - perform an ugly hack  
-  // say to SimGrid that we are not in replay for a while, because we need 
-  // the buffers to be copied for the following calls
+  // tell SimGrid we are not in replay for a while, because we need the buffers to be copied for the following calls
   int replaying = 0; //cache data to set it back again after
   if(smpi_process_get_replaying()){
    replaying=1;
    smpi_process_set_replaying(0);
   }
 
-  if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process_index());
    }
   //identify neighbours in comm
@@ -382,8 +377,6 @@ void smpi_comm_init_smp(MPI_Comm comm){
 //      smpi_process_set_comm_intra(MPI_COMM_SELF);
 //      return;
 //  }
-
-
   int i =0;
   int min_index=INT_MAX;//the minimum index will be the leader
   smx_process_t process = NULL;
@@ -412,12 +405,10 @@ void smpi_comm_init_smp(MPI_Comm comm){
     }
   }
 
-
   MPI_Comm comm_intra = smpi_comm_new(group_intra, NULL);
   //MPI_Comm shmem_comm = smpi_process_comm_intra();
   //int intra_rank = smpi_comm_rank(shmem_comm);
 
-
   //if(smpi_process_index()==min_index)
   leader=min_index;
 
@@ -429,10 +420,10 @@ void smpi_comm_init_smp(MPI_Comm comm){
 
   smpi_coll_tuned_allgather_mpich(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, comm);
 
-  if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process_index());
    }
-   
+
   if(!comm->leaders_map){
     comm->leaders_map= leaders_map;
   }else{
@@ -456,7 +447,6 @@ void smpi_comm_init_smp(MPI_Comm comm){
 
   MPI_Group leaders_group = smpi_group_new(leader_group_size);
 
-
   MPI_Comm leader_comm = MPI_COMM_NULL;
   if(MPI_COMM_WORLD!=MPI_COMM_UNINITIALIZED && comm!=MPI_COMM_WORLD){
     //create leader_communicator
@@ -466,7 +456,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
     smpi_comm_set_leaders_comm(comm, leader_comm);
     smpi_comm_set_intra_comm(comm, comm_intra);
 
-    //create intracommunicator
+   //create intracommunicator
    // smpi_comm_set_intra_comm(comm, smpi_comm_split(comm, *(int*)SIMIX_host_self(), comm_rank));
   }else{
     for (i=0; i< leader_group_size;i++)
@@ -501,7 +491,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
   }
   smpi_coll_tuned_bcast_mpich(&(comm->is_uniform),1, MPI_INT, 0, comm_intra );
 
-  if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+  if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process_index());
    }
   // Are the ranks blocked ? = allocated contiguously on the SMP nodes
@@ -517,8 +507,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
   }
 
   int global_blocked;
-  smpi_mpi_allreduce(&is_blocked, &(global_blocked), 1,
-            MPI_INT, MPI_LAND, comm);
+  smpi_mpi_allreduce(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, comm);
 
   if(MPI_COMM_WORLD==MPI_COMM_UNINITIALIZED || comm==MPI_COMM_WORLD){
     if(smpi_comm_rank(comm)==0){
@@ -534,7 +523,8 @@ void smpi_comm_init_smp(MPI_Comm comm){
 }
 
 int smpi_comm_attr_delete(MPI_Comm comm, int keyval){
-  smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
+  smpi_comm_key_elem elem =
+     static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
   if(!elem)
     return MPI_ERR_ARG;
   if(elem->delete_fn!=MPI_NULL_DELETE_FN){
@@ -544,7 +534,7 @@ int smpi_comm_attr_delete(MPI_Comm comm, int keyval){
       int ret = elem->delete_fn(comm, keyval, value, &flag);
       if(ret!=MPI_SUCCESS) return ret;
     }
-  }  
+  }
   if(comm->attributes==NULL)
     return MPI_ERR_ARG;
 
@@ -553,7 +543,8 @@ int smpi_comm_attr_delete(MPI_Comm comm, int keyval){
 }
 
 int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){
-  smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
+  smpi_comm_key_elem elem =
+    static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
   if(!elem)
     return MPI_ERR_ARG;
   xbt_ex_t ex;
@@ -564,8 +555,7 @@ int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){
   TRY {
     *(void**)attr_value = xbt_dict_get_ext(comm->attributes,  (const char*)&keyval, sizeof(int));
     *flag=1;
-  }
-  CATCH(ex) {
+  } CATCH(ex) {
     *flag=0;
     xbt_ex_free(ex);
   }
@@ -575,7 +565,8 @@ int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){
 int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){
   if(!smpi_comm_keyvals)
   smpi_comm_keyvals = xbt_dict_new();
-  smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals,  (const char*)&keyval, sizeof(int)));
+  smpi_comm_key_elem elem =
+    static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals,  (const char*)&keyval, sizeof(int)));
   if(!elem )
     return MPI_ERR_ARG;
   int flag;
@@ -592,16 +583,16 @@ int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){
   return MPI_SUCCESS;
 }
 
-int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state){
-
+int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+                            void* extra_state){
   if(!smpi_comm_keyvals)
   smpi_comm_keyvals = xbt_dict_new();
-  
+
   smpi_comm_key_elem value = (smpi_comm_key_elem) xbt_new0(s_smpi_mpi_comm_key_elem_t,1);
-  
+
   value->copy_fn=copy_fn;
   value->delete_fn=delete_fn;
-  
+
   *keyval = comm_keyval_id;
   xbt_dict_set_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int),(void*)value, NULL);
   comm_keyval_id++;
@@ -609,7 +600,8 @@ int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delet
 }
 
 int smpi_comm_keyval_free(int* keyval){
-  smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals,  (const char*)keyval, sizeof(int)));
+  smpi_comm_key_elem elem =
+     static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals,  (const char*)keyval, sizeof(int)));
   if(!elem){
     return MPI_ERR_ARG;
   }
index e832caa..b1b0575 100644 (file)
@@ -23,21 +23,19 @@ typedef struct s_smpi_mpi_instance{
   xbt_bar_t finalization_barrier;
 } s_smpi_mpi_instance_t;
 
-
 /** \ingroup smpi_simulation
  * \brief Registers a running instance of a MPI program.
  *
  * FIXME : remove MSG from the loop at some point.
  * \param name the reference name of the function.
- * \param code the main mpi function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[]))
+ * \param code the main mpi function (must have a int ..(int argc, char *argv[])) prototype
  * \param num_processes the size of the instance we want to deploy
  */
 void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes)
 {
   SIMIX_function_register(name, code);
 
-  s_smpi_mpi_instance_t* instance =
-      (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t));
+  s_smpi_mpi_instance_t* instance = (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t));
 
   instance->name = name;
   instance->size = num_processes;
@@ -56,7 +54,6 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
   return;
 }
 
-
 //get the index of the process in the process_data array
 void smpi_deployment_register_process(const char* instance_id, int rank, int index,MPI_Comm** comm, xbt_bar_t* bar){
 
@@ -67,7 +64,8 @@ void smpi_deployment_register_process(const char* instance_id, int rank, int ind
     return;
   }
 
-  s_smpi_mpi_instance_t* instance = static_cast<s_smpi_mpi_instance_t*>(xbt_dict_get_or_null(smpi_instances, instance_id));
+  s_smpi_mpi_instance_t* instance =
+     static_cast<s_smpi_mpi_instance_t*>(xbt_dict_get_or_null(smpi_instances, instance_id));
   xbt_assert(instance, "Error, unknown instance %s", instance_id);
 
   if(instance->comm_world == MPI_COMM_NULL){
index c0b01ac..478f234 100644 (file)
@@ -10,8 +10,7 @@
 #include "smpi/smpi.h"
 #include "src/internal_config.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
-                                "Logging specific to SMPI (experimental DVFS support)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi, "Logging specific to SMPI (experimental DVFS support)");
 
 /**
  * \brief Return the speed of the processor (in flop/s) at a given pstate
@@ -69,7 +68,6 @@ double smpi_get_host_consumed_energy(void) {
   return sg_host_get_consumed_energy(SIMIX_host_self());
 }
 
-
 #ifdef SMPI_FORTRAN
 
 #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
index f946d5c..93dfe83 100644 (file)
@@ -29,7 +29,6 @@ typedef unsigned long int uinteger;
 #endif
 
 /* Bindings for MPI special values */
-
   struct s_smpi_common {
     integer _MPI_IN_PLACE;
     integer _MPI_BOTTOM;
@@ -37,8 +36,6 @@ typedef unsigned long int uinteger;
     integer _MPI_STATUSES_IGNORE;
   } smpi_;
 
-
-
 /* Convert between Fortran and C */
 #define FORT_ADDR(addr, val)                                         \
   (((void *)(addr) == (void*) &(smpi_._ ## val))                  \
@@ -50,18 +47,16 @@ typedef unsigned long int uinteger;
 
 #define KEY_SIZE (sizeof(int) * 2 + 1)
 
-
 static char* get_key(char* key, int id) {
   snprintf(key, KEY_SIZE, "%x",id);
   return key;
 }
+
 static char* get_key_id(char* key, int id) {
   snprintf(key, KEY_SIZE, "%x_%d",id, smpi_process_index());
   return key;
 }
 
-
-
 static void smpi_init_fortran_types(){
    if(!comm_lookup){
      comm_lookup = xbt_dict_new_homogeneous(NULL);
@@ -124,7 +119,6 @@ static void smpi_init_fortran_types(){
    }
 }
 
-
 int smpi_comm_c2f(MPI_Comm comm) {
   static int comm_id = 0;
   char key[KEY_SIZE];
@@ -144,8 +138,7 @@ MPI_Comm smpi_comm_f2c(int comm) {
     return MPI_COMM_SELF;
   }else if(comm==0){
     return MPI_COMM_WORLD;
-  }     else if(comm_lookup && comm >= 0) {
-
+  } else if(comm_lookup && comm >= 0) {
       char key[KEY_SIZE];
       MPI_Comm tmp =  (MPI_Comm)xbt_dict_get_or_null(comm_lookup,get_key_id(key, comm));
       return tmp != NULL ? tmp : MPI_COMM_NULL ;
@@ -177,8 +170,6 @@ static void free_group(int group) {
   xbt_dict_remove(group_lookup, get_key(key, group));
 }
 
-
-
 int smpi_request_c2f(MPI_Request req) {
   static int request_id = 0;
   char key[KEY_SIZE];
@@ -211,9 +202,7 @@ int smpi_type_c2f(MPI_Datatype datatype) {
 MPI_Datatype smpi_type_f2c(int datatype) {
   smpi_init_fortran_types();
   char key[KEY_SIZE];
-  return datatype >= 0
-         ? (MPI_Datatype)xbt_dict_get_or_null(datatype_lookup, get_key(key, datatype))
-         : MPI_DATATYPE_NULL;
+  return datatype >= 0 ? (MPI_Datatype)xbt_dict_get_or_null(datatype_lookup, get_key(key, datatype)): MPI_DATATYPE_NULL;
 }
 
 static void free_datatype(int datatype) {
@@ -232,9 +221,7 @@ int smpi_op_c2f(MPI_Op op) {
 MPI_Op smpi_op_f2c(int op) {
   smpi_init_fortran_types();
   char key[KEY_SIZE];
-   return op >= 0
-          ? (MPI_Op)xbt_dict_get_or_null(op_lookup,  get_key(key, op))
-          : MPI_OP_NULL;
+   return op >= 0 ? (MPI_Op)xbt_dict_get_or_null(op_lookup,  get_key(key, op)): MPI_OP_NULL;
 }
 
 static void free_op(int op) {
@@ -253,9 +240,7 @@ int smpi_win_c2f(MPI_Win win) {
 MPI_Win smpi_win_f2c(int win) {
   smpi_init_fortran_types();
   char key[KEY_SIZE];
-   return win >= 0
-          ? (MPI_Win)xbt_dict_get_or_null(win_lookup,  get_key(key, win))
-          : MPI_WIN_NULL;
+   return win >= 0 ? (MPI_Win)xbt_dict_get_or_null(win_lookup,  get_key(key, win)) : MPI_WIN_NULL;
 }
 
 static void free_win(int win) {
@@ -263,7 +248,6 @@ static void free_win(int win) {
   xbt_dict_remove(win_lookup, get_key(key, win));
 }
 
-
 int smpi_info_c2f(MPI_Info info) {
   static int info_id = 0;
   char key[KEY_SIZE];
@@ -275,9 +259,7 @@ int smpi_info_c2f(MPI_Info info) {
 MPI_Info smpi_info_f2c(int info) {
   smpi_init_fortran_types();
   char key[KEY_SIZE];
-   return info >= 0
-          ? (MPI_Info)xbt_dict_get_or_null(info_lookup,  get_key(key, info))
-          : MPI_INFO_NULL;
+   return info >= 0 ? (MPI_Info)xbt_dict_get_or_null(info_lookup,  get_key(key, info)) : MPI_INFO_NULL;
 }
 
 static void free_info(int info) {
@@ -285,7 +267,6 @@ static void free_info(int info) {
   xbt_dict_remove(info_lookup, get_key(key, info));
 }
 
-
 void mpi_init_(int* ierr) {
     smpi_init_fortran_types();
    *ierr = MPI_Init(NULL, NULL);
@@ -343,7 +324,6 @@ void mpi_comm_create_(int* comm, int* group, int* newcomm, int* ierr) {
   }
 }
 
-
 void mpi_comm_free_(int* comm, int* ierr) {
   MPI_Comm tmp = smpi_comm_f2c(*comm);
 
@@ -381,96 +361,76 @@ void mpi_comm_group_(int* comm, int* group_out,  int* ierr) {
   }
 }
 
-
 void mpi_initialized_(int* flag, int* ierr){
   *ierr = MPI_Initialized(flag);
 }
 
-void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag,
-                     int* comm, int* request, int* ierr) {
+void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
   MPI_Request req;
   buf = (char *) FORT_BOTTOM(buf);
-  *ierr = MPI_Send_init(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
-                        smpi_comm_f2c(*comm), &req);
+  *ierr = MPI_Send_init(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm), &req);
   if(*ierr == MPI_SUCCESS) {
     *request = smpi_request_c2f(req);
   }
 }
 
-void mpi_isend_(void *buf, int* count, int* datatype, int* dst,
-                 int* tag, int* comm, int* request, int* ierr) {
+void mpi_isend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
   MPI_Request req;
   buf = (char *) FORT_BOTTOM(buf);
-  *ierr = MPI_Isend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
-                    smpi_comm_f2c(*comm), &req);
+  *ierr = MPI_Isend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm), &req);
   if(*ierr == MPI_SUCCESS) {
     *request = smpi_request_c2f(req);
   }
 }
 
-void mpi_irsend_(void *buf, int* count, int* datatype, int* dst,
-                 int* tag, int* comm, int* request, int* ierr) {
+void mpi_irsend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
   MPI_Request req;
   buf = (char *) FORT_BOTTOM(buf);
-  *ierr = MPI_Irsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
-                    smpi_comm_f2c(*comm), &req);
+  *ierr = MPI_Irsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm), &req);
   if(*ierr == MPI_SUCCESS) {
     *request = smpi_request_c2f(req);
   }
 }
 
-void mpi_send_(void* buf, int* count, int* datatype, int* dst,
-                int* tag, int* comm, int* ierr) {
+void mpi_send_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr) {
   buf = (char *) FORT_BOTTOM(buf);
-   *ierr = MPI_Send(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
-                    smpi_comm_f2c(*comm));
+   *ierr = MPI_Send(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm));
 }
 
-void mpi_rsend_(void* buf, int* count, int* datatype, int* dst,
-                int* tag, int* comm, int* ierr) {
+void mpi_rsend_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr) {
   buf = (char *) FORT_BOTTOM(buf);
-   *ierr = MPI_Rsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
-                    smpi_comm_f2c(*comm));
+   *ierr = MPI_Rsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm));
 }
 
-void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst,
-                int* sendtag, void *recvbuf, int* recvcount,
-                int* recvtype, int* src, int* recvtag,
-                int* comm, MPI_Status* status, int* ierr) {
+void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst, int* sendtag, void *recvbuf, int* recvcount,
+                   int* recvtype, int* src, int* recvtag, int* comm, MPI_Status* status, int* ierr) {
   sendbuf = (char *) FORT_BOTTOM(sendbuf);
   recvbuf = (char *) FORT_BOTTOM(recvbuf);
-   *ierr = MPI_Sendrecv(sendbuf, *sendcount, smpi_type_f2c(*sendtype), *dst,
-       *sendtag, recvbuf, *recvcount,smpi_type_f2c(*recvtype), *src, *recvtag,
-       smpi_comm_f2c(*comm), FORT_STATUS_IGNORE(status));
+   *ierr = MPI_Sendrecv(sendbuf, *sendcount, smpi_type_f2c(*sendtype), *dst, *sendtag, recvbuf, *recvcount,
+                        smpi_type_f2c(*recvtype), *src, *recvtag, smpi_comm_f2c(*comm), FORT_STATUS_IGNORE(status));
 }
 
-void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag,
-                     int* comm, int* request, int* ierr) {
+void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr) {
   MPI_Request req;
   buf = (char *) FORT_BOTTOM(buf);
-  *ierr = MPI_Recv_init(buf, *count, smpi_type_f2c(*datatype), *src, *tag,
-                        smpi_comm_f2c(*comm), &req);
+  *ierr = MPI_Recv_init(buf, *count, smpi_type_f2c(*datatype), *src, *tag, smpi_comm_f2c(*comm), &req);
   if(*ierr == MPI_SUCCESS) {
     *request = smpi_request_c2f(req);
   }
 }
 
-void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag,
-                 int* comm, int* request, int* ierr) {
+void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr) {
   MPI_Request req;
   buf = (char *) FORT_BOTTOM(buf);
-  *ierr = MPI_Irecv(buf, *count, smpi_type_f2c(*datatype), *src, *tag,
-                    smpi_comm_f2c(*comm), &req);
+  *ierr = MPI_Irecv(buf, *count, smpi_type_f2c(*datatype), *src, *tag, smpi_comm_f2c(*comm), &req);
   if(*ierr == MPI_SUCCESS) {
     *request = smpi_request_c2f(req);
   }
 }
 
-void mpi_recv_(void* buf, int* count, int* datatype, int* src,
-                int* tag, int* comm, MPI_Status* status, int* ierr) {
+void mpi_recv_(void* buf, int* count, int* datatype, int* src, int* tag, int* comm, MPI_Status* status, int* ierr) {
   buf = (char *) FORT_BOTTOM(buf);
-  *ierr = MPI_Recv(buf, *count, smpi_type_f2c(*datatype), *src, *tag,
-                    smpi_comm_f2c(*comm), status);
+  *ierr = MPI_Recv(buf, *count, smpi_type_f2c(*datatype), *src, *tag, smpi_comm_f2c(*comm), status);
 }
 
 void mpi_start_(int* request, int* ierr) {
@@ -544,48 +504,39 @@ void mpi_bcast_(void *buf, int* count, int* datatype, int* root, int* comm, int*
   *ierr = MPI_Bcast(buf, *count, smpi_type_f2c(*datatype), *root, smpi_comm_f2c(*comm));
 }
 
-void mpi_reduce_(void* sendbuf, void* recvbuf, int* count,
-                  int* datatype, int* op, int* root, int* comm, int* ierr) {
+void mpi_reduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
   sendbuf = (char *) FORT_BOTTOM(sendbuf);
   recvbuf = (char *) FORT_BOTTOM(recvbuf);
-  *ierr = MPI_Reduce(sendbuf, recvbuf, *count,
-                     smpi_type_f2c(*datatype), smpi_op_f2c(*op), *root, smpi_comm_f2c(*comm));
+  *ierr = MPI_Reduce(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype), smpi_op_f2c(*op), *root, smpi_comm_f2c(*comm));
 }
 
-void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype,
-                     int* op, int* comm, int* ierr) {
+void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
-  *ierr = MPI_Allreduce(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype),
-                        smpi_op_f2c(*op), smpi_comm_f2c(*comm));
+  *ierr = MPI_Allreduce(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype), smpi_op_f2c(*op), smpi_comm_f2c(*comm));
 }
 
-void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
-                     int* op, int* comm, int* ierr) {
+void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
   *ierr = MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, smpi_type_f2c(*datatype),
                         smpi_op_f2c(*op), smpi_comm_f2c(*comm));
 }
 
-void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype,
-                   void* recvbuf, int* recvcount, int* recvtype, 
+void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
                    int* root, int* comm, int* ierr) {
   recvbuf = (char *) FORT_IN_PLACE(recvbuf);
   *ierr = MPI_Scatter(sendbuf, *sendcount, smpi_type_f2c(*sendtype),
                       recvbuf, *recvcount, smpi_type_f2c(*recvtype), *root, smpi_comm_f2c(*comm));
 }
 
-
 void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
-                   void* recvbuf, int* recvcount, int* recvtype,
-                   int* root, int* comm, int* ierr) {
+                   void* recvbuf, int* recvcount, int* recvtype, int* root, int* comm, int* ierr) {
   recvbuf = (char *) FORT_IN_PLACE(recvbuf);
   *ierr = MPI_Scatterv(sendbuf, sendcounts, displs, smpi_type_f2c(*sendtype),
                       recvbuf, *recvcount, smpi_type_f2c(*recvtype), *root, smpi_comm_f2c(*comm));
 }
 
-void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype,
-                  void* recvbuf, int* recvcount, int* recvtype,
+void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
                   int* root, int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
   sendbuf = (char *) FORT_BOTTOM(sendbuf);
@@ -595,8 +546,7 @@ void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype,
 }
 
 void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
-                  void* recvbuf, int* recvcounts, int* displs, int* recvtype,
-                  int* root, int* comm, int* ierr) {
+                  void* recvbuf, int* recvcounts, int* displs, int* recvtype, int* root, int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
   sendbuf = (char *) FORT_BOTTOM(sendbuf);
   recvbuf = (char *) FORT_BOTTOM(recvbuf);
@@ -604,8 +554,7 @@ void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
                      recvbuf, recvcounts, displs, smpi_type_f2c(*recvtype), *root, smpi_comm_f2c(*comm));
 }
 
-void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype,
-                     void* recvbuf, int* recvcount, int* recvtype,
+void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
                      int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
   *ierr = MPI_Allgather(sendbuf, *sendcount, smpi_type_f2c(*sendtype),
@@ -613,15 +562,13 @@ void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype,
 }
 
 void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype,
-                     void* recvbuf, int* recvcounts,int* displs, int* recvtype,
-                     int* comm, int* ierr) {
+                     void* recvbuf, int* recvcounts,int* displs, int* recvtype, int* comm, int* ierr) {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
   *ierr = MPI_Allgatherv(sendbuf, *sendcount, smpi_type_f2c(*sendtype),
                         recvbuf, recvcounts, displs, smpi_type_f2c(*recvtype), smpi_comm_f2c(*comm));
 }
 
-void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype,
-                int* op, int* comm, int* ierr) {
+void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) {
   *ierr = MPI_Scan(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype),
                    smpi_op_f2c(*op), smpi_comm_f2c(*comm));
 }
@@ -647,7 +594,6 @@ void mpi_test_ (int * request, int *flag, MPI_Status * status, int* ierr){
   }
 }
 
-
 void mpi_testall_ (int* count, int * requests,  int *flag, MPI_Status * statuses, int* ierr){
   MPI_Request* reqs;
   int i;
@@ -664,7 +610,6 @@ void mpi_testall_ (int* count, int * requests,  int *flag, MPI_Status * statuses
   }
 }
 
-
 void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
   *ierr = MPI_Get_processor_name(name, resultlen);
 }
@@ -871,7 +816,6 @@ void mpi_put_( int *origin_addr, int* origin_count, int* origin_datatype, int *t
       *target_disp, *target_count,smpi_type_f2c(*tarsmpi_type_f2c), smpi_win_f2c(*win));
 }
 
-
 //following are automatically generated, and have to be checked
 void mpi_finalized_ (int * flag, int* ierr){
 
@@ -942,7 +886,8 @@ void mpi_type_delete_attr_ (int* type, int* type_keyval, int* ierr){
 
 void mpi_type_create_keyval_ (void* copy_fn, void*  delete_fn, int* keyval, void* extra_state, int* ierr){
 
- *ierr = MPI_Type_create_keyval((MPI_Type_copy_attr_function*)copy_fn, (MPI_Type_delete_attr_function*) delete_fn,  keyval,  extra_state) ;
+ *ierr = MPI_Type_create_keyval((MPI_Type_copy_attr_function*)copy_fn, (MPI_Type_delete_attr_function*) delete_fn,
+                                keyval,  extra_state) ;
 }
 
 void mpi_type_free_keyval_ (int* keyval, int* ierr) {
@@ -1075,7 +1020,8 @@ void mpi_comm_delete_attr_ (int* comm, int* comm_keyval, int* ierr){
 
 void mpi_comm_create_keyval_ (void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr){
 
- *ierr = MPI_Comm_create_keyval((MPI_Comm_copy_attr_function*)copy_fn,  (MPI_Comm_delete_attr_function*)delete_fn,  keyval,  extra_state) ;
+ *ierr = MPI_Comm_create_keyval((MPI_Comm_copy_attr_function*)copy_fn,  (MPI_Comm_delete_attr_function*)delete_fn,
+         keyval,  extra_state) ;
 }
 
 void mpi_comm_free_keyval_ (int* keyval, int* ierr) {
@@ -1109,9 +1055,8 @@ void mpi_request_free_ (int* request, int* ierr){
 }
 
 void mpi_sendrecv_replace_ (void *buf, int* count, int* datatype, int* dst, int* sendtag, int* src, int* recvtag,
- int* comm, MPI_Status* status, int* ierr)
                           int* comm, MPI_Status* status, int* ierr)
 {
-
  *ierr = MPI_Sendrecv_replace(buf, *count, smpi_type_f2c(*datatype), *dst, *sendtag, *src,
  *recvtag, smpi_comm_f2c(*comm), FORT_STATUS_IGNORE(status));
 }
@@ -1158,10 +1103,12 @@ void mpi_reduce_local_ (void *inbuf, void *inoutbuf, int* count, int* datatype,
  *ierr = MPI_Reduce_local(inbuf, inoutbuf, *count, smpi_type_f2c(*datatype), smpi_op_f2c(*op));
 }
 
-void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm, int* ierr)
+void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm,
+                                int* ierr)
 {
   sendbuf = (char *) FORT_IN_PLACE(sendbuf);
- *ierr = MPI_Reduce_scatter_block(sendbuf, recvbuf, *recvcount, smpi_type_f2c(*datatype), smpi_op_f2c(*op), smpi_comm_f2c(*comm));
+ *ierr = MPI_Reduce_scatter_block(sendbuf, recvbuf, *recvcount, smpi_type_f2c(*datatype), smpi_op_f2c(*op),
+                                  smpi_comm_f2c(*comm));
 }
 
 void mpi_pack_size_ (int* incount, int* datatype, int* comm, int* size, int* ierr) {
@@ -1314,7 +1261,8 @@ void mpi_comm_test_inter_ (int* comm, int* flag, int* ierr) {
  *ierr = MPI_Comm_test_inter(smpi_comm_f2c(*comm), flag);
 }
 
-void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm, int* ierr) {
+void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm,
+                  int* ierr) {
  *ierr = MPI_Unpack(inbuf, *insize, position, outbuf, *outcount, smpi_type_f2c(*type), smpi_comm_f2c(*comm));
 }
 
@@ -1322,11 +1270,13 @@ void mpi_pack_external_size_ (char *datarep, int* incount, int* datatype, MPI_Ai
  *ierr = MPI_Pack_external_size(datarep, *incount, smpi_type_f2c(*datatype), size);
 }
 
-void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount, MPI_Aint *position, int* ierr){
+void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount,
+                         MPI_Aint *position, int* ierr){
  *ierr = MPI_Pack_external(datarep, inbuf, *incount, smpi_type_f2c(*datatype), outbuf, *outcount, position);
 }
 
-void mpi_unpack_external_ ( char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf, int* outcount, int* datatype, int* ierr){
+void mpi_unpack_external_ ( char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf,
+                            int* outcount, int* datatype, int* ierr){
  *ierr = MPI_Unpack_external( datarep, inbuf, *insize, position, outbuf, *outcount, smpi_type_f2c(*datatype));
 }
 
@@ -1338,7 +1288,7 @@ void mpi_type_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old
   }
 }
 
-void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr) {
+void mpi_type_create_hindexed_(int* count, int* blocklens, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr){
   MPI_Datatype tmp;
   *ierr = MPI_Type_create_hindexed(*count, blocklens, indices, smpi_type_f2c(*old_type), &tmp);
   if(*ierr == MPI_SUCCESS) {
@@ -1346,7 +1296,8 @@ void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, i
   }
 }
 
-void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int*  newtype, int* ierr) {
+void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int*  newtype,
+                                      int* ierr) {
   MPI_Datatype tmp;
   *ierr = MPI_Type_create_hindexed_block(*count, *blocklength, indices, smpi_type_f2c(*old_type), &tmp);
   if(*ierr == MPI_SUCCESS) {
@@ -1362,7 +1313,8 @@ void mpi_type_indexed_ (int* count, int* blocklens, int* indices, int* old_type,
   }
 }
 
-void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices,  int* old_type,  int*newtype, int* ierr){
+void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices,  int* old_type,  int*newtype,
+                                     int* ierr){
   MPI_Datatype tmp;
   *ierr = MPI_Type_create_indexed_block(*count, *blocklength, indices, smpi_type_f2c(*old_type), &tmp);
   if(*ierr == MPI_SUCCESS) {
@@ -1384,7 +1336,7 @@ void mpi_type_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_t
   xbt_free(types);
 }
 
-void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int*  old_types, int*  newtype, int* ierr) {
+void mpi_type_create_struct_(int* count, int* blocklens, MPI_Aint* indices, int*  old_types, int*  newtype, int* ierr){
   MPI_Datatype tmp;
   int i=0;
   MPI_Datatype* types = (MPI_Datatype*)xbt_malloc(*count*sizeof(MPI_Datatype));
@@ -1410,9 +1362,11 @@ void mpi_ssend_init_ (void* buf, int* count, int* datatype, int* dest, int* tag,
  }
 }
 
-void mpi_intercomm_create_ (int* local_comm, int *local_leader, int* peer_comm, int* remote_leader, int* tag, int*  comm_out, int* ierr) {
+void mpi_intercomm_create_ (int* local_comm, int *local_leader, int* peer_comm, int* remote_leader, int* tag,
+                            int* comm_out, int* ierr) {
   MPI_Comm tmp;
-  *ierr = MPI_Intercomm_create(smpi_comm_f2c(*local_comm), *local_leader,smpi_comm_f2c(*peer_comm), *remote_leader, *tag, &tmp);
+  *ierr = MPI_Intercomm_create(smpi_comm_f2c(*local_comm), *local_leader,smpi_comm_f2c(*peer_comm), *remote_leader,
+                               *tag, &tmp);
   if(*ierr == MPI_SUCCESS) {
     *comm_out = smpi_comm_c2f(tmp);
   }
@@ -1514,18 +1468,21 @@ void mpi_iprobe_ (int* source, int* tag, int* comm, int* flag, MPI_Status*  stat
  *ierr = MPI_Iprobe(*source, *tag, smpi_comm_f2c(*comm), flag, status);
 }
 
-void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner, int* ierr){
-
+void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner,
+                              int* ierr){
  *ierr = MPI_Type_get_envelope(  smpi_type_f2c(*datatype), num_integers,
  num_addresses, num_datatypes, combiner);
 }
 
-void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
+void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes,
+                             int* array_of_integers, MPI_Aint* array_of_addresses,
  int* array_of_datatypes, int* ierr){
- *ierr = MPI_Type_get_contents(smpi_type_f2c(*datatype), *max_integers, *max_addresses,*max_datatypes, array_of_integers, array_of_addresses, (MPI_Datatype*)array_of_datatypes);
+ *ierr = MPI_Type_get_contents(smpi_type_f2c(*datatype), *max_integers, *max_addresses,*max_datatypes,
+                               array_of_integers, array_of_addresses, (MPI_Datatype*)array_of_datatypes);
 }
 
-void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
+void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs,
+                              int* array_of_dargs, int* array_of_psizes,
  int* order, int* oldtype, int*newtype, int* ierr) {
   MPI_Datatype tmp;
   *ierr = MPI_Type_create_darray(*size, *rank, *ndims,  array_of_gsizes,
@@ -1544,9 +1501,11 @@ void mpi_type_create_resized_ (int* oldtype,MPI_Aint* lb, MPI_Aint* extent, int*
   }
 }
 
-void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int* order, int* oldtype, int*newtype, int* ierr){
+void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts,
+                                int* order, int* oldtype, int*newtype, int* ierr){
   MPI_Datatype tmp;
-  *ierr = MPI_Type_create_subarray(*ndims,array_of_sizes, array_of_subsizes, array_of_starts, *order, smpi_type_f2c(*oldtype), &tmp);
+  *ierr = MPI_Type_create_subarray(*ndims,array_of_sizes, array_of_subsizes, array_of_starts, *order,
+                                   smpi_type_f2c(*oldtype), &tmp);
   if(*ierr == MPI_SUCCESS) {
     *newtype = smpi_type_c2f(tmp);
   }
@@ -1560,9 +1519,10 @@ void mpi_type_match_size_ (int* typeclass,int* size,int* datatype, int* ierr){
   }
 }
 
-void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int* sendtypes, void *recvbuf, int *recvcnts, int *rdispls, int* recvtypes,
- int* comm, int* ierr){
- *ierr = MPI_Alltoallw( sendbuf, sendcnts, sdispls, (MPI_Datatype*) sendtypes, recvbuf, recvcnts, rdispls, (MPI_Datatype*)recvtypes, smpi_comm_f2c(*comm));
+void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int* sendtypes, void *recvbuf, int *recvcnts,
+                      int *rdispls, int* recvtypes, int* comm, int* ierr){
+ *ierr = MPI_Alltoallw( sendbuf, sendcnts, sdispls, (MPI_Datatype*) sendtypes, recvbuf, recvcnts, rdispls,
+                        (MPI_Datatype*)recvtypes, smpi_comm_f2c(*comm));
 }
 
 void mpi_exscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr){
@@ -1605,7 +1565,6 @@ void mpi_comm_get_info_ (int* comm, int* info, int* ierr){
  }
 }
 
-
 void mpi_comm_create_errhandler_ ( void *function, void *errhandler, int* ierr){
  *ierr = MPI_Comm_create_errhandler( (MPI_Comm_errhandler_fn*) function, (MPI_Errhandler*)errhandler);
 }
@@ -1685,7 +1644,8 @@ void mpi_request_get_status_ ( int* request, int *flag, MPI_Status* status, int*
 
 void mpi_grequest_start_ ( void *query_fn, void *free_fn, void *cancel_fn, void *extra_state, int*request, int* ierr){
   MPI_Request tmp;
-  *ierr = MPI_Grequest_start( (MPI_Grequest_query_function*)query_fn, (MPI_Grequest_free_function*)free_fn, (MPI_Grequest_cancel_function*)cancel_fn, extra_state, &tmp);
+  *ierr = MPI_Grequest_start( (MPI_Grequest_query_function*)query_fn, (MPI_Grequest_free_function*)free_fn,
+                              (MPI_Grequest_cancel_function*)cancel_fn, extra_state, &tmp);
  if(*ierr == MPI_SUCCESS) {
    *request = smpi_request_c2f(tmp);
  }
@@ -1747,15 +1707,18 @@ void mpi_comm_accept_ ( char *port_name, int* info, int* root, int* comm, int*ne
   }
 }
 
-void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int* intercomm, int* array_of_errcodes, int* ierr){
+void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int* intercomm,
+                       int* array_of_errcodes, int* ierr){
   MPI_Comm tmp;
-  *ierr = MPI_Comm_spawn( command, NULL, *maxprocs, *(MPI_Info*)info, *root, smpi_comm_f2c(*comm), &tmp, array_of_errcodes);
+  *ierr = MPI_Comm_spawn( command, NULL, *maxprocs, *(MPI_Info*)info, *root, smpi_comm_f2c(*comm), &tmp,
+                          array_of_errcodes);
   if(*ierr == MPI_SUCCESS) {
     *intercomm = smpi_comm_c2f(tmp);
   }
 }
 
-void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs, int* array_of_info, int* root,
+void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs,
+                                int* array_of_info, int* root,
  int* comm, int* intercomm, int* array_of_errcodes, int* ierr){
  MPI_Comm tmp;
  *ierr = MPI_Comm_spawn_multiple(* count, &array_of_commands, &array_of_argv, array_of_maxprocs,
@@ -1772,4 +1735,3 @@ void mpi_comm_get_parent_ ( int* parent, int* ierr){
     *parent = smpi_comm_c2f(tmp);
   }
 }
-
index b469c62..caacb69 100644 (file)
@@ -20,8 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi,
-                                "Logging specific to SMPI (kernel)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
 
 typedef struct s_smpi_process_data {
   double simulated;
@@ -59,15 +58,13 @@ MPI_Errhandler *MPI_ERRHANDLER_NULL = NULL;
 
 static char *get_mailbox_name(char *str, int index)
 {
-  snprintf(str, MAILBOX_NAME_MAXLEN, "SMPI-%0*x", (int) (sizeof(int) * 2),
-           index);
+  snprintf(str, MAILBOX_NAME_MAXLEN, "SMPI-%0*x", (int) (sizeof(int) * 2), index);
   return str;
 }
 
 static char *get_mailbox_name_small(char *str, int index)
 {
-  snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", (int) (sizeof(int) * 2),
-           index);
+  snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", (int) (sizeof(int) * 2), index);
   return str;
 }
 
@@ -122,10 +119,10 @@ void smpi_process_init(int *argc, char ***argv)
     // set the process attached to the mailbox
     simcall_rdv_set_receiver(data->mailbox_small, proc);
     XBT_DEBUG("<%d> New process in the game: %p", index, proc);
-
   }
   xbt_assert(smpi_process_data(),
-      "smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by MPI-2, this is currently not supported by SMPI.");
+      "smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by "
+      "MPI-2, this is currently not supported by SMPI.");
 }
 
 void smpi_process_destroy(void)
@@ -138,13 +135,10 @@ void smpi_process_destroy(void)
   XBT_DEBUG("<%d> Process left the game", index);
 }
 
-/**
- * @brief Prepares the current process for termination.
- */
+/** @brief Prepares the current process for termination. */
 void smpi_process_finalize(void)
 {
-    // This leads to an explosion of the search graph
-    // which cannot be reduced:
+    // This leads to an explosion of the search graph which cannot be reduced:
     if(MC_is_active() || MC_record_replay_is_active())
       return;
 
@@ -153,9 +147,7 @@ void smpi_process_finalize(void)
     xbt_barrier_wait(process_data[index_to_process_data[index]]->finalization_barrier);
 }
 
-/**
- * @brief Check if a process is finalized
- */
+/** @brief Check if a process is finalized */
 int smpi_process_finalized()
 {
   int index = smpi_process_index();
@@ -165,24 +157,18 @@ int smpi_process_finalized()
       return 0;
 }
 
-/**
- * @brief Check if a process is initialized
- */
+/** @brief Check if a process is initialized */
 int smpi_process_initialized(void)
 {
   if (!index_to_process_data){
     return false;
-  }
-  else{
+  } else{
     int index = smpi_process_index();
-    return ( (index != MPI_UNDEFINED)
-             && (process_data[index_to_process_data[index]]->state == SMPI_INITIALIZED));
+    return ((index != MPI_UNDEFINED) && (process_data[index_to_process_data[index]]->state == SMPI_INITIALIZED));
   }
 }
 
-/**
- * @brief Mark a process as initialized (=MPI_Init called)
- */
+/** @brief Mark a process as initialized (=MPI_Init called) */
 void smpi_process_mark_as_initialized(void)
 {
   int index = smpi_process_index();
@@ -203,7 +189,6 @@ int smpi_process_get_replaying(){
   else return _xbt_replay_is_active();
 }
 
-
 int smpi_global_size(void)
 {
   char *value = getenv("SMPI_GLOBAL_SIZE");
@@ -278,7 +263,6 @@ smx_mailbox_t smpi_process_remote_mailbox(int index)
   return data->mailbox;
 }
 
-
 smx_mailbox_t smpi_process_remote_mailbox_small(int index)
 {
   smpi_process_data_t data = smpi_process_remote_data(index);
@@ -345,23 +329,18 @@ int smpi_process_get_sampling(void)
   return data->sampling;
 }
 
-
 void print_request(const char *message, MPI_Request request)
 {
-  XBT_VERB
-      ("%s  request %p  [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
-       message, request, request->buf, request->size, request->src,
-       request->dst, request->tag, request->flags);
+  XBT_VERB("%s  request %p  [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
+       message, request, request->buf, request->size, request->src, request->dst, request->tag, request->flags);
 }
 
-void smpi_comm_copy_buffer_callback(smx_synchro_t comm,
-                                           void *buff, size_t buff_size)
+void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size)
 {
   XBT_DEBUG("Copy the data over");
   void* tmpbuff=buff;
 
-  if((smpi_privatize_global_variables)
-      && ((char*)buff >= smpi_start_data_exe)
+  if((smpi_privatize_global_variables) && ((char*)buff >= smpi_start_data_exe)
       && ((char*)buff < smpi_start_data_exe + smpi_size_data_exe )
     ){
        XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
@@ -370,35 +349,26 @@ void smpi_comm_copy_buffer_callback(smx_synchro_t comm,
        memcpy(tmpbuff, buff, buff_size);
   }
 
-
-  if((smpi_privatize_global_variables)
-      && ((char*)comm->comm.dst_buff >= smpi_start_data_exe)
-      && ((char*)comm->comm.dst_buff < smpi_start_data_exe + smpi_size_data_exe )
-    ){
+  if((smpi_privatize_global_variables) && ((char*)comm->comm.dst_buff >= smpi_start_data_exe)
+      && ((char*)comm->comm.dst_buff < smpi_start_data_exe + smpi_size_data_exe )){
        XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
        smpi_switch_data_segment(((smpi_process_data_t)(((simdata_process_t)SIMIX_process_get_data(comm->comm.dst_proc))->data))->index);
   }
 
-
   memcpy(comm->comm.dst_buff, tmpbuff, buff_size);
   if (comm->comm.detached) {
     // if this is a detached send, the source buffer was duplicated by SMPI
     // sender to make the original buffer available to the application ASAP
     xbt_free(buff);
-    //It seems that the request is used after the call there this should
-    //be free somewhereelse  but where???
-    //xbt_free(comm->comm.src_data);// inside SMPI the request is keep
-    //inside the user data and should be free
+    //It seems that the request is used after the call there this should be free somewhere else but where???
+    //xbt_free(comm->comm.src_data);// inside SMPI the request is kept inside the user data and should be free
     comm->comm.src_buff = NULL;
   }
 
   if(tmpbuff!=buff)xbt_free(tmpbuff);
-
 }
 
-
-void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm,
-                                           void *buff, size_t buff_size)
+void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size)
 {
   return;
 }
@@ -406,8 +376,7 @@ void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm,
 static void smpi_check_options(){
   //check correctness of MPI parameters
 
-   xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <=
-              sg_cfg_get_int("smpi/send_is_detached_thresh"));
+   xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <= sg_cfg_get_int("smpi/send_is_detached_thresh"));
 
    if (sg_cfg_is_default_value("smpi/running_power")) {
      XBT_INFO("You did not set the power of the host running the simulation.  "
@@ -444,8 +413,7 @@ void smpi_global_init(void)
     process_data[i]->argc                 = NULL;
     process_data[i]->argv                 = NULL;
     process_data[i]->mailbox              = simcall_rdv_create(get_mailbox_name(name, i));
-    process_data[i]->mailbox_small        =
-        simcall_rdv_create(get_mailbox_name_small(name, i));
+    process_data[i]->mailbox_small        = simcall_rdv_create(get_mailbox_name_small(name, i));
     process_data[i]->mailboxes_mutex      = xbt_mutex_init();
     process_data[i]->timer                = xbt_os_timer_new();
     if (MC_is_active())
@@ -457,10 +425,8 @@ void smpi_global_init(void)
     process_data[i]->sampling             = 0;
     process_data[i]->finalization_barrier = NULL;
   }
-  //if the process was launched through smpirun script
-  //we generate a global mpi_comm_world
-  //if not, we let MPI_COMM_NULL, and the comm world
-  //will be private to each mpi instance
+  //if the process was launched through smpirun script we generate a global mpi_comm_world
+  //if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
   if(smpirun){
     group = smpi_group_new(process_count);
     MPI_COMM_WORLD = smpi_comm_new(group, NULL);
@@ -538,11 +504,8 @@ static void smpi_init_logs(){
 
   /* Connect log categories.  See xbt/log.c */
 
-  XBT_LOG_CONNECT(smpi);        /* Keep this line as soon as possible in this
-                                   function: xbt_log_appender_file.c depends on it
-                                   DO NOT connect this in XBT or so, or it will be
-                                   useless to xbt_log_appender_file.c */
-
+  XBT_LOG_CONNECT(smpi);  /* Keep this line as soon as possible in this function: xbt_log_appender_file.c depends on it
+                             DO NOT connect this in XBT or so, or it will be useless to xbt_log_appender_file.c */
   XBT_LOG_CONNECT(instr_smpi);
   XBT_LOG_CONNECT(smpi_base);
   XBT_LOG_CONNECT(smpi_bench);
@@ -561,84 +524,62 @@ static void smpi_init_logs(){
 }
 
 static void smpi_init_options(){
-  int gather_id = find_coll_description(mpi_coll_gather_description,
-                                          sg_cfg_get_string("smpi/gather"),"gather");
-    mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype,
-                                   void *, int, MPI_Datatype, int, MPI_Comm))
+  int gather_id = find_coll_description(mpi_coll_gather_description, sg_cfg_get_string("smpi/gather"),"gather");
+    mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm))
         mpi_coll_gather_description[gather_id].coll;
 
     int allgather_id = find_coll_description(mpi_coll_allgather_description,
                                              sg_cfg_get_string("smpi/allgather"),"allgather");
-    mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype,
-                                      void *, int, MPI_Datatype, MPI_Comm))
+    mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm))
         mpi_coll_allgather_description[allgather_id].coll;
 
     int allgatherv_id = find_coll_description(mpi_coll_allgatherv_description,
                                               sg_cfg_get_string("smpi/allgatherv"),"allgatherv");
-    mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype, void *, int *,
-                                       int *, MPI_Datatype, MPI_Comm))
+    mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm))
         mpi_coll_allgatherv_description[allgatherv_id].coll;
 
     int allreduce_id = find_coll_description(mpi_coll_allreduce_description,
                                              sg_cfg_get_string("smpi/allreduce"),"allreduce");
-    mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount,
-                                      MPI_Datatype dtype, MPI_Op op,
-                                      MPI_Comm comm))
+    mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm))
         mpi_coll_allreduce_description[allreduce_id].coll;
 
     int alltoall_id = find_coll_description(mpi_coll_alltoall_description,
                                             sg_cfg_get_string("smpi/alltoall"),"alltoall");
-    mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype,
-                                     void *, int, MPI_Datatype, MPI_Comm))
+    mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm))
         mpi_coll_alltoall_description[alltoall_id].coll;
 
     int alltoallv_id = find_coll_description(mpi_coll_alltoallv_description,
                                              sg_cfg_get_string("smpi/alltoallv"),"alltoallv");
-    mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype,
-                                      void *, int *, int *, MPI_Datatype,
-                                      MPI_Comm))
+    mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm))
         mpi_coll_alltoallv_description[alltoallv_id].coll;
 
-    int bcast_id = find_coll_description(mpi_coll_bcast_description,
-                                         sg_cfg_get_string("smpi/bcast"),"bcast");
-    mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype,
-                                  int root, MPI_Comm com))
+    int bcast_id = find_coll_description(mpi_coll_bcast_description, sg_cfg_get_string("smpi/bcast"),"bcast");
+    mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com))
         mpi_coll_bcast_description[bcast_id].coll;
 
-    int reduce_id = find_coll_description(mpi_coll_reduce_description,
-                                          sg_cfg_get_string("smpi/reduce"),"reduce");
-    mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count,
-                                   MPI_Datatype datatype, MPI_Op op,
-                                   int root, MPI_Comm comm))
-        mpi_coll_reduce_description[reduce_id].coll;
+    int reduce_id = find_coll_description(mpi_coll_reduce_description, sg_cfg_get_string("smpi/reduce"),"reduce");
+    mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
+                                    MPI_Comm comm)) mpi_coll_reduce_description[reduce_id].coll;
 
     int reduce_scatter_id =
         find_coll_description(mpi_coll_reduce_scatter_description,
                               sg_cfg_get_string("smpi/reduce_scatter"),"reduce_scatter");
-    mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts,
-                                           MPI_Datatype dtype, MPI_Op op,
-                                           MPI_Comm comm))
-        mpi_coll_reduce_scatter_description[reduce_scatter_id].coll;
-
-    int scatter_id = find_coll_description(mpi_coll_scatter_description,
-                                           sg_cfg_get_string("smpi/scatter"),"scatter");
-    mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount,
-                                    MPI_Datatype sendtype, void *recvbuf,
-                                    int recvcount, MPI_Datatype recvtype,
-                                    int root, MPI_Comm comm))
+    mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype, MPI_Op op,
+                                           MPI_Comm comm)) mpi_coll_reduce_scatter_description[reduce_scatter_id].coll;
+
+    int scatter_id = find_coll_description(mpi_coll_scatter_description, sg_cfg_get_string("smpi/scatter"),"scatter");
+    mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                                    int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm))
         mpi_coll_scatter_description[scatter_id].coll;
 
-    int barrier_id = find_coll_description(mpi_coll_barrier_description,
-                                           sg_cfg_get_string("smpi/barrier"),"barrier");
-    mpi_coll_barrier_fun = (int (*)(MPI_Comm comm))
-        mpi_coll_barrier_description[barrier_id].coll;
+    int barrier_id = find_coll_description(mpi_coll_barrier_description, sg_cfg_get_string("smpi/barrier"),"barrier");
+    mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll;
 
     smpi_cpu_threshold = sg_cfg_get_double("smpi/cpu_threshold");
     smpi_running_power = sg_cfg_get_double("smpi/running_power");
     smpi_privatize_global_variables = sg_cfg_get_boolean("smpi/privatize_global_variables");
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
-
 }
 
 int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
@@ -646,15 +587,13 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
   srand(SMPI_RAND_SEED);
 
   if (getenv("SMPI_PRETEND_CC") != NULL) {
-    /* Hack to ensure that smpicc can pretend to be a simple
-     * compiler. Particularly handy to pass it to the configuration tools */
+    /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the
+     * configuration tools */
     return 0;
   }
-
   smpi_init_logs();
 
   TRACE_global_init(&argc, argv);
-
   TRACE_add_start_function(TRACE_smpi_alloc);
   TRACE_add_end_function(TRACE_smpi_release);
 
@@ -693,15 +632,14 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
       double global_time = xbt_os_timer_elapsed(global_timer);
       XBT_INFO("Simulated time: %g seconds. \n\n"
           "The simulation took %g seconds (after parsing and platform setup)\n"
-          "%g seconds were actual computation of the application"
-          SIMIX_get_clock(), global_time , smpi_total_benched_time);
+          "%g seconds were actual computation of the application",
+          SIMIX_get_clock(), global_time , smpi_total_benched_time);
           
       if (smpi_total_benched_time/global_time>=0.75)
       XBT_INFO("More than 75%% of the time was spent inside the application code.\n"
       "You may want to use sampling functions or trace replay to reduce this.");
     }
   }
-
   smpi_global_destroy();
 
   TRACE_end();
index 2c7bff8..247c68b 100644 (file)
@@ -6,8 +6,7 @@
 
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi,
-                                "Logging specific to SMPI (group)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi, "Logging specific to SMPI (group)");
 
 typedef struct s_smpi_mpi_group {
   int size;
@@ -50,10 +49,8 @@ MPI_Group smpi_group_copy(MPI_Group origin)
   xbt_dict_cursor_t cursor = NULL;
   
   int i;
-  if(origin!= smpi_comm_group(MPI_COMM_WORLD)
-            && origin != MPI_GROUP_NULL
-            && origin != smpi_comm_group(MPI_COMM_SELF)
-            && origin != MPI_GROUP_EMPTY)
+  if(origin!= smpi_comm_group(MPI_COMM_WORLD) && origin != MPI_GROUP_NULL
+            && origin != smpi_comm_group(MPI_COMM_SELF) && origin != MPI_GROUP_EMPTY)
     {
       group = xbt_new(s_smpi_mpi_group_t, 1);
       group->size = origin->size;
@@ -72,7 +69,6 @@ MPI_Group smpi_group_copy(MPI_Group origin)
   return group;
 }
 
-
 void smpi_group_destroy(MPI_Group group)
 {
   if(group!= smpi_comm_group(MPI_COMM_WORLD)
@@ -137,7 +133,6 @@ int smpi_group_unuse(MPI_Group group)
     return 0;
   }
   return group->refcount;
-
 }
 
 int smpi_group_size(MPI_Group group)
index 9e205d6..0c29b39 100644 (file)
@@ -17,8 +17,7 @@
 
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi,
-                                "Memory layout support for SMPI");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI");
 
 #define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
 
@@ -39,17 +38,14 @@ void smpi_get_executable_global_size(void)
     // anonymous data segment. This does not happen in practice, however.
 
     // File backed RW entry:
-    if (i->pathname == full_name
-        && (i->prot & PROT_RWX) == PROT_RW) {
+    if (i->pathname == full_name && (i->prot & PROT_RWX) == PROT_RW) {
       smpi_start_data_exe = (char*) i->start_addr;
       smpi_size_data_exe = i->end_addr - i->start_addr;
       ++i;
       /* Here we are making the assumption that a suitable empty region
          following the rw- area is the end of the data segment. It would
          be better to check with the size of the data segment. */
-      if (i != map.end()
-          && i->pathname.empty()
-          && (i->prot & PROT_RWX) == PROT_RW
+      if (i != map.end() && i->pathname.empty() && (i->prot & PROT_RWX) == PROT_RW
           && i->start_addr == (std::uint64_t) smpi_start_data_exe + smpi_size_data_exe) {
         smpi_size_data_exe = i->end_addr - (std::uint64_t) smpi_start_data_exe;
       }
@@ -58,5 +54,4 @@ void smpi_get_executable_global_size(void)
   }
   xbt_die("Did not find my data segment.");
 }
-
 #endif
index 18ae4f4..1dd328b 100644 (file)
@@ -7,14 +7,12 @@
 #include "private.h"
 #include "simgrid/sg_config.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
-                                "Logging specific to SMPI (mpi)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI (mpi)");
 
 /* MPI User level calls */
 
 int MPI_Init(int *argc, char ***argv)
 {
-
   return PMPI_Init(argc, argv);
 }
 
@@ -103,7 +101,8 @@ int MPI_Type_delete_attr (MPI_Datatype type, int type_keyval)
    return PMPI_Type_delete_attr (type,  type_keyval);
 }
 
-int MPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int MPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+                           void* extra_state)
 {
    return PMPI_Type_create_keyval(copy_fn,  delete_fn,  keyval,  extra_state) ;
 }
@@ -172,8 +171,7 @@ int MPI_Group_rank(MPI_Group group, int *rank)
   return PMPI_Group_rank(group, rank);
 }
 
-int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
-                              MPI_Group group2, int *ranks2)
+int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1, MPI_Group group2, int *ranks2)
 {
   return PMPI_Group_translate_ranks(group1, n, ranks1, group2, ranks2);
 }
@@ -208,14 +206,12 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
   return PMPI_Group_excl(group, n, ranks, newgroup);
 }
 
-int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
-                         MPI_Group * newgroup)
+int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
 {
   return PMPI_Group_range_incl(group, n, ranges, newgroup);
 }
 
-int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
-                         MPI_Group * newgroup)
+int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
 {
   return PMPI_Group_range_excl(group, n, ranges, newgroup);
 }
@@ -245,7 +241,8 @@ int MPI_Comm_delete_attr (MPI_Comm comm, int comm_keyval)
    return PMPI_Comm_delete_attr (comm,  comm_keyval);
 }
 
-int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+                           void* extra_state)
 {
    return PMPI_Comm_create_keyval(copy_fn,  delete_fn,  keyval,  extra_state) ;
 }
@@ -294,14 +291,12 @@ int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
   return PMPI_Comm_split(comm, color, key, comm_out);
 }
 
-int MPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
-                  int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
 {
   return PMPI_Send_init(buf, count, datatype, dst, tag, comm, request);
 }
 
-int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
-                  int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
 {
   return PMPI_Recv_init(buf, count, datatype, src, tag, comm, request);
 }
@@ -321,46 +316,37 @@ int MPI_Request_free(MPI_Request * request)
   return PMPI_Request_free(request);
 }
 
-int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
-              int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
 {
   return PMPI_Irecv(buf, count, datatype, src, tag, comm, request);
 }
 
-int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
-              int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
 {
   return PMPI_Isend(buf, count, datatype, dst, tag, comm, request);
 }
 
-int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
-             MPI_Comm comm, MPI_Status * status)
+int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
 {
   return PMPI_Recv(buf, count, datatype, src, tag, comm, status);
 }
 
-int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
-             MPI_Comm comm)
+int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   return PMPI_Send(buf, count, datatype, dst, tag, comm);
 }
 
-int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                 int dst, int sendtag, void *recvbuf, int recvcount,
-                 MPI_Datatype recvtype, int src, int recvtag,
-                 MPI_Comm comm, MPI_Status * status)
+int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int dst, int sendtag, void *recvbuf, int recvcount,
+                 MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status * status)
 {
-  return PMPI_Sendrecv(sendbuf, sendcount, sendtype, dst, sendtag,
-                       recvbuf, recvcount, recvtype, src, recvtag,
+  return PMPI_Sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf, recvcount, recvtype, src, recvtag,
                        comm, status);
 }
 
-int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
-                         int dst, int sendtag, int src, int recvtag,
+int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dst, int sendtag, int src, int recvtag,
                          MPI_Comm comm, MPI_Status * status)
 {
-  return PMPI_Sendrecv_replace(buf, count, datatype, dst, sendtag, src,
-                               recvtag, comm, status);
+  return PMPI_Sendrecv_replace(buf, count, datatype, dst, sendtag, src, recvtag, comm, status);
 }
 
 int MPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
@@ -368,8 +354,7 @@ int MPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
   return PMPI_Test(request, flag, status);
 }
 
-int MPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
-                MPI_Status * status)
+int MPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status)
 {
   return PMPI_Testany(count, requests, index, flag, status);
 }
@@ -389,8 +374,7 @@ int MPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
   return PMPI_Waitall(count, requests, status);
 }
 
-int MPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
-                 int *indices, MPI_Status status[])
+int MPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int *indices, MPI_Status status[])
 {
   return PMPI_Waitsome(incount, requests, outcount, indices, status);
 }
@@ -405,111 +389,82 @@ int MPI_Barrier(MPI_Comm comm)
   return PMPI_Barrier(comm);
 }
 
-int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-               void *recvbuf, int recvcount, MPI_Datatype recvtype,
+int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype,
                int root, MPI_Comm comm)
 {
-  return PMPI_Gather(sendbuf, sendcount, sendtype,
-                     recvbuf, recvcount, recvtype,
-                     root, comm);
+  return PMPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
 }
 
-int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                void *recvbuf, int *recvcounts, int *displs,
+int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
                 MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
-  return PMPI_Gatherv(sendbuf, sendcount, sendtype,
-                      recvbuf, recvcounts, displs, recvtype,
-                      root, comm);
+  return PMPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm);
 }
 
-int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                  void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                  MPI_Comm comm)
+int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount,
+                  MPI_Datatype recvtype, MPI_Comm comm)
 {
-  return PMPI_Allgather(sendbuf, sendcount, sendtype,
-                        recvbuf, recvcount, recvtype,
-                        comm);
+  return PMPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
 }
 
-int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                   void *recvbuf, int *recvcounts, int *displs,
+int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
                    MPI_Datatype recvtype, MPI_Comm comm)
 {
-  return PMPI_Allgatherv(sendbuf, sendcount, sendtype,
-                         recvbuf, recvcounts, displs, recvtype,
-                         comm);
+  return PMPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
 }
 
-int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                void *recvbuf, int recvcount, MPI_Datatype recvtype,
+int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,
                 int root, MPI_Comm comm)
 {
-  return PMPI_Scatter(sendbuf, sendcount, sendtype,
-                      recvbuf, recvcount, recvtype,
-                      root, comm);
+  return PMPI_Scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
 }
 
-int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
-                 MPI_Datatype sendtype, void *recvbuf, int recvcount,
+int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount,
                  MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
-  return PMPI_Scatterv(sendbuf, sendcounts, displs, sendtype,
-                       recvbuf, recvcount, recvtype,
-                       root, comm);
+  return PMPI_Scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
 }
 
-int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
-               MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
+int MPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
 {
   return PMPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
 }
 
-int MPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
-    MPI_Datatype datatype, MPI_Op op){
+int MPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op){
   return PMPI_Reduce_local(inbuf, inoutbuf, count, datatype, op);
 }
 
-int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
-                  MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   return PMPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
 }
 
-int MPI_Scan(void *sendbuf, void *recvbuf, int count,
-             MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   return PMPI_Scan(sendbuf, recvbuf, count, datatype, op, comm);
 }
 
-int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
-                       MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   return PMPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm);
 }
 
-int MPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
-                      MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op,
+                             MPI_Comm comm)
 {
   return PMPI_Reduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm);
 }
 
-int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                 void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                 MPI_Comm comm)
+int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount,
+                 MPI_Datatype recvtype, MPI_Comm comm)
 {
-  return PMPI_Alltoall(sendbuf, sendcount, sendtype,
-                       recvbuf, recvcount, recvtype,
-                       comm);
+  return PMPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
 }
 
-int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
-                  MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
+int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
                   int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
 {
-  return PMPI_Alltoallv(sendbuf, sendcounts, senddisps, sendtype,
-                        recvbuf, recvcounts, recvdisps, recvtype,
-                        comm);
+  return PMPI_Alltoallv(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype, comm);
 }
 
 int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr){
@@ -666,11 +621,13 @@ int MPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MP
   return PMPI_Pack_external_size(datarep, incount, datatype, size);
 }
 
-int MPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position){
+int MPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount,
+                      MPI_Aint *position){
   return PMPI_Pack_external(datarep, inbuf, incount, datatype, outbuf, outcount, position);
 }
 
-int MPI_Unpack_external( char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype){
+int MPI_Unpack_external(char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount,
+                        MPI_Datatype datatype){
   return PMPI_Unpack_external( datarep, inbuf, insize, position, outbuf, outcount, datatype);
 }
 
@@ -682,11 +639,13 @@ int MPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype
   return PMPI_Type_hindexed(count, blocklens, indices, old_type, newtype);
 }
 
-int MPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int MPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+                             MPI_Datatype* new_type) {
   return PMPI_Type_create_hindexed(count, blocklens,indices,old_type,new_type);
 }
 
-int MPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) {
+int MPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type,
+                                   MPI_Datatype* newtype) {
   return PMPI_Type_create_hindexed_block(count, blocklength, indices, old_type, newtype);
 }
 
@@ -702,7 +661,8 @@ int MPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Datatyp
   return PMPI_Type_create_indexed(count, blocklens, indices, old_type, newtype);
 }
 
-int MPI_Type_create_indexed_block(int count, int blocklength, int* indices,  MPI_Datatype old_type,  MPI_Datatype *newtype){
+int MPI_Type_create_indexed_block(int count, int blocklength, int* indices,  MPI_Datatype old_type,
+                                  MPI_Datatype *newtype){
   return PMPI_Type_create_indexed_block(count, blocklength, indices, old_type, newtype);
 }
 
@@ -710,7 +670,8 @@ int MPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype*
   return PMPI_Type_struct(count, blocklens, indices, old_types, newtype);
 }
 
-int MPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) {
+int MPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+                           MPI_Datatype* newtype) {
   return PMPI_Type_create_struct(count, blocklens, indices, old_types, newtype);
 }
 
@@ -722,11 +683,12 @@ int MPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MP
   return PMPI_Ssend(buf, count, datatype, dest, tag, comm);
 }
 
-int MPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int MPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request){
   return PMPI_Ssend_init(buf, count, datatype, dest, tag, comm, request);
 }
 
-int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
+int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag,
+                         MPI_Comm* comm_out) {
   return PMPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, comm_out);
 }
 
@@ -738,7 +700,7 @@ int MPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MP
   return PMPI_Bsend(buf, count, datatype, dest, tag, comm);
 }
 
-int MPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int MPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request){
   return PMPI_Bsend_init(buf, count, datatype, dest, tag, comm, request);
 }
 
@@ -778,7 +740,7 @@ int MPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MP
   return PMPI_Rsend(buf, count, datatype, dest, tag, comm);
 }
 
-int MPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int MPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request){
   return PMPI_Rsend_init(buf, count, datatype, dest, tag, comm, request);
 }
 
@@ -886,14 +848,12 @@ int MPI_Info_free( MPI_Info *info){
 
 int MPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
     MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
-  return PMPI_Get( origin_addr,origin_count, origin_datatype,target_rank,
-      target_disp, target_count,target_datatype, win);
+  return PMPI_Get(origin_addr,origin_count, origin_datatype,target_rank, target_disp, target_count,target_datatype,win);
 }
 
 int MPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
     MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
-  return PMPI_Put( origin_addr,origin_count, origin_datatype,target_rank,
-      target_disp, target_count,target_datatype, win);
+  return PMPI_Put(origin_addr,origin_count, origin_datatype,target_rank,target_disp, target_count,target_datatype, win);
 }
 
 int MPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
@@ -904,23 +864,19 @@ int MPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_dat
 
 int MPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers,
                           int *num_addresses, int *num_datatypes, int *combiner){
-  return PMPI_Type_get_envelope(  datatype, num_integers,
-      num_addresses, num_datatypes, combiner);
+  return PMPI_Type_get_envelope(  datatype, num_integers, num_addresses, num_datatypes, combiner);
 }
 
-int MPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses,
-                            int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
-                            MPI_Datatype *array_of_datatypes){
-  return PMPI_Type_get_contents(datatype, max_integers, max_addresses,
-      max_datatypes, array_of_integers, array_of_addresses,
-       array_of_datatypes);
+int MPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes,
+                          int* array_of_integers, MPI_Aint* array_of_addresses, MPI_Datatype *array_of_datatypes){
+  return PMPI_Type_get_contents(datatype, max_integers, max_addresses,max_datatypes, array_of_integers,
+                                array_of_addresses, array_of_datatypes);
 }
 
-int MPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes,
-                            int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
-                            int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
-  return PMPI_Type_create_darray(size, rank, ndims,  array_of_gsizes,
-       array_of_distribs,  array_of_dargs,  array_of_psizes,
+int MPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes, int* array_of_distribs,
+                            int* array_of_dargs, int* array_of_psizes,int order, MPI_Datatype oldtype,
+                            MPI_Datatype *newtype) {
+  return PMPI_Type_create_darray(size, rank, ndims, array_of_gsizes,array_of_distribs, array_of_dargs, array_of_psizes,
       order,  oldtype, newtype) ;
 }
 
@@ -928,7 +884,8 @@ int MPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, M
   return PMPI_Type_create_resized(oldtype,lb, extent, newtype);
 }
 
-int MPI_Type_create_subarray(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order, MPI_Datatype oldtype, MPI_Datatype *newtype){
+int MPI_Type_create_subarray(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order,
+                             MPI_Datatype oldtype, MPI_Datatype *newtype){
   return PMPI_Type_create_subarray(ndims,array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype);
 }
 
@@ -937,15 +894,11 @@ int MPI_Type_match_size(int typeclass,int size,MPI_Datatype *datatype){
 }
 
 int MPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
-                   void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes,
-                   MPI_Comm comm){
-  return PMPI_Alltoallw( sendbuf, sendcnts, sdispls, sendtypes,
-      recvbuf, recvcnts, rdispls, recvtypes,
-      comm);
+                   void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes, MPI_Comm comm){
+  return PMPI_Alltoallw( sendbuf, sendcnts, sdispls, sendtypes, recvbuf, recvcnts, rdispls, recvtypes, comm);
 }
 
-int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
-                MPI_Op op, MPI_Comm comm){
+int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm){
   return PMPI_Exscan(sendbuf, recvbuf, count, datatype, op, comm);
 }
 
@@ -1025,7 +978,8 @@ int MPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status){
   return PMPI_Request_get_status( request, flag, status);
 }
 
-int MPI_Grequest_start( MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request){
+int MPI_Grequest_start(MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn,
+                       MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request){
   return PMPI_Grequest_start( query_fn, free_fn, cancel_fn, extra_state, request);
 }
 
@@ -1078,9 +1032,9 @@ int MPI_Comm_spawn( char *command, char **argv, int maxprocs, MPI_Info info, int
   return PMPI_Comm_spawn( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes);
 }
 
-int MPI_Comm_spawn_multiple( int count, char **array_of_commands, char*** array_of_argv,
-                             int* array_of_maxprocs, MPI_Info* array_of_info, int root,
-                             MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
+int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char*** array_of_argv, int* array_of_maxprocs,
+                            MPI_Info* array_of_info, int root, MPI_Comm comm, MPI_Comm *intercomm,
+                            int* array_of_errcodes){
   return PMPI_Comm_spawn_multiple( count, array_of_commands, array_of_argv, array_of_maxprocs,
                                   array_of_info, root, comm, intercomm, array_of_errcodes);
 }
index bee1d73..59af331 100644 (file)
@@ -17,8 +17,7 @@
 #include "xbt/replay.h"
 #include "simgrid/modelchecker.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi,
-                                "Logging specific to SMPI (datatype)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi, "Logging specific to SMPI (datatype)");
 
 xbt_dict_t smpi_type_keyvals = NULL;
 int type_keyval_id=0;//avoid collisions
@@ -154,11 +153,9 @@ CREATE_MPI_DATATYPE(MPI_PACKED, char);
 // Internal use only
 CREATE_MPI_DATATYPE(MPI_PTR, void*);
 
-/** Check if the datatype is usable for communications
- */
+/** Check if the datatype is usable for communications */
 int is_datatype_valid(MPI_Datatype datatype) {
-    return datatype != MPI_DATATYPE_NULL
-        && (datatype->flags & DT_FLAG_COMMITED);
+    return datatype != MPI_DATATYPE_NULL && (datatype->flags & DT_FLAG_COMMITED);
 }
 
 size_t smpi_datatype_size(MPI_Datatype datatype)
@@ -196,7 +193,8 @@ int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t)
       void* value_in;
       void* value_out;
       xbt_dict_foreach(datatype->attributes, cursor, key, value_in){
-        smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals,  (const char*)key, sizeof(int)));
+        smpi_type_key_elem elem =
+          static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals,  (const char*)key, sizeof(int)));
         if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){
           ret = elem->copy_fn(datatype, *key, NULL, value_in, &value_out, &flag );
           if(ret!=MPI_SUCCESS){
@@ -211,8 +209,7 @@ int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t)
   return ret;
 }
 
-int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
-                         MPI_Aint * extent)
+int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
 {
   if(datatype == MPI_DATATYPE_NULL){
     *lb=0;
@@ -269,7 +266,6 @@ int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     }else{
       s_smpi_subtype_t *subtype =  static_cast<s_smpi_subtype_t*>(sendtype->substruct);
 
-
       void * buf_tmp = xbt_malloc(count);
 
       subtype->serialize( sendbuf, buf_tmp,count/smpi_datatype_size(sendtype), subtype);
@@ -292,10 +288,7 @@ int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void serialize_vector( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type)
+void serialize_vector( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type)
 {
   s_smpi_mpi_vector_t* type_c = (s_smpi_mpi_vector_t*)type;
   int i;
@@ -304,19 +297,17 @@ void serialize_vector( const void *noncontiguous_vector,
 
   for (i = 0; i < type_c->block_count * count; i++) {
       if (type_c->old_type->has_subtype == 0)
-        memcpy(contiguous_vector_char,
-               noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
+        memcpy(contiguous_vector_char, noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
       else
         ((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_vector_char,
                                                                      contiguous_vector_char,
-                                                                     type_c->block_length,
-                                                                     type_c->old_type->substruct);
+                                                                     type_c->block_length, type_c->old_type->substruct);
 
     contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
     if((i+1)%type_c->block_count ==0)
-    noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
+      noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
     else
-    noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
+      noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
   }
 }
 
@@ -329,11 +320,7 @@ void serialize_vector( const void *noncontiguous_vector,
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void unserialize_vector( const void *contiguous_vector,
-                         void *noncontiguous_vector,
-                         int count,
-                         void *type,
-                         MPI_Op op)
+void unserialize_vector( const void *contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
 {
   s_smpi_mpi_vector_t* type_c = (s_smpi_mpi_vector_t*)type;
   int i;
@@ -348,30 +335,21 @@ void unserialize_vector( const void *contiguous_vector,
      /* memcpy(noncontiguous_vector_char,
              contiguous_vector_char, type_c->block_length * type_c->size_oldtype);*/
     else
-      ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_vector_char,
-                                                                     noncontiguous_vector_char,
-                                                                     type_c->block_length,
-                                                                     type_c->old_type->substruct,
-                                                                     op);
+      ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize(contiguous_vector_char, noncontiguous_vector_char,
+                                                                    type_c->block_length,type_c->old_type->substruct,
+                                                                    op);
     contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
     if((i+1)%type_c->block_count ==0)
-    noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
+      noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
     else
-    noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
+      noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
   }
 }
 
-/*
- * Create a Sub type vector to be able to serialize and unserialize it
- * the structure s_smpi_mpi_vector_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
- *
- */
-s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride,
-                                                  int block_length,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype){
+/* Create a Sub type vector to be able to serialize and unserialize it the structure s_smpi_mpi_vector_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize */
+s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride, int block_length, int block_count,
+                                                  MPI_Datatype old_type, int size_oldtype){
   s_smpi_mpi_vector_t *new_t= xbt_new(s_smpi_mpi_vector_t,1);
   new_t->base.serialize = &serialize_vector;
   new_t->base.unserialize = &unserialize_vector;
@@ -385,8 +363,8 @@ s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride,
   return new_t;
 }
 
-void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype,
-    void *struct_type, int flags){
+void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype, void *struct_type,
+                          int flags){
   MPI_Datatype new_t= xbt_new(s_smpi_mpi_datatype_t,1);
   new_t->name = NULL;
   new_t->size = size;
@@ -408,15 +386,16 @@ void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int h
 void smpi_datatype_free(MPI_Datatype* type){
   xbt_assert((*type)->in_use >= 0);
   if((*type)->attributes !=NULL){
-      xbt_dict_cursor_t cursor = NULL;
-      int* key;
-      void * value;
-      int flag;
-      xbt_dict_foreach((*type)->attributes, cursor, key, value){
-        smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)));
-        if(elem &&  elem->delete_fn)
-          elem->delete_fn(*type,*key, value, &flag);
-      }
+    xbt_dict_cursor_t cursor = NULL;
+    int* key;
+    void * value;
+    int flag;
+    xbt_dict_foreach((*type)->attributes, cursor, key, value){
+      smpi_type_key_elem elem =
+          static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)));
+      if(elem &&  elem->delete_fn)
+        elem->delete_fn(*type,*key, value, &flag);
+    }
   }
 
   if((*type)->flags & DT_FLAG_PREDEFINED)return;
@@ -447,7 +426,6 @@ void smpi_datatype_use(MPI_Datatype type){
 #endif
 }
 
-
 void smpi_datatype_unuse(MPI_Datatype type){
   if (type->in_use > 0)
     type->in_use--;
@@ -461,16 +439,9 @@ void smpi_datatype_unuse(MPI_Datatype type){
 #endif
 }
 
+/*Contiguous Implementation*/
 
-
-
-/*
-Contiguous Implementation
-*/
-
-
-/*
- *  Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
  *  @param contiguous_hvector - output hvector
  *  @param noncontiguous_hvector - input hvector
  *  @param type - pointer contening :
@@ -478,19 +449,14 @@ Contiguous Implementation
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void serialize_contiguous( const void *noncontiguous_hvector,
-                       void *contiguous_hvector,
-                       int count,
-                       void *type)
+void serialize_contiguous( const void *noncontiguous_hvector, void *contiguous_hvector, int count, void *type)
 {
   s_smpi_mpi_contiguous_t* type_c = (s_smpi_mpi_contiguous_t*)type;
   char* contiguous_vector_char = (char*)contiguous_hvector;
   char* noncontiguous_vector_char = (char*)noncontiguous_hvector+type_c->lb;
-  memcpy(contiguous_vector_char,
-           noncontiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);
+  memcpy(contiguous_vector_char, noncontiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);
 }
-/*
- *  Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
  *  @param noncontiguous_vector - output hvector
  *  @param contiguous_vector - input hvector
  *  @param type - pointer contening :
@@ -498,35 +464,23 @@ void serialize_contiguous( const void *noncontiguous_hvector,
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void unserialize_contiguous( const void *contiguous_vector,
-                         void *noncontiguous_vector,
-                         int count,
-                         void *type,
-                         MPI_Op op)
+void unserialize_contiguous(const void *contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
 {
   s_smpi_mpi_contiguous_t* type_c = (s_smpi_mpi_contiguous_t*)type;
   char* contiguous_vector_char = (char*)contiguous_vector;
   char* noncontiguous_vector_char = (char*)noncontiguous_vector+type_c->lb;
   int n= count* type_c->block_count;
-  smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &n,
-            &type_c->old_type);
-       /*memcpy(noncontiguous_vector_char,
-           contiguous_vector_char, count*  type_c->block_count * type_c->size_oldtype);*/
+  smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &n, &type_c->old_type);
+  /*memcpy(noncontiguous_vector_char, contiguous_vector_char, count*  type_c->block_count * type_c->size_oldtype);*/
 }
 
 void free_contiguous(MPI_Datatype* d){
   smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
 }
 
-/*
- * Create a Sub type contiguous to be able to serialize and unserialize it
- * the structure s_smpi_mpi_contiguous_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
- *
- */
-s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
+/* Create a Sub type contiguous to be able to serialize and unserialize it the structure s_smpi_mpi_contiguous_t is
+ * erived from s_smpi_subtype which required the functions unserialize and serialize */
+s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count, MPI_Datatype old_type,
                                                   int size_oldtype){
   s_smpi_mpi_contiguous_t *new_t= xbt_new(s_smpi_mpi_contiguous_t,1);
   new_t->base.serialize = &serialize_contiguous;
@@ -540,9 +494,6 @@ s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb,
   return new_t;
 }
 
-
-
-
 int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type, MPI_Aint lb)
 {
   int retval;
@@ -551,14 +502,9 @@ int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new
     return smpi_datatype_hvector(count, 1, smpi_datatype_get_extent(old_type), old_type, new_type);
   }
   
-  s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
-                                                                count,
-                                                                old_type,
-                                                                smpi_datatype_size(old_type));
-                                                                
-  smpi_datatype_create(new_type,
-            count * smpi_datatype_size(old_type),
-            lb,lb + count * smpi_datatype_size(old_type),
+  s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, count, old_type,smpi_datatype_size(old_type));
+
+  smpi_datatype_create(new_type, count * smpi_datatype_size(old_type),lb,lb + count * smpi_datatype_size(old_type),
             1,subtype, DT_FLAG_CONTIGUOUS);
   retval=MPI_SUCCESS;
   return retval;
@@ -576,28 +522,15 @@ int smpi_datatype_vector(int count, int blocklen, int stride, MPI_Datatype old_t
   }
   if(old_type->has_subtype || stride != blocklen){
 
-
-    s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create( stride,
-                                                                blocklen,
-                                                                count,
-                                                                old_type,
+    s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create(stride, blocklen, count, old_type,
                                                                 smpi_datatype_size(old_type));
-    smpi_datatype_create(new_type,
-                         count * (blocklen) * smpi_datatype_size(old_type), lb,
-                         ub,
-                         1,
-                         subtype,
+    smpi_datatype_create(new_type, count * (blocklen) * smpi_datatype_size(old_type), lb, ub, 1, subtype,
                          DT_FLAG_VECTOR);
     retval=MPI_SUCCESS;
   }else{
-    /* in this situation the data are contignous thus it's not
-     * required to serialize and unserialize it*/
-    smpi_datatype_create(new_type, count * blocklen *
-                         smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
-                         smpi_datatype_size(old_type),
-                         0,
-                         NULL,
-                         DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+    /* in this situation the data are contignous thus it's not required to serialize and unserialize it*/
+    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
+                         smpi_datatype_size(old_type), 0, NULL, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
     retval=MPI_SUCCESS;
   }
   return retval;
@@ -607,13 +540,9 @@ void free_vector(MPI_Datatype* d){
   smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
 }
 
-/*
-Hvector Implementation - Vector with stride in bytes
-*/
-
+/* Hvector Implementation - Vector with stride in bytes */
 
-/*
- *  Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
  *  @param contiguous_hvector - output hvector
  *  @param noncontiguous_hvector - input hvector
  *  @param type - pointer contening :
@@ -621,10 +550,7 @@ Hvector Implementation - Vector with stride in bytes
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void serialize_hvector( const void *noncontiguous_hvector,
-                       void *contiguous_hvector,
-                       int count,
-                       void *type)
+void serialize_hvector( const void *noncontiguous_hvector, void *contiguous_hvector, int count, void *type)
 {
   s_smpi_mpi_hvector_t* type_c = (s_smpi_mpi_hvector_t*)type;
   int i;
@@ -633,23 +559,20 @@ void serialize_hvector( const void *noncontiguous_hvector,
 
   for (i = 0; i < type_c->block_count * count; i++) {
     if (type_c->old_type->has_subtype == 0)
-      memcpy(contiguous_vector_char,
-           noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
+      memcpy(contiguous_vector_char, noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
     else
       ((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_vector_char,
                                                                    contiguous_vector_char,
-                                                                   type_c->block_length,
-                                                                   type_c->old_type->substruct);
+                                                                   type_c->block_length, type_c->old_type->substruct);
 
     contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
     if((i+1)%type_c->block_count ==0)
-    noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
+      noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
     else
-    noncontiguous_vector_char += type_c->block_stride;
+      noncontiguous_vector_char += type_c->block_stride;
   }
 }
-/*
- *  Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
  *  @param noncontiguous_vector - output hvector
  *  @param contiguous_vector - input hvector
  *  @param type - pointer contening :
@@ -657,11 +580,7 @@ void serialize_hvector( const void *noncontiguous_hvector,
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void unserialize_hvector( const void *contiguous_vector,
-                         void *noncontiguous_vector,
-                         int count,
-                         void *type,
-                         MPI_Op op)
+void unserialize_hvector( const void *contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
 {
   s_smpi_mpi_hvector_t* type_c = (s_smpi_mpi_hvector_t*)type;
   int i;
@@ -671,35 +590,27 @@ void unserialize_hvector( const void *contiguous_vector,
 
   for (i = 0; i < type_c->block_count * count; i++) {
     if (type_c->old_type->has_subtype == 0)
-      smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &type_c->block_length,
-                  &type_c->old_type);
+      smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &type_c->block_length, &type_c->old_type);
              /*memcpy(noncontiguous_vector_char,
            contiguous_vector_char, type_c->block_length * type_c->size_oldtype);*/
     else
-      ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_vector_char,
-                                                                     noncontiguous_vector_char,
-                                                                     type_c->block_length,
-                                                                     type_c->old_type->substruct,
+      ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_vector_char, noncontiguous_vector_char,
+                                                                     type_c->block_length, type_c->old_type->substruct,
                                                                      op);
     contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
     if((i+1)%type_c->block_count ==0)
-    noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
+      noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
     else
-    noncontiguous_vector_char += type_c->block_stride;
+      noncontiguous_vector_char += type_c->block_stride;
   }
 }
 
-/*
- * Create a Sub type vector to be able to serialize and unserialize it
- * the structure s_smpi_mpi_vector_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
+/* Create a Sub type vector to be able to serialize and unserialize it the structure s_smpi_mpi_vector_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize
  *
  */
-s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride,
-                                                  int block_length,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype){
+s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int block_length, int block_count,
+                                                  MPI_Datatype old_type, int size_oldtype){
   s_smpi_mpi_hvector_t *new_t= xbt_new(s_smpi_mpi_hvector_t,1);
   new_t->base.serialize = &serialize_hvector;
   new_t->base.unserialize = &unserialize_hvector;
@@ -729,37 +640,22 @@ int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype
     ub=((count-1)*stride)+(blocklen-1)*smpi_datatype_get_extent(old_type)+smpi_datatype_ub(old_type);
   }
   if(old_type->has_subtype || stride != blocklen*smpi_datatype_get_extent(old_type)){
-    s_smpi_mpi_hvector_t* subtype = smpi_datatype_hvector_create( stride,
-                                                                  blocklen,
-                                                                  count,
-                                                                  old_type,
+    s_smpi_mpi_hvector_t* subtype = smpi_datatype_hvector_create( stride, blocklen, count, old_type,
                                                                   smpi_datatype_size(old_type));
 
-    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),
-             lb,ub,
-                         1,
-                         subtype,
-                         DT_FLAG_VECTOR);
+    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), lb,ub, 1, subtype, DT_FLAG_VECTOR);
     retval=MPI_SUCCESS;
   }else{
-    smpi_datatype_create(new_type, count * blocklen *
-                                             smpi_datatype_size(old_type),0,count * blocklen *
-                                             smpi_datatype_size(old_type),
-                                            0,
-                                            NULL,
-                                            DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),0,count * blocklen *
+                                             smpi_datatype_size(old_type), 0, NULL, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
     retval=MPI_SUCCESS;
   }
   return retval;
 }
 
+/* Indexed Implementation */
 
-/*
-Indexed Implementation
-*/
-
-/*
- *  Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
  *  @param contiguous_indexed - output indexed
  *  @param noncontiguous_indexed - input indexed
  *  @param type - pointer contening :
@@ -767,10 +663,7 @@ Indexed Implementation
  *      - block_indices - indices of each data, in element
  *      - count - the number of rows of matrix
  */
-void serialize_indexed( const void *noncontiguous_indexed,
-                       void *contiguous_indexed,
-                       int count,
-                       void *type)
+void serialize_indexed( const void *noncontiguous_indexed, void *contiguous_indexed, int count, void *type)
 {
   s_smpi_mpi_indexed_t* type_c = (s_smpi_mpi_indexed_t*)type;
   int i,j;
@@ -779,24 +672,24 @@ void serialize_indexed( const void *noncontiguous_indexed,
   for(j=0; j<count;j++){
     for (i = 0; i < type_c->block_count; i++) {
       if (type_c->old_type->has_subtype == 0)
-        memcpy(contiguous_indexed_char,
-                     noncontiguous_indexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
+        memcpy(contiguous_indexed_char, noncontiguous_indexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
       else
         ((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_indexed_char,
                                                                      contiguous_indexed_char,
                                                                      type_c->block_lengths[i],
                                                                      type_c->old_type->substruct);
 
-
       contiguous_indexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-      if (i<type_c->block_count-1)noncontiguous_indexed_char = (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
-      else noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+      if (i<type_c->block_count-1)
+        noncontiguous_indexed_char =
+          (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
+      else
+        noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
     }
     noncontiguous_indexed=(void*)noncontiguous_indexed_char;
   }
 }
-/*
- *  Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
  *  @param noncontiguous_indexed - output indexed
  *  @param contiguous_indexed - input indexed
  *  @param type - pointer contening :
@@ -804,17 +697,13 @@ void serialize_indexed( const void *noncontiguous_indexed,
  *      - block_indices - indices of each data, in element
  *      - count - the number of rows of matrix
  */
-void unserialize_indexed( const void *contiguous_indexed,
-                         void *noncontiguous_indexed,
-                         int count,
-                         void *type,
-                         MPI_Op op)
+void unserialize_indexed( const void *contiguous_indexed, void *noncontiguous_indexed, int count, void *type, MPI_Op op)
 {
-
   s_smpi_mpi_indexed_t* type_c = (s_smpi_mpi_indexed_t*)type;
   int i,j;
   char* contiguous_indexed_char = (char*)contiguous_indexed;
-  char* noncontiguous_indexed_char = (char*)noncontiguous_indexed+type_c->block_indices[0]*smpi_datatype_get_extent(type_c->old_type);
+  char* noncontiguous_indexed_char =
+    (char*)noncontiguous_indexed+type_c->block_indices[0]*smpi_datatype_get_extent(type_c->old_type);
   for(j=0; j<count;j++){
     for (i = 0; i < type_c->block_count; i++) {
       if (type_c->old_type->has_subtype == 0)
@@ -826,13 +715,14 @@ void unserialize_indexed( const void *contiguous_indexed,
         ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_indexed_char,
                                                                        noncontiguous_indexed_char,
                                                                        type_c->block_lengths[i],
-                                                                       type_c->old_type->substruct,
-                                                                       op);
+                                                                       type_c->old_type->substruct, op);
 
       contiguous_indexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
       if (i<type_c->block_count-1)
-        noncontiguous_indexed_char = (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
-      else noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+        noncontiguous_indexed_char =
+          (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
+      else
+        noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
     }
     noncontiguous_indexed=(void*)noncontiguous_indexed_char;
   }
@@ -844,16 +734,10 @@ void free_indexed(MPI_Datatype* type){
   smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*type)->substruct)->old_type);
 }
 
-/*
- * Create a Sub type indexed to be able to serialize and unserialize it
- * the structure s_smpi_mpi_indexed_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
- */
-s_smpi_mpi_indexed_t* smpi_datatype_indexed_create( int* block_lengths,
-                                                  int* block_indices,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype){
+/* Create a Sub type indexed to be able to serialize and unserialize it the structure s_smpi_mpi_indexed_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize */
+s_smpi_mpi_indexed_t* smpi_datatype_indexed_create( int* block_lengths, int* block_indices, int block_count,
+                                                  MPI_Datatype old_type, int size_oldtype){
   s_smpi_mpi_indexed_t *new_t= xbt_new(s_smpi_mpi_indexed_t,1);
   new_t->base.serialize = &serialize_indexed;
   new_t->base.unserialize = &unserialize_indexed;
@@ -873,7 +757,6 @@ s_smpi_mpi_indexed_t* smpi_datatype_indexed_create( int* block_lengths,
   return new_t;
 }
 
-
 int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
 {
   int i;
@@ -903,32 +786,21 @@ int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype
     contiguous=0;
 
   if(!contiguous){
-    s_smpi_mpi_indexed_t* subtype = smpi_datatype_indexed_create( blocklens,
-                                                                  indices,
-                                                                  count,
-                                                                  old_type,
+    s_smpi_mpi_indexed_t* subtype = smpi_datatype_indexed_create( blocklens, indices, count, old_type,
                                                                   smpi_datatype_size(old_type));
-     smpi_datatype_create(new_type,  size *
-                         smpi_datatype_size(old_type),lb,ub,1, subtype, DT_FLAG_DATA);
+     smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type),lb,ub,1, subtype, DT_FLAG_DATA);
   }else{
-    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
-                                                                  size,
-                                                                  old_type,
+    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, size, old_type,
                                                                   smpi_datatype_size(old_type));
-    smpi_datatype_create(new_type,  size *
-                         smpi_datatype_size(old_type),lb,ub,1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
+    smpi_datatype_create(new_type, size * smpi_datatype_size(old_type), lb, ub, 1, subtype,
+                         DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
   }
   retval=MPI_SUCCESS;
   return retval;
 }
+/* Hindexed Implementation - Indexed with indices in bytes */
 
-
-/*
-Hindexed Implementation - Indexed with indices in bytes 
-*/
-
-/*
- *  Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
  *  @param contiguous_hindexed - output hindexed
  *  @param noncontiguous_hindexed - input hindexed
  *  @param type - pointer contening :
@@ -936,10 +808,7 @@ Hindexed Implementation - Indexed with indices in bytes
  *      - block_indices - indices of each data, in bytes
  *      - count - the number of rows of matrix
  */
-void serialize_hindexed( const void *noncontiguous_hindexed,
-                       void *contiguous_hindexed,
-                       int count,
-                       void *type)
+void serialize_hindexed( const void *noncontiguous_hindexed, void *contiguous_hindexed, int count, void *type)
 {
   s_smpi_mpi_hindexed_t* type_c = (s_smpi_mpi_hindexed_t*)type;
   int i,j;
@@ -948,8 +817,7 @@ void serialize_hindexed( const void *noncontiguous_hindexed,
   for(j=0; j<count;j++){
     for (i = 0; i < type_c->block_count; i++) {
       if (type_c->old_type->has_subtype == 0)
-        memcpy(contiguous_hindexed_char,
-                     noncontiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
+        memcpy(contiguous_hindexed_char, noncontiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
       else
         ((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_hindexed_char,
                                                                      contiguous_hindexed_char,
@@ -957,14 +825,15 @@ void serialize_hindexed( const void *noncontiguous_hindexed,
                                                                      type_c->old_type->substruct);
 
       contiguous_hindexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-      if (i<type_c->block_count-1)noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
-      else noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+      if (i<type_c->block_count-1)
+        noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
+      else
+        noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
     }
     noncontiguous_hindexed=(void*)noncontiguous_hindexed_char;
   }
 }
-/*
- *  Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
  *  @param noncontiguous_hindexed - output hindexed
  *  @param contiguous_hindexed - input hindexed
  *  @param type - pointer contening :
@@ -972,10 +841,7 @@ void serialize_hindexed( const void *noncontiguous_hindexed,
  *      - block_indices - indices of each data, in bytes
  *      - count - the number of rows of matrix
  */
-void unserialize_hindexed( const void *contiguous_hindexed,
-                         void *noncontiguous_hindexed,
-                         int count,
-                         void *type,
+void unserialize_hindexed( const void *contiguous_hindexed, void *noncontiguous_hindexed, int count, void *type,
                          MPI_Op op)
 {
   s_smpi_mpi_hindexed_t* type_c = (s_smpi_mpi_hindexed_t*)type;
@@ -988,18 +854,18 @@ void unserialize_hindexed( const void *contiguous_hindexed,
       if (type_c->old_type->has_subtype == 0)
         smpi_op_apply(op, contiguous_hindexed_char, noncontiguous_hindexed_char, &type_c->block_lengths[i],
                             &type_c->old_type);
-                       /*memcpy(noncontiguous_hindexed_char,
-               contiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);*/
+        /*memcpy(noncontiguous_hindexed_char,contiguous_hindexed_char,type_c->block_lengths[i]*type_c->size_oldtype);*/
       else
         ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_hindexed_char,
                                                                        noncontiguous_hindexed_char,
                                                                        type_c->block_lengths[i],
-                                                                       type_c->old_type->substruct,
-                                                                       op);
+                                                                       type_c->old_type->substruct, op);
 
       contiguous_hindexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-      if (i<type_c->block_count-1)noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
-      else noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+      if (i<type_c->block_count-1)
+        noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
+      else
+        noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
     }
     noncontiguous_hindexed=(void*)noncontiguous_hindexed_char;
   }
@@ -1011,16 +877,11 @@ void free_hindexed(MPI_Datatype* type){
   smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*type)->substruct)->old_type);
 }
 
-/*
- * Create a Sub type hindexed to be able to serialize and unserialize it
- * the structure s_smpi_mpi_hindexed_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
+/* Create a Sub type hindexed to be able to serialize and unserialize it the structure s_smpi_mpi_hindexed_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize
  */
-s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths,
-                                                  MPI_Aint* block_indices,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype){
+s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths, MPI_Aint* block_indices, int block_count,
+                                                  MPI_Datatype old_type, int size_oldtype){
   s_smpi_mpi_hindexed_t *new_t= xbt_new(s_smpi_mpi_hindexed_t,1);
   new_t->base.serialize = &serialize_hindexed;
   new_t->base.unserialize = &unserialize_hindexed;
@@ -1039,7 +900,6 @@ s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths,
   return new_t;
 }
 
-
 int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
 {
   int i;
@@ -1067,35 +927,21 @@ int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Dat
     contiguous=0;
 
   if(!contiguous){
-    s_smpi_mpi_hindexed_t* subtype = smpi_datatype_hindexed_create( blocklens,
-                                                                  indices,
-                                                                  count,
-                                                                  old_type,
+    s_smpi_mpi_hindexed_t* subtype = smpi_datatype_hindexed_create( blocklens, indices, count, old_type,
                                                                   smpi_datatype_size(old_type));
-    smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type),
-             lb,
-                         ub
-                         ,1, subtype, DT_FLAG_DATA);
+    smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type), lb, ub ,1, subtype, DT_FLAG_DATA);
   }else{
-    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
-                                                                  size,
-                                                                  old_type,
-                                                                  smpi_datatype_size(old_type));
-    smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type),
-               0,size * smpi_datatype_size(old_type),
+    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create(lb,size, old_type, smpi_datatype_size(old_type));
+    smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type), 0,size * smpi_datatype_size(old_type),
                1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
   }
   retval=MPI_SUCCESS;
   return retval;
 }
 
+/* struct Implementation - Indexed with indices in bytes */
 
-/*
-struct Implementation - Indexed with indices in bytes 
-*/
-
-/*
- *  Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
  *  @param contiguous_struct - output struct
  *  @param noncontiguous_struct - input struct
  *  @param type - pointer contening :
@@ -1103,10 +949,7 @@ struct Implementation - Indexed with indices in bytes
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void serialize_struct( const void *noncontiguous_struct,
-                       void *contiguous_struct,
-                       int count,
-                       void *type)
+void serialize_struct( const void *noncontiguous_struct, void *contiguous_struct, int count, void *type)
 {
   s_smpi_mpi_struct_t* type_c = (s_smpi_mpi_struct_t*)type;
   int i,j;
@@ -1115,8 +958,8 @@ void serialize_struct( const void *noncontiguous_struct,
   for(j=0; j<count;j++){
     for (i = 0; i < type_c->block_count; i++) {
       if (type_c->old_types[i]->has_subtype == 0)
-        memcpy(contiguous_struct_char,
-             noncontiguous_struct_char, type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));
+        memcpy(contiguous_struct_char, noncontiguous_struct_char,
+               type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));
       else
         ((s_smpi_subtype_t*)type_c->old_types[i]->substruct)->serialize( noncontiguous_struct_char,
                                                                          contiguous_struct_char,
@@ -1125,14 +968,16 @@ void serialize_struct( const void *noncontiguous_struct,
 
 
       contiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_size(type_c->old_types[i]);
-      if (i<type_c->block_count-1)noncontiguous_struct_char = (char*)noncontiguous_struct + type_c->block_indices[i+1];
-      else noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);//let's hope this is MPI_UB ?
+      if (i<type_c->block_count-1)
+        noncontiguous_struct_char = (char*)noncontiguous_struct + type_c->block_indices[i+1];
+      else //let's hope this is MPI_UB ?
+        noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
     }
     noncontiguous_struct=(void*)noncontiguous_struct_char;
   }
 }
-/*
- *  Copies contiguous data into noncontiguous memory.
+
+/* Copies contiguous data into noncontiguous memory.
  *  @param noncontiguous_struct - output struct
  *  @param contiguous_struct - input struct
  *  @param type - pointer contening :
@@ -1140,11 +985,7 @@ void serialize_struct( const void *noncontiguous_struct,
  *      - block_length - the width or height of blocked matrix
  *      - count - the number of rows of matrix
  */
-void unserialize_struct( const void *contiguous_struct,
-                         void *noncontiguous_struct,
-                         int count,
-                         void *type,
-                         MPI_Op op)
+void unserialize_struct( const void *contiguous_struct, void *noncontiguous_struct, int count, void *type, MPI_Op op)
 {
   s_smpi_mpi_struct_t* type_c = (s_smpi_mpi_struct_t*)type;
   int i,j;
@@ -1156,21 +997,21 @@ void unserialize_struct( const void *contiguous_struct,
       if (type_c->old_types[i]->has_subtype == 0)
         smpi_op_apply(op, contiguous_struct_char, noncontiguous_struct_char, &type_c->block_lengths[i],
            & type_c->old_types[i]);
-                       /*memcpy(noncontiguous_struct_char,
-             contiguous_struct_char, type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));*/
+      /*memcpy(noncontiguous_struct_char,
+               contiguous_struct_char, type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));*/
       else
         ((s_smpi_subtype_t*)type_c->old_types[i]->substruct)->unserialize( contiguous_struct_char,
                                                                            noncontiguous_struct_char,
                                                                            type_c->block_lengths[i],
-                                                                           type_c->old_types[i]->substruct,
-                                                                           op);
+                                                                           type_c->old_types[i]->substruct, op);
 
       contiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_size(type_c->old_types[i]);
-      if (i<type_c->block_count-1)noncontiguous_struct_char =  (char*)noncontiguous_struct + type_c->block_indices[i+1];
-      else noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
+      if (i<type_c->block_count-1)
+        noncontiguous_struct_char =  (char*)noncontiguous_struct + type_c->block_indices[i+1];
+      else
+        noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
     }
     noncontiguous_struct=(void*)noncontiguous_struct_char;
-    
   }
 }
 
@@ -1183,14 +1024,10 @@ void free_struct(MPI_Datatype* type){
   xbt_free(((s_smpi_mpi_struct_t *)(*type)->substruct)->old_types);
 }
 
-/*
- * Create a Sub type struct to be able to serialize and unserialize it
- * the structure s_smpi_mpi_struct_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
+/* Create a Sub type struct to be able to serialize and unserialize it the structure s_smpi_mpi_struct_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize
  */
-s_smpi_mpi_struct_t* smpi_datatype_struct_create( int* block_lengths,
-                                                  MPI_Aint* block_indices,
-                                                  int block_count,
+s_smpi_mpi_struct_t* smpi_datatype_struct_create( int* block_lengths, MPI_Aint* block_indices, int block_count,
                                                   MPI_Datatype* old_types){
   s_smpi_mpi_struct_t *new_t= xbt_new(s_smpi_mpi_struct_t,1);
   new_t->base.serialize = &serialize_struct;
@@ -1214,7 +1051,6 @@ s_smpi_mpi_struct_t* smpi_datatype_struct_create( int* block_lengths,
   return new_t;
 }
 
-
 int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type)
 {
   int i;
@@ -1246,24 +1082,19 @@ int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datat
     }
 
     if(!forced_lb && indices[i]+smpi_datatype_lb(old_types[i])<lb) lb = indices[i];
-    if(!forced_ub && indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i])>ub) ub = indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i]);
+    if(!forced_ub &&  indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i])>ub)
+      ub = indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i]);
 
     if ( (i< count -1) && (indices[i]+blocklens[i]*static_cast<int>(smpi_datatype_size(old_types[i])) != indices[i+1]) )
       contiguous=0;
   }
 
   if(!contiguous){
-    s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocklens,
-                                                              indices,
-                                                              count,
-                                                              old_types);
+    s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocklens, indices, count, old_types);
 
     smpi_datatype_create(new_type,  size, lb, ub,1, subtype, DT_FLAG_DATA);
   }else{
-    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
-                                                                  size,
-                                                                  MPI_CHAR,
-                                                                  1);
+    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, size, MPI_CHAR, 1);
     smpi_datatype_create(new_type,  size, lb, ub,1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
   }
   return MPI_SUCCESS;
@@ -1302,8 +1133,7 @@ typedef struct s_smpi_mpi_op {
   }                                        \
 }
 
-static void max_func(void *a, void *b, int *length,
-                     MPI_Datatype * datatype)
+static void max_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, MAX_OP);
@@ -1330,8 +1160,7 @@ static void max_func(void *a, void *b, int *length,
   }
 }
 
-static void min_func(void *a, void *b, int *length,
-                     MPI_Datatype * datatype)
+static void min_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, MIN_OP);
@@ -1358,8 +1187,7 @@ static void min_func(void *a, void *b, int *length,
   }
 }
 
-static void sum_func(void *a, void *b, int *length,
-                     MPI_Datatype * datatype)
+static void sum_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, SUM_OP);
@@ -1392,8 +1220,7 @@ static void sum_func(void *a, void *b, int *length,
   }
 }
 
-static void prod_func(void *a, void *b, int *length,
-                      MPI_Datatype * datatype)
+static void prod_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, PROD_OP);
@@ -1426,8 +1253,7 @@ static void prod_func(void *a, void *b, int *length,
   }
 }
 
-static void land_func(void *a, void *b, int *length,
-                      MPI_Datatype * datatype)
+static void land_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, LAND_OP);
@@ -1450,8 +1276,7 @@ static void land_func(void *a, void *b, int *length,
   }
 }
 
-static void lor_func(void *a, void *b, int *length,
-                     MPI_Datatype * datatype)
+static void lor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, LOR_OP);
@@ -1474,8 +1299,7 @@ static void lor_func(void *a, void *b, int *length,
   }
 }
 
-static void lxor_func(void *a, void *b, int *length,
-                      MPI_Datatype * datatype)
+static void lxor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, LXOR_OP);
@@ -1498,8 +1322,7 @@ static void lxor_func(void *a, void *b, int *length,
   }
 }
 
-static void band_func(void *a, void *b, int *length,
-                      MPI_Datatype * datatype)
+static void band_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, BAND_OP);
@@ -1522,8 +1345,7 @@ static void band_func(void *a, void *b, int *length,
   }
 }
 
-static void bor_func(void *a, void *b, int *length,
-                     MPI_Datatype * datatype)
+static void bor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, BOR_OP);
@@ -1546,8 +1368,7 @@ static void bor_func(void *a, void *b, int *length,
   }
 }
 
-static void bxor_func(void *a, void *b, int *length,
-                      MPI_Datatype * datatype)
+static void bxor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_CHAR) {
     APPLY_FUNC(a, b, length, char, BXOR_OP);
@@ -1570,8 +1391,7 @@ static void bxor_func(void *a, void *b, int *length,
   }
 }
 
-static void minloc_func(void *a, void *b, int *length,
-                        MPI_Datatype * datatype)
+static void minloc_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_FLOAT_INT) {
     APPLY_FUNC(a, b, length, float_int, MINLOC_OP);
@@ -1594,8 +1414,7 @@ static void minloc_func(void *a, void *b, int *length,
   }
 }
 
-static void maxloc_func(void *a, void *b, int *length,
-                        MPI_Datatype * datatype)
+static void maxloc_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   if (*datatype == MPI_FLOAT_INT) {
     APPLY_FUNC(a, b, length, float_int, MAXLOC_OP);
@@ -1618,8 +1437,7 @@ static void maxloc_func(void *a, void *b, int *length,
   }
 }
 
-static void replace_func(void *a, void *b, int *length,
-                        MPI_Datatype * datatype)
+static void replace_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   memcpy(b, a, *length * smpi_datatype_size(*datatype));
 }
@@ -1642,7 +1460,6 @@ CREATE_MPI_OP(MPI_MAXLOC, maxloc_func);
 CREATE_MPI_OP(MPI_MINLOC, minloc_func);
 CREATE_MPI_OP(MPI_REPLACE, replace_func);
 
-
 MPI_Op smpi_op_new(MPI_User_function * function, int commute)
 {
   MPI_Op op;
@@ -1662,13 +1479,12 @@ void smpi_op_destroy(MPI_Op op)
   xbt_free(op);
 }
 
-void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
-                   MPI_Datatype * datatype)
+void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len, MPI_Datatype * datatype)
 {
   if(op==MPI_OP_NULL)
     return;
 
-  if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+  if(smpi_privatize_global_variables){//we need to switch as the called function may silently touch global variables
     XBT_DEBUG("Applying operation, switch to the right data frame ");
     smpi_switch_data_segment(smpi_process_index());
   }
@@ -1678,7 +1494,8 @@ void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
 }
 
 int smpi_type_attr_delete(MPI_Datatype type, int keyval){
-  smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
+  smpi_type_key_elem elem =
+    static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
   if(!elem)
     return MPI_ERR_ARG;
   if(elem->delete_fn!=MPI_NULL_DELETE_FN){
@@ -1697,7 +1514,8 @@ int smpi_type_attr_delete(MPI_Datatype type, int keyval){
 }
 
 int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag){
-  smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
+  smpi_type_key_elem elem =
+    static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
   if(!elem)
     return MPI_ERR_ARG;
   xbt_ex_t ex;
@@ -1719,7 +1537,8 @@ int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* fla
 int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){
   if(!smpi_type_keyvals)
   smpi_type_keyvals = xbt_dict_new();
-  smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
+  smpi_type_key_elem elem =
+     static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
   if(!elem )
     return MPI_ERR_ARG;
   int flag;
@@ -1736,16 +1555,16 @@ int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){
   return MPI_SUCCESS;
 }
 
-int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state){
-
+int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+                            void* extra_state){
   if(!smpi_type_keyvals)
   smpi_type_keyvals = xbt_dict_new();
-  
+
   smpi_type_key_elem value = (smpi_type_key_elem) xbt_new0(s_smpi_mpi_type_key_elem_t,1);
-  
+
   value->copy_fn=copy_fn;
   value->delete_fn=delete_fn;
-  
+
   *keyval = type_keyval_id;
   xbt_dict_set_ext(smpi_type_keyvals,(const char*)keyval, sizeof(int),(void*)value, NULL);
   type_keyval_id++;
@@ -1753,7 +1572,8 @@ int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delet
 }
 
 int smpi_type_keyval_free(int* keyval){
-  smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)keyval, sizeof(int)));
+  smpi_type_key_elem elem =
+    static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)keyval, sizeof(int)));
   if(!elem){
     return MPI_ERR_ARG;
   }
@@ -1762,22 +1582,20 @@ int smpi_type_keyval_free(int* keyval){
   return MPI_SUCCESS;
 }
 
-int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm){
+int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position,MPI_Comm comm){
   size_t size = smpi_datatype_size(type);
   if (outcount - *position < incount*static_cast<int>(size))
     return MPI_ERR_BUFFER;
-  smpi_datatype_copy(inbuf, incount, type,
-                   (char*)outbuf + *position, outcount, MPI_CHAR);
+  smpi_datatype_copy(inbuf, incount, type, (char*)outbuf + *position, outcount, MPI_CHAR);
   *position += incount * size;
   return MPI_SUCCESS;
 }
 
-int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm){
+int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type,MPI_Comm comm){
   int size = static_cast<int>(smpi_datatype_size(type));
   if (outcount*size> insize)
     return MPI_ERR_BUFFER;
-  smpi_datatype_copy((char*)inbuf + *position, insize, MPI_CHAR,
-                   outbuf, outcount, type);
+  smpi_datatype_copy((char*)inbuf + *position, insize, MPI_CHAR, outbuf, outcount, type);
   *position += outcount * size;
   return MPI_SUCCESS;
 }
index ef5f86e..22e4c5e 100644 (file)
@@ -32,18 +32,11 @@ SG_BEGIN_DECL()
  * We should make the difference here between the predefined contiguous and non contiguous
  * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
  */
-#define DT_FLAG_BASIC         (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
+#define DT_FLAG_BASIC      (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
 
 extern const MPI_Datatype MPI_PTR;
 
-
-//*****************************************************************************************
-
-/* 
-  These are the structures that handle complex data type information, 
-  used for serialization/unserialization of messages
-*/
-
+/* Structures that handle complex data type information, used for serialization/unserialization of messages */
 typedef struct s_smpi_mpi_contiguous{
   s_smpi_subtype_t base;
   MPI_Datatype old_type;
@@ -102,119 +95,47 @@ typedef struct s_smpi_mpi_struct{
   Functions to handle serialization/unserialization of messages, 3 for each type of MPI_Type
   One for creating the substructure to handle, one for serialization, one for unserialization
 */
-XBT_PRIVATE void unserialize_contiguous( const void *contiguous_vector,
-                         void *noncontiguous_vector,
-                         int count,
-                         void *type,
-                         MPI_Op op);
-
-XBT_PRIVATE void serialize_contiguous( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type);
-
+XBT_PRIVATE void unserialize_contiguous( const void *contiguous_vector, void *noncontiguous_vector, int count,
+                         void *type, MPI_Op op);
+XBT_PRIVATE void serialize_contiguous( const void *noncontiguous_vector, void *contiguous_vector, int count,void *type);
 XBT_PRIVATE void free_contiguous(MPI_Datatype* type);
-
-XBT_PRIVATE s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype);
+XBT_PRIVATE s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count,
+                                                  MPI_Datatype old_type, int size_oldtype);
                                                   
-XBT_PRIVATE void unserialize_vector( const void *contiguous_vector,
-                         void *noncontiguous_vector,
-                         int count,
-                         void *type,
+XBT_PRIVATE void unserialize_vector( const void *contiguous_vector, void *noncontiguous_vector, int count,void *type,
                          MPI_Op op);
-
-XBT_PRIVATE void serialize_vector( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type);
-
+XBT_PRIVATE void serialize_vector( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
 XBT_PRIVATE void free_vector(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride, int block_length, int block_count,
+                                                  MPI_Datatype old_type, int size_oldtype);
 
-XBT_PRIVATE s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride,
-                                                  int block_length,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype);
-
-XBT_PRIVATE void unserialize_hvector( const void *contiguous_vector,
-                         void *noncontiguous_vector,
-                         int count,
-                         void *type,
+XBT_PRIVATE void unserialize_hvector( const void *contiguous_vector, void *noncontiguous_vector, int count, void *type,
                          MPI_Op op);
-
-XBT_PRIVATE void serialize_hvector( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type);
-
+XBT_PRIVATE void serialize_hvector( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
 XBT_PRIVATE void free_hvector(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int block_length,
+                                                  int block_count, MPI_Datatype old_type, int size_oldtype);
 
-XBT_PRIVATE s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride,
-                                                  int block_length,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype);
-
-
-XBT_PRIVATE void unserialize_indexed( const void *contiguous_indexed,
-                         void *noncontiguous_indexed,
-                         int count,
-                         void *type,
-                         MPI_Op op);
-
-XBT_PRIVATE void serialize_indexed( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type);
-
+XBT_PRIVATE void unserialize_indexed( const void *contiguous_indexed, void *noncontiguous_indexed, int count,
+                         void *type, MPI_Op op);
+XBT_PRIVATE void serialize_indexed( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
 XBT_PRIVATE void free_indexed(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_indexed_t* smpi_datatype_indexed_create(int* block_lengths, int* block_indices,
+                                                  int block_count, MPI_Datatype old_type, int size_oldtype);
 
-XBT_PRIVATE s_smpi_mpi_indexed_t* smpi_datatype_indexed_create(int* block_lengths,
-                                                  int* block_indices,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype);
-
-XBT_PRIVATE void unserialize_hindexed( const void *contiguous_indexed,
-                         void *noncontiguous_indexed,
-                         int count,
-                         void *type,
-                         MPI_Op op);
-
-XBT_PRIVATE void serialize_hindexed( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type);
-
+XBT_PRIVATE void unserialize_hindexed( const void *contiguous_indexed, void *noncontiguous_indexed, int count,
+                         void *type, MPI_Op op);
+XBT_PRIVATE void serialize_hindexed( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
 XBT_PRIVATE void free_hindexed(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create(int* block_lengths, MPI_Aint* block_indices,
+                                                  int block_count, MPI_Datatype old_type, int size_oldtype);
 
-XBT_PRIVATE s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create(int* block_lengths,
-                                                  MPI_Aint* block_indices,
-                                                  int block_count,
-                                                  MPI_Datatype old_type,
-                                                  int size_oldtype);
-
-XBT_PRIVATE void unserialize_struct( const void *contiguous_indexed,
-                         void *noncontiguous_indexed,
-                         int count,
-                         void *type,
+XBT_PRIVATE void unserialize_struct( const void *contiguous_indexed, void *noncontiguous_indexed, int count, void *type,
                          MPI_Op op);
-
-XBT_PRIVATE void serialize_struct( const void *noncontiguous_vector,
-                       void *contiguous_vector,
-                       int count,
-                       void *type);
-
+XBT_PRIVATE void serialize_struct( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
 XBT_PRIVATE void free_struct(MPI_Datatype* type);
-
-XBT_PRIVATE s_smpi_mpi_struct_t* smpi_datatype_struct_create(int* block_lengths,
-                                                  MPI_Aint* block_indices,
-                                                  int block_count,
-                                                  MPI_Datatype* old_types);
+XBT_PRIVATE s_smpi_mpi_struct_t* smpi_datatype_struct_create(int* block_lengths, MPI_Aint* block_indices,
+                                                  int block_count, MPI_Datatype* old_types);
 
 SG_END_DECL()
-
 #endif
index c4b0a3d..d1f4945 100644 (file)
@@ -8,8 +8,7 @@
 #include "private.h"
 #include "smpi_mpi_dt_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi,
-                                "Logging specific to SMPI (pmpi)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
 
 //this function need to be here because of the calls to smpi_bench
 void TRACE_smpi_set_category(const char *category)
@@ -74,8 +73,8 @@ int PMPI_Get_version (int *version,int *subversion){
 int PMPI_Get_library_version (char *version,int *len){
   int retval = MPI_SUCCESS;
   smpi_bench_end();
-  snprintf(version,MPI_MAX_LIBRARY_VERSION_STRING,"SMPI Version %d.%d. Copyright The Simgrid Team 2007-2015",SIMGRID_VERSION_MAJOR,
-          SIMGRID_VERSION_MINOR);
+  snprintf(version,MPI_MAX_LIBRARY_VERSION_STRING,"SMPI Version %d.%d. Copyright The Simgrid Team 2007-2015",
+           SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR);
   *len = strlen(version) > MPI_MAX_LIBRARY_VERSION_STRING ? MPI_MAX_LIBRARY_VERSION_STRING : strlen(version);
   smpi_bench_begin();
   return retval;
@@ -156,8 +155,7 @@ int PMPI_Get_address(void *location, MPI_Aint * address)
 int PMPI_Type_free(MPI_Datatype * datatype)
 {
   int retval = 0;
-  /* Free a predefined datatype is an error according to the standard, and
-     should be checked for */
+  /* Free a predefined datatype is an error according to the standard, and should be checked for */
   if (*datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_ARG;
   } else {
@@ -330,8 +328,7 @@ int PMPI_Group_rank(MPI_Group group, int *rank)
   return retval;
 }
 
-int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
-                              MPI_Group group2, int *ranks2)
+int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1, MPI_Group group2, int *ranks2)
 {
   int retval, i, index;
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
@@ -365,8 +362,7 @@ int PMPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
   return retval;
 }
 
-int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
-                    MPI_Group * newgroup)
+int PMPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
 {
   int retval, i, proc1, proc2, size, size2;
 
@@ -403,8 +399,7 @@ int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
   return retval;
 }
 
-int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2,
-                           MPI_Group * newgroup)
+int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
 {
   int retval, i, proc1, proc2, size;
 
@@ -499,10 +494,8 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
   } else {
     if (n == 0) {
       *newgroup = group;
-      if(group!= smpi_comm_group(MPI_COMM_WORLD)
-                && group != MPI_GROUP_NULL
-                && group != smpi_comm_group(MPI_COMM_SELF)
-                && group != MPI_GROUP_EMPTY)
+      if(group!= smpi_comm_group(MPI_COMM_WORLD) && group != MPI_GROUP_NULL
+                && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY)
       smpi_group_use(group);
     } else if (n == smpi_group_size(group)) {
       *newgroup = MPI_GROUP_EMPTY;
@@ -533,8 +526,7 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
   return retval;
 }
 
-int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
-                         MPI_Group * newgroup)
+int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
 {
   int retval, i, j, rank, size, index;
 
@@ -594,8 +586,7 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
   return retval;
 }
 
-int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
-                         MPI_Group * newgroup)
+int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
 {
   int retval, i, rank, newrank,oldrank, size, index, add;
 
@@ -606,10 +597,8 @@ int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
   } else {
     if (n == 0) {
       *newgroup = group;
-      if(group!= smpi_comm_group(MPI_COMM_WORLD)
-                && group != MPI_GROUP_NULL
-                && group != smpi_comm_group(MPI_COMM_SELF)
-                && group != MPI_GROUP_EMPTY)
+      if(group!= smpi_comm_group(MPI_COMM_WORLD) && group != MPI_GROUP_NULL
+                && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY)
       smpi_group_use(group);
     } else {
       size = smpi_group_size(group);
@@ -728,10 +717,8 @@ int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group)
     retval = MPI_ERR_ARG;
   } else {
     *group = smpi_comm_group(comm);
-    if(*group!= smpi_comm_group(MPI_COMM_WORLD)
-              && *group != MPI_GROUP_NULL
-              && *group != smpi_comm_group(MPI_COMM_SELF)
-              && *group != MPI_GROUP_EMPTY)
+    if(*group!= smpi_comm_group(MPI_COMM_WORLD) && *group != MPI_GROUP_NULL
+              && *group != smpi_comm_group(MPI_COMM_SELF) && *group != MPI_GROUP_EMPTY)
     smpi_group_use(*group);
     retval = MPI_SUCCESS;
   }
@@ -750,9 +737,7 @@ int PMPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
     if (comm1 == comm2) {       /* Same communicators means same groups */
       *result = MPI_IDENT;
     } else {
-      *result =
-          smpi_group_compare(smpi_comm_group(comm1),
-                             smpi_comm_group(comm2));
+      *result = smpi_group_compare(smpi_comm_group(comm1), smpi_comm_group(comm2));
       if (*result == MPI_IDENT) {
         *result = MPI_CONGRUENT;
       }
@@ -848,8 +833,7 @@ int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
   return retval;
 }
 
-int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
-                   int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
 {
   int retval = 0;
 
@@ -872,8 +856,7 @@ int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
   return retval;
 }
 
-int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
-                   int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
 {
   int retval = 0;
 
@@ -896,8 +879,7 @@ int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
   return retval;
 }
 
-int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype,
-                    int dst, int tag, MPI_Comm comm, MPI_Request* request)
+int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
 {
   int retval = 0;
 
@@ -972,8 +954,7 @@ int PMPI_Request_free(MPI_Request * request)
   return retval;
 }
 
-int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
-               int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
 {
   int retval = 0;
 
@@ -1027,8 +1008,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
 }
 
 
-int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
-               int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
 {
   int retval = 0;
 
@@ -1080,8 +1060,7 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
   return retval;
 }
 
-int PMPI_Issend(void* buf, int count, MPI_Datatype datatype,
-                int dst, int tag, MPI_Comm comm, MPI_Request* request)
+int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
 {
   int retval = 0;
 
@@ -1133,8 +1112,7 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype,
   return retval;
 }
 
-int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
-             MPI_Comm comm, MPI_Status * status)
+int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
 {
   int retval = 0;
 
@@ -1187,8 +1165,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
   return retval;
 }
 
-int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
-             MPI_Comm comm)
+int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -1272,7 +1249,8 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
    if(!known)
      dt_size_send = smpi_datatype_size(datatype);
    extra->send_size = count*dt_size_send;
-   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);   TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype));
+   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
+   TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype));
 
      smpi_mpi_ssend(buf, count, datatype, dst, tag, comm);
      retval = MPI_SUCCESS;
@@ -1283,11 +1261,8 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
    smpi_bench_begin();
    return retval;}
 
-
-int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                 int dst, int sendtag, void *recvbuf, int recvcount,
-                 MPI_Datatype recvtype, int src, int recvtag,
-                 MPI_Comm comm, MPI_Status * status)
+int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void *recvbuf,
+                 int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status * status)
 {
   int retval = 0;
 
@@ -1347,8 +1322,7 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   return retval;
 }
 
-int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
-                         int dst, int sendtag, int src, int recvtag,
+int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dst, int sendtag, int src, int recvtag,
                          MPI_Comm comm, MPI_Status * status)
 {
   //TODO: suboptimal implementation
@@ -1361,9 +1335,7 @@ int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
   } else {
     int size = smpi_datatype_get_extent(datatype) * count;
     recvbuf = xbt_new0(char, size);
-    retval =
-        MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
-                     datatype, src, recvtag, comm, status);
+    retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count, datatype, src, recvtag, comm, status);
     if(retval==MPI_SUCCESS){
         smpi_datatype_copy(recvbuf, count, datatype, buf, count, datatype);
     }
@@ -1384,9 +1356,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
     smpi_empty_status(status);
     retval = MPI_SUCCESS;
   } else {
-    int rank = request && (*request)->comm != MPI_COMM_NULL
-      ? smpi_process_index()
-      : -1;
+    int rank = request && (*request)->comm != MPI_COMM_NULL ? smpi_process_index() : -1;
 
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
     extra->type = TRACING_TEST;
@@ -1401,8 +1371,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
   return retval;
 }
 
-int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
-                MPI_Status * status)
+int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status)
 {
   int retval = 0;
 
@@ -1452,7 +1421,6 @@ int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
   return retval;
 }
 
-
 int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
   int retval = 0;
   smpi_bench_end();
@@ -1490,9 +1458,7 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status)
     retval = MPI_SUCCESS;
   } else {
 
-    int rank = request && (*request)->comm != MPI_COMM_NULL
-      ? smpi_process_index()
-      : -1;
+    int rank = request && (*request)->comm != MPI_COMM_NULL ? smpi_process_index() : -1;
 
     int src_traced = (*request)->src;
     int dst_traced = (*request)->dst;
@@ -1558,8 +1524,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
     if (is_wait_for_receive) {
       if(srcs[*index]==MPI_ANY_SOURCE)
         src_traced = (status!=MPI_STATUSES_IGNORE) ?
-                      smpi_group_rank(smpi_comm_group(comms[*index]), status->MPI_SOURCE) :
-                      srcs[*index];
+                      smpi_group_rank(smpi_comm_group(comms[*index]), status->MPI_SOURCE) : srcs[*index];
       TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
     }
     TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
@@ -1575,7 +1540,6 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
 
 int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
 {
-
   smpi_bench_end();
   //save information from requests
   int i;
@@ -1616,8 +1580,7 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
       if (is_wait_for_receive) {
         if(src_traced==MPI_ANY_SOURCE)
         src_traced = (status!=MPI_STATUSES_IGNORE) ?
-                          smpi_group_rank(smpi_comm_group(comms[i]), status[i].MPI_SOURCE) :
-                          srcs[i];
+                          smpi_group_rank(smpi_comm_group(comms[i]), status[i].MPI_SOURCE) : srcs[i];
         TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
       }
     }
@@ -1633,8 +1596,7 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
   return retval;
 }
 
-int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
-                 int *indices, MPI_Status status[])
+int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int *indices, MPI_Status status[])
 {
   int retval = 0;
 
@@ -1649,8 +1611,7 @@ int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
   return retval;
 }
 
-int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount,
-                 int* indices, MPI_Status status[])
+int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount, int* indices, MPI_Status status[])
 {
   int retval = 0;
 
@@ -1725,9 +1686,8 @@ int PMPI_Barrier(MPI_Comm comm)
   return retval;
 }
 
-int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-               void *recvbuf, int recvcount, MPI_Datatype recvtype,
-               int root, MPI_Comm comm)
+int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,
+                int root, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -1738,8 +1698,7 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   } else if ((( sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) ||
             ((smpi_comm_rank(comm) == root) && (recvtype == MPI_DATATYPE_NULL))){
     retval = MPI_ERR_TYPE;
-  } else if ((( sendbuf != MPI_IN_PLACE) && (sendcount <0)) ||
-            ((smpi_comm_rank(comm) == root) && (recvcount <0))){
+  } else if ((( sendbuf != MPI_IN_PLACE) && (sendcount <0)) || ((smpi_comm_rank(comm) == root) && (recvcount <0))){
     retval = MPI_ERR_COUNT;
   } else {
 
@@ -1769,11 +1728,9 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
 
-  mpi_coll_gather_fun(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount,
-                    recvtype, root, comm);
+  mpi_coll_gather_fun(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, root, comm);
 
-
-    retval = MPI_SUCCESS;
+  retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
   }
 
@@ -1781,8 +1738,7 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   return retval;
 }
 
-int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                void *recvbuf, int *recvcounts, int *displs,
+int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
                 MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int retval = 0;
@@ -1832,8 +1788,7 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   }
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
 
-  smpi_mpi_gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts,
-                     displs, recvtype, root, comm);
+  smpi_mpi_gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, displs, recvtype, root, comm);
     retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
   }
@@ -1843,8 +1798,7 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 }
 
 int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                  void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                  MPI_Comm comm)
+                   void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -1881,8 +1835,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
 
-  mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
-                           recvtype, comm);
+  mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
     retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   }
@@ -1891,8 +1844,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 }
 
 int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                   void *recvbuf, int *recvcounts, int *displs,
-                   MPI_Datatype recvtype, MPI_Comm comm)
+                   void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -1936,8 +1888,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
 
-    mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
-                        displs, recvtype, comm);
+    mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
     retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   }
@@ -1947,8 +1898,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 }
 
 int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                int root, MPI_Comm comm)
+                void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -1986,8 +1936,7 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   extra->recv_size = recvcount*dt_size_recv;
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
 
-  mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
-                     recvtype, root, comm);
+  mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
     retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
   }
@@ -1997,8 +1946,7 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 }
 
 int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
-                 MPI_Datatype sendtype, void *recvbuf, int recvcount,
-                 MPI_Datatype recvtype, int root, MPI_Comm comm)
+                 MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -2041,8 +1989,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
   extra->recv_size = recvcount*dt_size_recv;
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
 
-    smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
-                      recvcount, recvtype, root, comm);
+    smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
 
     retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
@@ -2052,8 +1999,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
   return retval;
 }
 
-int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
-               MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
+int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -2088,8 +2034,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
   return retval;
 }
 
-int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
-    MPI_Datatype datatype, MPI_Op op){
+int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op){
   int retval = 0;
 
     smpi_bench_end();
@@ -2103,8 +2048,7 @@ int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
     return retval;
 }
 
-int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
-                  MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -2148,8 +2092,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
   return retval;
 }
 
-int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
-             MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -2184,8 +2127,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
   return retval;
 }
 
-int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
-                MPI_Op op, MPI_Comm comm){
+int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm){
   int retval = 0;
 
   smpi_bench_end();
@@ -2217,8 +2159,7 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
   return retval;
 }
 
-int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
-                       MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   int retval = 0;
   smpi_bench_end();
@@ -2253,8 +2194,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
     if(sendbuf==MPI_IN_PLACE)
       sendtmpbuf=recvbuf;
 
-    mpi_coll_reduce_scatter_fun(sendtmpbuf, recvbuf, recvcounts,
-                       datatype,  op, comm);
+    mpi_coll_reduce_scatter_fun(sendtmpbuf, recvbuf, recvcounts, datatype,  op, comm);
     retval = MPI_SUCCESS;
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   }
@@ -2264,7 +2204,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
 }
 
 int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
-                       MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+                              MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   int retval,i;
   smpi_bench_end();
@@ -2298,8 +2238,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
 
   int* recvcounts=(int*)xbt_malloc(count);
     for (i=0; i<count;i++)recvcounts[i]=recvcount;
-    mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
-                       datatype,  op, comm);
+    mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, datatype,  op, comm);
     xbt_free(recvcounts);
     retval = MPI_SUCCESS;
 
@@ -2311,8 +2250,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
 }
 
 int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                 void *recvbuf, int recvcount, MPI_Datatype recvtype,
-                 MPI_Comm comm)
+                 void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int retval = 0;
 
@@ -2349,8 +2287,7 @@ int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   return retval;
 }
 
-int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
-                  MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
+int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
                   int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int retval = 0;
@@ -2359,11 +2296,9 @@ int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (sendtype == MPI_DATATYPE_NULL
-             || recvtype == MPI_DATATYPE_NULL) {
+  } else if (sendtype == MPI_DATATYPE_NULL || recvtype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
-  } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
-             || recvdisps == NULL) {
+  } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL || recvdisps == NULL) {
     retval = MPI_ERR_ARG;
   } else {
   int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
@@ -2394,9 +2329,7 @@ int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
   extra->num_processes = size;
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
 
-  retval =
-        mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, sendtype,
-                                  recvbuf, recvcounts, recvdisps, recvtype,
+  retval = mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype,
                                   comm);
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   }
@@ -2412,11 +2345,8 @@ int PMPI_Get_processor_name(char *name, int *resultlen)
 
   strncpy(name, sg_host_get_name(SIMIX_host_self()),
           strlen(sg_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
-          strlen(sg_host_get_name(SIMIX_host_self())) +1 :
-          MPI_MAX_PROCESSOR_NAME - 1 );
-  *resultlen =
-      strlen(name) >
-      MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
+          strlen(sg_host_get_name(SIMIX_host_self())) +1 : MPI_MAX_PROCESSOR_NAME - 1 );
+  *resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
 
   return retval;
 }
@@ -2468,7 +2398,6 @@ int PMPI_Type_commit(MPI_Datatype* datatype) {
   return retval;
 }
 
-
 int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
@@ -2525,7 +2454,8 @@ int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Dataty
   return retval;
 }
 
-int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type,
+                                   MPI_Datatype* new_type) {
   int retval,i;
 
   if (old_type == MPI_DATATYPE_NULL) {
@@ -2541,7 +2471,6 @@ int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI
   return retval;
 }
 
-
 int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
@@ -2555,11 +2484,13 @@ int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatyp
   return retval;
 }
 
-int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+                              MPI_Datatype* new_type) {
   return PMPI_Type_hindexed(count, blocklens,indices,old_type,new_type);
 }
 
-int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type,
+                                    MPI_Datatype* new_type) {
   int retval,i;
 
   if (old_type == MPI_DATATYPE_NULL) {
@@ -2575,7 +2506,6 @@ int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indice
   return retval;
 }
 
-
 int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
   int retval = 0;
 
@@ -2587,36 +2517,31 @@ int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype*
   return retval;
 }
 
-int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
+int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+                            MPI_Datatype* new_type) {
   return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
 }
 
-
 int PMPI_Error_class(int errorcode, int* errorclass) {
   // assume smpi uses only standard mpi error codes
   *errorclass=errorcode;
   return MPI_SUCCESS;
 }
 
-
 int PMPI_Initialized(int* flag) {
    *flag=smpi_process_initialized();
    return MPI_SUCCESS;
 }
 
-/* The topo part of MPI_COMM_WORLD should always be NULL. When other topologies
- * will be implemented, not only should we check if the topology is NULL, but
- * we should check if it is the good topology type (so we have to add a
+/* The topo part of MPI_COMM_WORLD should always be NULL. When other topologies will be implemented, not only should we
+ * check if the topology is NULL, but we should check if it is the good topology type (so we have to add a
  *  MPIR_Topo_Type field, and replace the MPI_Topology field by an union)*/
 
 int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periodic, int reorder, MPI_Comm* comm_cart) {
   int retval = 0;
   if (comm_old == MPI_COMM_NULL){
     retval =  MPI_ERR_COMM;
-  } else if (ndims < 0 ||
-           (ndims > 0 && (dims == NULL ||
-                          periodic == NULL)) ||
-           comm_cart == NULL) {
+  } else if (ndims < 0 || (ndims > 0 && (dims == NULL || periodic == NULL)) || comm_cart == NULL) {
     retval = MPI_ERR_ARG;
   } else{
     retval = smpi_mpi_cart_create(comm_old, ndims, dims, periodic, reorder, comm_cart);
@@ -2709,26 +2634,19 @@ int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent,
     MPI_Aint disps[3] = { lb, 0, lb+extent };
     MPI_Datatype types[3] = { MPI_LB, oldtype, MPI_UB };
 
-    s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocks,
-                                                                disps,
-                                                                3,
-                                                                types
-                                                                );
+    s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocks, disps, 3, types);
     smpi_datatype_create(newtype,oldtype->size, lb, lb + extent, 1 , subtype, DT_FLAG_VECTOR);
 
     (*newtype)->flags &= ~DT_FLAG_COMMITED;
     return MPI_SUCCESS;
 }
 
-
-
 int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
   int retval = 0;
   smpi_bench_end();
   if (comm == MPI_COMM_NULL) {
     retval= MPI_ERR_COMM;
-  }else if ((base == NULL && size != 0)
-            || disp_unit <= 0 || size < 0 ){
+  }else if ((base == NULL && size != 0) || disp_unit <= 0 || size < 0 ){
     retval= MPI_ERR_OTHER;
   }else{
     *win = smpi_mpi_win_create( base, size, disp_unit, info, comm);
@@ -2799,7 +2717,6 @@ int PMPI_Win_fence( int assert,  MPI_Win win){
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
   retval = smpi_mpi_win_fence(assert, win);
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
-
   }
   smpi_bench_begin();
   return retval;
@@ -2821,8 +2738,7 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     retval = MPI_ERR_COUNT;
   } else if (origin_addr==NULL && origin_count > 0){
     retval = MPI_ERR_COUNT;
-  } else if ((!is_datatype_valid(origin_datatype)) ||
-            (!is_datatype_valid(target_datatype))) {
+  } else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process_index();
@@ -2831,7 +2747,8 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     int src_traced = smpi_group_index(group, target_rank);
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL);
 
-    retval = smpi_mpi_get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win);
+    retval = smpi_mpi_get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
+                           target_datatype, win);
 
     TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
   }
@@ -2855,8 +2772,7 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     retval = MPI_ERR_COUNT;
   } else if (origin_addr==NULL && origin_count > 0){
     retval = MPI_ERR_COUNT;
-  } else if ((!is_datatype_valid(origin_datatype)) ||
-            (!is_datatype_valid(target_datatype))) {
+  } else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process_index();
@@ -2866,7 +2782,8 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, NULL);
     TRACE_smpi_send(rank, rank, dst_traced, origin_count*smpi_datatype_size(origin_datatype));
 
-    retval = smpi_mpi_put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win);
+    retval = smpi_mpi_put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
+                           target_datatype, win);
 
     TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
   }
@@ -2874,7 +2791,6 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   return retval;
 }
 
-
 int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
   int retval = 0;
@@ -2903,7 +2819,8 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
     int src_traced = smpi_group_index(group, target_rank);
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL);
 
-    retval = smpi_mpi_accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, op, win);
+    retval = smpi_mpi_accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
+                                  target_datatype, op, win);
 
     TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
   }
@@ -2911,7 +2828,6 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
   return retval;
 }
 
-
 int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
   int retval = 0;
   smpi_bench_end();
@@ -2948,7 +2864,6 @@ int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){
   return retval;
 }
 
-
 int PMPI_Win_complete(MPI_Win win){
   int retval = 0;
   smpi_bench_end();
@@ -3029,7 +2944,6 @@ int PMPI_Type_get_name(MPI_Datatype  datatype, char * name, int* len)
   return retval;
 }
 
-
 MPI_Datatype PMPI_Type_f2c(MPI_Fint datatype){
   return smpi_type_f2c(datatype);
 }
@@ -3095,8 +3009,7 @@ int PMPI_Keyval_free(int* keyval) {
 }
 
 int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
-  if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO
-       ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
+  if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
        ||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
     return MPI_ERR_ARG;
   else if (comm==MPI_COMM_NULL)
@@ -3123,35 +3036,29 @@ int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
     *flag = 1;
     *(int**)attr_value = &zero;
     return MPI_SUCCESS;
-
   case MPI_UNIVERSE_SIZE:
     *flag = 1;
     *(int**)attr_value = &smpi_universe_size;
     return MPI_SUCCESS;
-
   case MPI_LASTUSEDCODE:
     *flag = 1;
     *(int**)attr_value = &last_used_code;
     return MPI_SUCCESS;
-
   case MPI_TAG_UB:
     *flag=1;
     *(int**)attr_value = &tag_ub;
     return MPI_SUCCESS;
-
   case MPI_WTIME_IS_GLOBAL:
     *flag = 1;
     *(int**)attr_value = &one;
     return MPI_SUCCESS;
-
   default:
     return smpi_comm_attr_get(comm, keyval, attr_value, flag);
   }
 }
 
 int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
-  if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO
-       ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
+  if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
        ||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
     return MPI_ERR_ARG;
   else if (comm==MPI_COMM_NULL)
@@ -3175,7 +3082,8 @@ int PMPI_Comm_delete_attr (MPI_Comm comm, int comm_keyval)
   return PMPI_Attr_delete(comm, comm_keyval);
 }
 
-int PMPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int PMPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+                            void* extra_state)
 {
   return PMPI_Keyval_create(copy_fn, delete_fn, keyval, extra_state);
 }
@@ -3184,7 +3092,6 @@ int PMPI_Comm_free_keyval(int* keyval) {
   return PMPI_Keyval_free(keyval);
 }
 
-
 int PMPI_Type_get_attr (MPI_Datatype type, int type_keyval, void *attribute_val, int* flag)
 {
   if (type==MPI_DATATYPE_NULL)
@@ -3209,7 +3116,8 @@ int PMPI_Type_delete_attr (MPI_Datatype type, int type_keyval)
     return smpi_type_attr_delete(type, type_keyval);
 }
 
-int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+                            void* extra_state)
 {
   return smpi_type_keyval_create(copy_fn, delete_fn, keyval, extra_state);
 }
@@ -3255,8 +3163,7 @@ int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){
     return MPI_ERR_INFO_VALUE;
   char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key);
   if(tmpvalue){
-    memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < static_cast<size_t>(valuelen)) ?
-                         strlen(tmpvalue) + 1 : valuelen);
+    memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < static_cast<size_t>(valuelen)) ? strlen(tmpvalue) + 1 : valuelen);
     *flag=TRUE;
   }
   return MPI_SUCCESS;
@@ -3461,8 +3368,8 @@ int PMPI_Pcontrol(const int level )
   NOT_YET_IMPLEMENTED
 }
 
-
-int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
+int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag,
+                          MPI_Comm* comm_out) {
   NOT_YET_IMPLEMENTED
 }
 
@@ -3474,7 +3381,8 @@ int PMPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, M
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
+                    MPI_Request* request) {
   NOT_YET_IMPLEMENTED
 }
 
@@ -3494,7 +3402,8 @@ int PMPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, M
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
+                    MPI_Request* request) {
   NOT_YET_IMPLEMENTED
 }
 
@@ -3506,17 +3415,17 @@ int PMPI_Test_cancelled(MPI_Status* status, int* flag) {
   NOT_YET_IMPLEMENTED
 }
 
-
-
 int PMPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size){
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position){
+int PMPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount,
+                       MPI_Aint *position){
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Unpack_external( char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype){
+int PMPI_Unpack_external(char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount,
+                         MPI_Datatype datatype){
   NOT_YET_IMPLEMENTED
 }
 
@@ -3524,26 +3433,24 @@ int PMPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements)
   NOT_YET_IMPLEMENTED
 }
 
-
-
-int PMPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers,
-                            int *num_addresses, int *num_datatypes, int *combiner){
+int PMPI_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes,
+                           int *combiner){
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses,
-                           int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
-                           MPI_Datatype* array_of_datatypes){
+int PMPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes,
+                           int* array_of_integers, MPI_Aint* array_of_addresses, MPI_Datatype* array_of_datatypes){
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes,
-                            int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
-                            int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
+int PMPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes, int* array_of_distribs,
+                            int* array_of_dargs, int* array_of_psizes,int order, MPI_Datatype oldtype,
+                            MPI_Datatype *newtype) {
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Type_create_subarray(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order, MPI_Datatype oldtype, MPI_Datatype *newtype){
+int PMPI_Type_create_subarray(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order,
+                              MPI_Datatype oldtype, MPI_Datatype *newtype){
   NOT_YET_IMPLEMENTED
 }
 
@@ -3552,8 +3459,7 @@ int PMPI_Type_match_size(int typeclass,int size,MPI_Datatype *datatype){
 }
 
 int PMPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
-                    void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes,
-                    MPI_Comm comm){
+                    void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes, MPI_Comm comm){
   NOT_YET_IMPLEMENTED
 }
 
@@ -3601,7 +3507,8 @@ int PMPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status)
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Grequest_start( MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request){
+int PMPI_Grequest_start(MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn,
+                        MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request){
   NOT_YET_IMPLEMENTED
 }
 
@@ -3649,7 +3556,8 @@ int PMPI_Comm_accept( char *port_name, MPI_Info info, int root, MPI_Comm comm, M
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Comm_spawn( char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
+int PMPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm,
+                    MPI_Comm *intercomm, int* array_of_errcodes){
   NOT_YET_IMPLEMENTED
 }
 
index 1024d3d..bd12425 100644 (file)
@@ -33,7 +33,6 @@ static void log_timed_action (const char *const *action, double clock){
   }
 }
 
-
 static xbt_dynar_t get_reqq_self()
 {
    char * key = bprintf("%d", smpi_process_index());
@@ -50,7 +49,6 @@ static void set_reqq_self(xbt_dynar_t mpi_request)
    free(key);
 }
 
-
 //allocate a single buffer for all sends, growing it if needed
 void* smpi_get_tmp_sendbuffer(int size)
 {
@@ -62,6 +60,7 @@ void* smpi_get_tmp_sendbuffer(int size)
   }
   return sendbuffer;
 }
+
 //allocate a single buffer for all recv
 void* smpi_get_tmp_recvbuffer(int size){
   if (!smpi_process_get_replaying())
@@ -92,9 +91,7 @@ static double parse_double(const char *string)
 static MPI_Datatype decode_datatype(const char *const action)
 {
 // Declared datatypes,
-
-  switch(atoi(action))
-  {
+  switch(atoi(action)) {
     case 0:
       MPI_CURRENT_TYPE=MPI_DOUBLE;
       break;
@@ -118,7 +115,6 @@ static MPI_Datatype decode_datatype(const char *const action)
       break;
     default:
       MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
-
   }
    return MPI_CURRENT_TYPE;
 }
@@ -126,7 +122,6 @@ static MPI_Datatype decode_datatype(const char *const action)
 
 const char* encode_datatype(MPI_Datatype datatype, int* known)
 {
-
   //default type for output is set to MPI_BYTE
   // MPI_DEFAULT_TYPE is not set for output, use directly MPI_BYTE
   if(known)*known=1;
@@ -163,7 +158,6 @@ const char* encode_datatype(MPI_Datatype datatype, int* known)
           "Please contact the Simgrid team if support is needed", __FUNCTION__, i, mandatory, optional);\
   }
 
-
 static void action_init(const char *const *action)
 {
   XBT_DEBUG("Initialize the counters");
@@ -181,15 +175,6 @@ static void action_init(const char *const *action)
   }
 
   set_reqq_self(xbt_dynar_new(sizeof(MPI_Request),&xbt_free_ref));
-
-  /*
-    reqq=xbt_new0(xbt_dynar_t,active_processes);
-
-    for(i=0;i<active_processes;i++){
-      reqq[i]=xbt_dynar_new(sizeof(MPI_Request),&xbt_free_ref);
-    }
-  }
-  */
 }
 
 static void action_finalize(const char *const *action)
@@ -396,9 +381,7 @@ static void action_test(const char *const *action){
     flag = smpi_mpi_test(&request, &status);
 
     XBT_DEBUG("MPI_Test result: %d", flag);
-    /* push back request in dynar to be caught by a subsequent wait. if the test
-     * did succeed, the request is now NULL.
-     */
+    /* push back request in dynar to be caught by a subsequent wait. if the test did succeed, the request is now NULL.*/
     xbt_dynar_push_as(get_reqq_self(),MPI_Request, request);
 
     TRACE_smpi_testing_out(rank);
@@ -418,15 +401,11 @@ static void action_wait(const char *const *action){
   request = xbt_dynar_pop_as(get_reqq_self(),MPI_Request);
 
   if (!request){
-    /* Assuming that the trace is well formed, this mean the comm might have
-     * been caught by a MPI_test. Then just return.
-     */
+    /* Assume that the trace is well formed, meaning the comm might have been caught by a MPI_test. Then just return.*/
     return;
   }
 
-  int rank = request->comm != MPI_COMM_NULL
-      ? smpi_comm_rank(request->comm)
-      : -1;
+  int rank = request->comm != MPI_COMM_NULL ? smpi_comm_rank(request->comm) : -1;
 
   MPI_Group group = smpi_comm_group(request->comm);
   int src_traced = smpi_group_rank(group, request->src);
@@ -461,7 +440,6 @@ static void action_waitall(const char *const *action){
     xbt_dynar_foreach(get_reqq_self(),i,requests[i]); 
 
    //save information from requests
-
    xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), NULL);
    xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
    xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
@@ -529,17 +507,13 @@ static void action_barrier(const char *const *action){
   log_timed_action (action, clock);
 }
 
-
 static void action_bcast(const char *const *action)
 {
   CHECK_ACTION_PARAMS(action, 1, 2);
   double size = parse_double(action[2]);
   double clock = smpi_process_simulated_elapsed();
   int root=0;
-  /*
-   * Initialize MPI_CURRENT_TYPE in order to decrease
-   * the number of the checks
-   * */
+  /* Initialize MPI_CURRENT_TYPE in order to decrease the number of the checks */
   MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;  
 
   if(action[3]) {
@@ -581,8 +555,6 @@ static void action_reduce(const char *const *action)
       MPI_CURRENT_TYPE=decode_datatype(action[5]);
     }
   }
-  
-  
 
   int rank = smpi_process_index();
   int root_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), root);
@@ -597,8 +569,8 @@ static void action_reduce(const char *const *action)
 
   void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
   void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
-   mpi_coll_reduce_fun(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, root, MPI_COMM_WORLD);
-   smpi_execute_flops(comp_size);
+  mpi_coll_reduce_fun(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, root, MPI_COMM_WORLD);
+  smpi_execute_flops(comp_size);
 
   TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
   log_timed_action (action, clock);
@@ -667,11 +639,8 @@ static void action_allToAll(const char *const *action) {
   log_timed_action (action, clock);
 }
 
-
 static void action_gather(const char *const *action) {
-  /*
- The structure of the gather action for the rank 0 (total 4 processes) 
- is the following:   
+  /* The structure of the gather action for the rank 0 (total 4 processes) is the following:
  0 gather 68 68 0 0 0
 
   where: 
@@ -714,20 +683,14 @@ static void action_gather(const char *const *action) {
 
   TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra);
 
-  mpi_coll_gather_fun(send, send_size, MPI_CURRENT_TYPE,
-                recv, recv_size, MPI_CURRENT_TYPE2,
-                root, MPI_COMM_WORLD);
+  mpi_coll_gather_fun(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
 
   TRACE_smpi_collective_out(smpi_process_index(), -1, __FUNCTION__);
   log_timed_action (action, clock);
 }
 
-
-
 static void action_gatherv(const char *const *action) {
-  /*
- The structure of the gatherv action for the rank 0 (total 4 processes)
- is the following:
+  /* The structure of the gatherv action for the rank 0 (total 4 processes) is the following:
  0 gather 68 68 10 10 10 0 0 0
 
   where:
@@ -781,9 +744,7 @@ static void action_gatherv(const char *const *action) {
 
   TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra);
 
-  smpi_mpi_gatherv(send, send_size, MPI_CURRENT_TYPE,
-                recv, recvcounts, disps, MPI_CURRENT_TYPE2,
-                root, MPI_COMM_WORLD);
+  smpi_mpi_gatherv(send, send_size, MPI_CURRENT_TYPE, recv, recvcounts, disps, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
 
   TRACE_smpi_collective_out(smpi_process_index(), -1, __FUNCTION__);
   log_timed_action (action, clock);
@@ -792,10 +753,7 @@ static void action_gatherv(const char *const *action) {
 }
 
 static void action_reducescatter(const char *const *action) {
-
-    /*
- The structure of the reducescatter action for the rank 0 (total 4 processes) 
- is the following:   
+ /* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
 0 reduceScatter 275427 275427 275427 204020 11346849 0
 
   where: 
@@ -803,10 +761,7 @@ static void action_reducescatter(const char *const *action) {
   2) The value 11346849 is the amount of instructions
   3) The last value corresponds to the datatype, see decode_datatype().
 
-  We analyze a MPI_Reduce_scatter call to one MPI_Reduce and one MPI_Scatterv.
-
-   */
-
+  We analyze a MPI_Reduce_scatter call to one MPI_Reduce and one MPI_Scatterv. */
   double clock = smpi_process_simulated_elapsed();
   int comm_size = smpi_comm_size(MPI_COMM_WORLD);
   CHECK_ACTION_PARAMS(action, comm_size+1, 1);
@@ -842,11 +797,9 @@ static void action_reducescatter(const char *const *action) {
   void *sendbuf = smpi_get_tmp_sendbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
   void *recvbuf = smpi_get_tmp_recvbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
    
-   mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL,
-       MPI_COMM_WORLD);
+   mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
    smpi_execute_flops(comp_size);
 
-
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   xbt_free(recvcounts);
   xbt_free(disps);
@@ -854,19 +807,13 @@ static void action_reducescatter(const char *const *action) {
 }
 
 static void action_allgather(const char *const *action) {
-  /*
- The structure of the allgather action for the rank 0 (total 4 processes) 
- is the following:   
+  /* The structure of the allgather action for the rank 0 (total 4 processes) is the following:
   0 allGather 275427 275427
 
   where: 
   1) 275427 is the sendcount
   2) 275427 is the recvcount
-  3) No more values mean that the datatype for sent and receive buffer
-  is the default one, see decode_datatype().
-
-   */
-
+  3) No more values mean that the datatype for sent and receive buffer is the default one, see decode_datatype().  */
   double clock = smpi_process_simulated_elapsed();
 
   CHECK_ACTION_PARAMS(action, 2, 2);
@@ -880,7 +827,7 @@ static void action_allgather(const char *const *action) {
     MPI_CURRENT_TYPE2 = decode_datatype(action[5]);
   } else {
     MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
-    MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;    
+    MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
   }
   void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE));
   void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* smpi_datatype_size(MPI_CURRENT_TYPE2));
@@ -903,20 +850,14 @@ static void action_allgather(const char *const *action) {
 }
 
 static void action_allgatherv(const char *const *action) {
-
-  /*
- The structure of the allgatherv action for the rank 0 (total 4 processes) 
- is the following:   
+  /* The structure of the allgatherv action for the rank 0 (total 4 processes) is the following:
 0 allGatherV 275427 275427 275427 275427 204020
 
   where: 
   1) 275427 is the sendcount
   2) The next four elements declare the recvcounts array
   3) No more values mean that the datatype for sent and receive buffer
-  is the default one, see decode_datatype().
-
-   */
-
+  is the default one, see decode_datatype(). */
   double clock = smpi_process_simulated_elapsed();
 
   int comm_size = smpi_comm_size(MPI_COMM_WORLD);
@@ -956,7 +897,8 @@ static void action_allgatherv(const char *const *action) {
 
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
 
-  mpi_coll_allgatherv_fun(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcounts, disps, MPI_CURRENT_TYPE2, MPI_COMM_WORLD);
+  mpi_coll_allgatherv_fun(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcounts, disps, MPI_CURRENT_TYPE2,
+                          MPI_COMM_WORLD);
 
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   log_timed_action (action, clock);
@@ -965,20 +907,14 @@ static void action_allgatherv(const char *const *action) {
 }
 
 static void action_allToAllv(const char *const *action) {
-  /*
- The structure of the allToAllV action for the rank 0 (total 4 processes) 
- is the following:   
+  /* The structure of the allToAllV action for the rank 0 (total 4 processes) is the following:
   0 allToAllV 100 1 7 10 12 100 1 70 10 5
 
   where: 
   1) 100 is the size of the send buffer *sizeof(int),
   2) 1 7 10 12 is the sendcounts array
   3) 100*sizeof(int) is the size of the receiver buffer
-  4)  1 70 10 5 is the recvcounts array
-
-   */
-
-
+  4)  1 70 10 5 is the recvcounts array */
   double clock = smpi_process_simulated_elapsed();
 
   int comm_size = smpi_comm_size(MPI_COMM_WORLD);
@@ -1010,7 +946,6 @@ static void action_allToAllv(const char *const *action) {
     recvcounts[i] = atoi(action[i+4+comm_size]);
   }
 
-
   int rank = smpi_process_index();
   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
   extra->type = TRACING_ALLTOALLV;
@@ -1029,9 +964,8 @@ static void action_allToAllv(const char *const *action) {
 
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
 
-  mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, MPI_CURRENT_TYPE,
-                               recvbuf, recvcounts, recvdisps, MPI_CURRENT_TYPE,
-                               MPI_COMM_WORLD);
+  mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, MPI_CURRENT_TYPE,recvbuf, recvcounts, recvdisps,
+                         MPI_CURRENT_TYPE, MPI_COMM_WORLD);
 
   TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   log_timed_action (action, clock);
@@ -1083,7 +1017,7 @@ void smpi_replay_run(int *argc, char***argv){
     xbt_replay_action_register("reduceScatter",  action_reducescatter);
     xbt_replay_action_register("compute",    action_compute);
   }
-  
+
   //if we have a delayed start, sleep here.
   if(*argc>2){
     char *endptr;
@@ -1097,15 +1031,14 @@ void smpi_replay_run(int *argc, char***argv){
     XBT_DEBUG("Force context switch by smpi_execute_flops  - Sleeping for 0.0 flops ");
     smpi_execute_flops(0.0);
   }
-  
+
   /* Actually run the replay */
   xbt_replay_action_runner(*argc, *argv);
 
   /* and now, finalize everything */
   double sim_time= 1.;
   /* One active process will stop. Decrease the counter*/
-  XBT_DEBUG("There are %lu elements in reqq[*]",
-            xbt_dynar_length(get_reqq_self()));
+  XBT_DEBUG("There are %lu elements in reqq[*]", xbt_dynar_length(get_reqq_self()));
   if (!xbt_dynar_is_empty(get_reqq_self())){
     int count_requests=xbt_dynar_length(get_reqq_self());
     MPI_Request requests[count_requests];
@@ -1124,7 +1057,6 @@ void smpi_replay_run(int *argc, char***argv){
     /* end the simulated timer */
     sim_time = smpi_process_simulated_elapsed();
   }
-  
 
   //TODO xbt_dynar_free_container(get_reqq_self()));
 
@@ -1137,7 +1069,7 @@ void smpi_replay_run(int *argc, char***argv){
     xbt_dict_free(&reqq); //not need, data have been freed ???
     reqq = NULL;
   }
-  
+
   instr_extra_data extra_fin = xbt_new0(s_instr_extra_data_t,1);
   extra_fin->type = TRACING_FINALIZE;
   operation =bprintf("%s_finalize",__FUNCTION__);
index c03f2b0..a5083ce 100644 (file)
@@ -30,9 +30,8 @@ typedef struct s_smpi_mpi_win{
 
 
 MPI_Win smpi_mpi_win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm){
-
   MPI_Win win;
-  
+
   int comm_size = smpi_comm_size(comm);
   int rank=smpi_comm_rank(comm);
   XBT_DEBUG("Creating window");
@@ -52,32 +51,22 @@ MPI_Win smpi_mpi_win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info
   win->requests = xbt_dynar_new(sizeof(MPI_Request), NULL);
   win->connected_wins = xbt_new0(MPI_Win, comm_size);
   win->connected_wins[rank] = win;
-  
+
   if(rank==0){
     win->bar=xbt_barrier_init(comm_size);
   }
-  
-  mpi_coll_allgather_fun(&(win->connected_wins[rank]),
-                     sizeof(MPI_Win),
-                     MPI_BYTE,
-                     win->connected_wins,
-                     sizeof(MPI_Win),
-                     MPI_BYTE,
-                     comm);
-                     
-  mpi_coll_bcast_fun( &(win->bar),
-                     sizeof(xbt_bar_t),
-                     MPI_BYTE,
-                     0,
-                     comm);
-                     
+
+  mpi_coll_allgather_fun(&(win->connected_wins[rank]), sizeof(MPI_Win), MPI_BYTE, win->connected_wins, sizeof(MPI_Win),
+                         MPI_BYTE, comm);
+
+  mpi_coll_bcast_fun( &(win->bar), sizeof(xbt_bar_t), MPI_BYTE, 0, comm);
+
   mpi_coll_barrier_fun(comm);
-  
+
   return win;
 }
 
 int smpi_mpi_win_free( MPI_Win* win){
-
   //As per the standard, perform a barrier to ensure every async comm is finished
   xbt_barrier_wait((*win)->bar);
   xbt_dynar_free(&(*win)->requests);
@@ -114,9 +103,7 @@ void smpi_mpi_win_set_name(MPI_Win win, char* name){
   win->name = xbt_strdup(name);;
 }
 
-
 int smpi_mpi_win_fence( int assert,  MPI_Win win){
-
   XBT_DEBUG("Entering fence");
   if(!win->opened)
     win->opened=1;
@@ -139,7 +126,7 @@ int smpi_mpi_win_fence( int assert,  MPI_Win win){
 
   }
   win->assert = assert;
-  
+
   xbt_barrier_wait(win->bar);
   XBT_DEBUG("Leaving fence ");
 
@@ -149,7 +136,6 @@ int smpi_mpi_win_fence( int assert,  MPI_Win win){
 int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win)
 {
-
   if(!win->opened)//check that post/start has been done
     return MPI_ERR_WIN;
   //get receiver pointer
@@ -162,12 +148,12 @@ int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype origin_datat
 
   if(target_rank != smpi_comm_rank(win->comm)){
     //prepare send_request
-    MPI_Request sreq = smpi_rma_send_init(origin_addr, origin_count, origin_datatype,
-        smpi_process_index(), smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, win->comm, MPI_OP_NULL);
+    MPI_Request sreq = smpi_rma_send_init(origin_addr, origin_count, origin_datatype, smpi_process_index(),
+        smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, win->comm, MPI_OP_NULL);
 
     //prepare receiver request
-    MPI_Request rreq = smpi_rma_recv_init(recv_addr, target_count, target_datatype,
-        smpi_process_index(), smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, recv_win->comm, MPI_OP_NULL);
+    MPI_Request rreq = smpi_rma_recv_init(recv_addr, target_count, target_datatype, smpi_process_index(),
+        smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, recv_win->comm, MPI_OP_NULL);
 
     //push request to receiver's win
     xbt_dynar_push_as(recv_win->requests, MPI_Request, rreq);
@@ -178,8 +164,7 @@ int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype origin_datat
     //push request to sender's win
     xbt_dynar_push_as(win->requests, MPI_Request, sreq);
   }else{
-    smpi_datatype_copy(origin_addr, origin_count, origin_datatype,
-                       recv_addr, target_count, target_datatype);
+    smpi_datatype_copy(origin_addr, origin_count, origin_datatype, recv_addr, target_count, target_datatype);
   }
 
   return MPI_SUCCESS;
@@ -201,15 +186,17 @@ int smpi_mpi_get( void *origin_addr, int origin_count, MPI_Datatype origin_datat
   if(target_rank != smpi_comm_rank(win->comm)){
     //prepare send_request
     MPI_Request sreq = smpi_rma_send_init(send_addr, target_count, target_datatype,
-        smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, send_win->comm, MPI_OP_NULL);
+        smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, send_win->comm,
+        MPI_OP_NULL);
 
     //prepare receiver request
     MPI_Request rreq = smpi_rma_recv_init(origin_addr, origin_count, origin_datatype,
-        smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, win->comm, MPI_OP_NULL);
-        
+        smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, win->comm,
+        MPI_OP_NULL);
+
     //start the send, with another process than us as sender. 
     smpi_mpi_start(sreq);
-    
+
     //push request to receiver's win
     xbt_dynar_push_as(send_win->requests, MPI_Request, sreq);
 
@@ -219,8 +206,7 @@ int smpi_mpi_get( void *origin_addr, int origin_count, MPI_Datatype origin_datat
     //push request to sender's win
     xbt_dynar_push_as(win->requests, MPI_Request, rreq);
   }else{
-    smpi_datatype_copy(send_addr, target_count, target_datatype,
-                       origin_addr, origin_count, origin_datatype);
+    smpi_datatype_copy(send_addr, target_count, target_datatype, origin_addr, origin_count, origin_datatype);
   }
 
   return MPI_SUCCESS;
@@ -242,7 +228,6 @@ int smpi_mpi_accumulate( void *origin_addr, int origin_count, MPI_Datatype origi
   smpi_datatype_use(origin_datatype);
   smpi_datatype_use(target_datatype);
 
-
     //prepare send_request
     MPI_Request sreq = smpi_rma_send_init(origin_addr, origin_count, origin_datatype,
         smpi_process_index(), smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+3, win->comm, op);
@@ -254,38 +239,31 @@ int smpi_mpi_accumulate( void *origin_addr, int origin_count, MPI_Datatype origi
     xbt_dynar_push_as(recv_win->requests, MPI_Request, rreq);
     //start send
     smpi_mpi_start(sreq);
-    
+
     //push request to sender's win
     xbt_dynar_push_as(win->requests, MPI_Request, sreq);
-  
-
 
   return MPI_SUCCESS;
 }
 
 int smpi_mpi_win_start(MPI_Group group, int assert, MPI_Win win){
     /* From MPI forum advices
-    The call to MPI_WIN_COMPLETE does not return until the put call has completed at 
-    the origin; and the target window will be accessed by the put operation only 
-    after the call to MPI_WIN_START has matched a call to MPI_WIN_POST by the target
-     process. This still leaves much choice to implementors. The call to 
-     MPI_WIN_START can block until the matching call to MPI_WIN_POST occurs at all 
-    target processes. One can also have implementations where the call to 
-    MPI_WIN_START is nonblocking, but the call to MPI_PUT blocks until the matching 
-    call to MPI_WIN_POST occurred; or implementations where the first two calls are 
-    nonblocking, but the call to MPI_WIN_COMPLETE blocks until the call to 
-    MPI_WIN_POST occurred; or even implementations where all three calls can 
-    complete before any target process called MPI_WIN_POST --- the data put must be 
-    buffered, in this last case, so as to allow the put to complete at the origin 
-    ahead of its completion at the target. However, once the call to MPI_WIN_POST is
-     issued, the sequence above must complete, without further dependencies.
-    */
-  
+    The call to MPI_WIN_COMPLETE does not return until the put call has completed at the origin; and the target window
+    will be accessed by the put operation only after the call to MPI_WIN_START has matched a call to MPI_WIN_POST by
+    the target process. This still leaves much choice to implementors. The call to MPI_WIN_START can block until the
+    matching call to MPI_WIN_POST occurs at all target processes. One can also have implementations where the call to
+    MPI_WIN_START is nonblocking, but the call to MPI_PUT blocks until the matching call to MPI_WIN_POST occurred; or
+    implementations where the first two calls are nonblocking, but the call to MPI_WIN_COMPLETE blocks until the call
+    to MPI_WIN_POST occurred; or even implementations where all three calls can complete before any target process
+    called MPI_WIN_POST --- the data put must be buffered, in this last case, so as to allow the put to complete at the
+    origin ahead of its completion at the target. However, once the call to MPI_WIN_POST is issued, the sequence above
+    must complete, without further dependencies.  */
+
   //naive, blocking implementation.
   int i=0,j=0;
   int size = smpi_group_size(group);
   MPI_Request* reqs = xbt_new0(MPI_Request, size);
-  
+
 //  for(i=0;i<size;i++){
   while(j!=size){
     int src=smpi_group_index(group,j);
@@ -313,18 +291,17 @@ int smpi_mpi_win_post(MPI_Group group, int assert, MPI_Win win){
   int i=0,j=0;
   int size = smpi_group_size(group);
   MPI_Request* reqs = xbt_new0(MPI_Request, size);
-  
+
   while(j!=size){
     int dst=smpi_group_index(group,j);
     if(dst!=smpi_process_index()){
-      reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst,
-        RMA_TAG+4, MPI_COMM_WORLD);
+      reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, RMA_TAG+4, MPI_COMM_WORLD);
       i++;
     }
     j++;
   }
   size=i;
-  
+
   smpi_mpi_startall(size, reqs);
   smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
@@ -344,17 +321,16 @@ int smpi_mpi_win_complete(MPI_Win win){
   //MPI_Comm comm = smpi_comm_new(win->group, NULL);
   //mpi_coll_barrier_fun(comm);
   //smpi_comm_destroy(comm);
-  
+
   XBT_DEBUG("Entering MPI_Win_Complete");
   int i=0,j=0;
   int size = smpi_group_size(win->group);
   MPI_Request* reqs = xbt_new0(MPI_Request, size);
-  
+
   while(j!=size){
     int dst=smpi_group_index(win->group,j);
     if(dst!=smpi_process_index()){
-      reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst,
-        RMA_TAG+5, MPI_COMM_WORLD);
+      reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, RMA_TAG+5, MPI_COMM_WORLD);
       i++;
     }
     j++;
@@ -363,17 +339,17 @@ int smpi_mpi_win_complete(MPI_Win win){
   XBT_DEBUG("Win_complete - Sending sync messages to %d processes", size);
   smpi_mpi_startall(size, reqs);
   smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE);
-  
+
   for(i=0;i<size;i++){
     smpi_mpi_request_free(&reqs[i]);
   }
   xbt_free(reqs);
-  
+
   //now we can finish RMA calls
-  
+
   xbt_dynar_t reqqs = win->requests;
   size = xbt_dynar_length(reqqs);
-  
+
   XBT_DEBUG("Win_complete - Finishing %d RMA calls", size);
   unsigned int cpt=0;
   MPI_Request req;
@@ -390,8 +366,6 @@ int smpi_mpi_win_complete(MPI_Win win){
   return MPI_SUCCESS;
 }
 
-
-
 int smpi_mpi_win_wait(MPI_Win win){
 //  xbt_barrier_wait(win->bar);
   //MPI_Comm comm = smpi_comm_new(win->group, NULL);
@@ -402,7 +376,7 @@ int smpi_mpi_win_wait(MPI_Win win){
   int i=0,j=0;
   int size = smpi_group_size(win->group);
   MPI_Request* reqs = xbt_new0(MPI_Request, size);
-  
+
 //  for(i=0;i<size;i++){
   while(j!=size){
     int src=smpi_group_index(win->group,j);
@@ -423,7 +397,7 @@ int smpi_mpi_win_wait(MPI_Win win){
 
   xbt_dynar_t reqqs = win->requests;
   size = xbt_dynar_length(reqqs);
-  
+
   XBT_DEBUG("Win_complete - Finishing %d RMA calls", size);
 
   unsigned int cpt=0;
index cf596ca..1e5f55d 100644 (file)
@@ -105,16 +105,15 @@ MPI_Topology smpi_cart_topo_create(int ndims) {
 
 /* reorder is ignored, don't know what would be the consequences of a dumb
  * reordering but neither do I see the point of reordering*/
-int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[],
-                         int periods[], int reorder, MPI_Comm *comm_cart) {
+int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart) {
     int retval = MPI_SUCCESS;
     int i;
     MPI_Topology newCart;
     MPI_Group newGroup, oldGroup;
     int rank, nranks, newSize;
-  
+
     rank = smpi_comm_rank(comm_old);
+
     newSize = 1;
     if(ndims != 0) {
         for (i = 0 ; i < ndims ; i++) {
@@ -130,18 +129,15 @@ int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[],
         for (i = 0 ; i < newSize ; i++) {
             smpi_group_set_mapping(newGroup, smpi_group_index(oldGroup, i), i);
         }
-    
+
         newCart->topo.cart->nnodes = newSize;
 
-        /* memcpy(newCart->topo.cart->dims, dims, */
-        /*        ndims * sizeof(*newCart->topo.cart->dims)); */
-        /* memcpy(newCart->topo.cart->periodic, periods, */
-        /*        ndims * sizeof(*newCart->topo.cart->periodic)); */
-    
+        /* memcpy(newCart->topo.cart->dims, dims, ndims * sizeof(*newCart->topo.cart->dims)); */
+        /* memcpy(newCart->topo.cart->periodic, periods, ndims * sizeof(*newCart->topo.cart->periodic)); */
+
         //  FIXME : code duplication... See smpi_mpi_cart_coords
         nranks = newSize;
-        for (i=0; i<ndims; i++)
-        {
+        for (i=0; i<ndims; i++) {
             newCart->topo.cart->dims[i] = dims[i];
             newCart->topo.cart->periodic[i] = periods[i];
             nranks = nranks / dims[i];
@@ -151,13 +147,11 @@ int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[],
         }
 
         *comm_cart = smpi_comm_new(newGroup, newCart);
-    }
-    else {
+    } else {
         if (rank == 0) {
             newCart = smpi_cart_topo_create(ndims);
             *comm_cart = smpi_comm_new(smpi_comm_group(MPI_COMM_SELF), newCart);
-        }
-        else {
+        } else {
             *comm_cart = MPI_COMM_NULL;
         }
     }
@@ -193,17 +187,13 @@ int smpi_mpi_cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm)
     return smpi_mpi_cart_create(comm, newNDims, newDims, newPeriodic, 0, newcomm);
 }
 
-
-
-
-int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims,
-                         int coords[]) {
+int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]) {
     int nnodes;
-    int i;
+
     MPI_Topology topo = smpi_comm_topo(comm);
-  
+
     nnodes = topo->topo.cart->nnodes;
-    for ( i=0; i < topo->topo.cart->ndims; i++ ) {
+    for (int i=0; i < topo->topo.cart->ndims; i++ ) {
         nnodes    = nnodes / topo->topo.cart->dims[i];
         coords[i] = rank / nnodes;
         rank      = rank % nnodes;
@@ -213,8 +203,8 @@ int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims,
 
 int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
     MPI_Topology topo = smpi_comm_topo(comm);
-    int i;
-    for(i = 0 ; i < maxdims ; i++) {
+
+    for(int i = 0 ; i < maxdims ; i++) {
         dims[i] = topo->topo.cart->dims[i];
         periods[i] = topo->topo.cart->periodic[i];
         coords[i] = topo->topo.cart->position[i];
@@ -232,44 +222,37 @@ int smpi_mpi_cart_rank(MPI_Comm comm, int* coords, int* rank) {
     for ( i=ndims-1; i >=0; i-- ) {
         coord = coords[i];
 
-        /* The user can give us whatever coordinates he wants. If one of them is
-         * out of range, either this dimension is periodic, and then we
-         * consider the equivalent coordinate inside the bounds, or it is not
-         * and then it is an error
+        /* The user can give us whatever coordinates he wants. If one of them is out of range, either this dimension is
+         * periodic, and we consider the equivalent coordinate inside the bounds, or it's not and then it's an error
          */
         if (coord >= topo->topo.cart->dims[i]) {
             if ( topo->topo.cart->periodic[i] ) {
                 coord = coord % topo->topo.cart->dims[i];
-            }
-            else {
+            } else {
                 // Should I do that ?
                 *rank = -1; 
                 return MPI_ERR_ARG;
             }
-        }
-        else if (coord <  0) {
+        } else if (coord <  0) {
             if(topo->topo.cart->periodic[i]) {
                 coord = coord % topo->topo.cart->dims[i];
                 if (coord) coord = topo->topo.cart->dims[i] + coord;
-            }
-            else {
+            } else {
                 *rank = -1;
                 return MPI_ERR_ARG;
             }
         }
-    
+
         *rank += multiplier * coord;
         multiplier *= topo->topo.cart->dims[i];
     }
     return MPI_SUCCESS;
 }
 
-int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp,
-                        int *rank_source, int *rank_dest) {
+int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source, int *rank_dest) {
     MPI_Topology topo = smpi_comm_topo(comm);
     int position[topo->topo.cart->ndims];
 
-
     if(topo->topo.cart->ndims == 0) {
         return MPI_ERR_ARG;
     }
@@ -277,8 +260,7 @@ int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp,
         return MPI_ERR_DIMS;
     }
 
-    smpi_mpi_cart_coords(comm, smpi_comm_rank(comm), topo->topo.cart->ndims,
-                         position);
+    smpi_mpi_cart_coords(comm, smpi_comm_rank(comm), topo->topo.cart->ndims, position);
     position[direction] += disp;
 
     if(position[direction] < 0 ||
@@ -286,27 +268,22 @@ int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp,
         if(topo->topo.cart->periodic[direction]) {
             position[direction] %= topo->topo.cart->dims[direction];
             smpi_mpi_cart_rank(comm, position, rank_dest);
-        }
-        else {
+        } else {
             *rank_dest = MPI_PROC_NULL;
         }
-    }
-    else {
+    } else {
         smpi_mpi_cart_rank(comm, position, rank_dest);
     }
 
     position[direction] =  topo->topo.cart->position[direction] - disp;
-    if(position[direction] < 0 ||
-       position[direction] >= topo->topo.cart->dims[direction]) {
+    if(position[direction] < 0 || position[direction] >= topo->topo.cart->dims[direction]) {
         if(topo->topo.cart->periodic[direction]) {
             position[direction] %= topo->topo.cart->dims[direction];
             smpi_mpi_cart_rank(comm, position, rank_source);
-        }
-        else {
+        } else {
             *rank_source = MPI_PROC_NULL;
         }
-    }
-    else {
+    } else {
         smpi_mpi_cart_rank(comm, position, rank_source);
     }
 
@@ -320,8 +297,6 @@ int smpi_mpi_cartdim_get(MPI_Comm comm, int *ndims) {
     return MPI_SUCCESS;
 }
 
-
-
 // Everything below has been taken from ompi, but could be easily rewritten.
  
 /*
@@ -345,7 +320,6 @@ int smpi_mpi_cartdim_get(MPI_Comm comm, int *ndims) {
  * $HEADER$
  */
 
-
 /* static functions */
 static int assignnodes(int ndim, int nfactor, int *pfacts,int **pdims);
 static int getfactors(int num, int *nfators, int **factors);
@@ -495,8 +469,7 @@ assignnodes(int ndim, int nfactor, int *pfacts, int **pdims)
  *          - array of prime factors
  *  Returns:    - MPI_SUCCESS or ERROR
  */
-static int
-getfactors(int num, int *nfactors, int **factors) {
+static int getfactors(int num, int *nfactors, int **factors) {
     int size;
     int d;
     int i;
@@ -532,4 +505,3 @@ getfactors(int num, int *nfactors, int **factors) {
     (*nfactors) = i;
     return MPI_SUCCESS;
 }
-
index bb41e7c..a8fc1a3 100644 (file)
@@ -1,5 +1,4 @@
 #!/bin/sh
-#---- smpitools.sh --------------------------------------------------------#
 
 # Copyright (c) 2013-2014. The SimGrid Team.
 # All rights reserved.
@@ -10,8 +9,7 @@
 SAVEIFS="$IFS"
 LISTSEP="$(printf '\b')"
 
-# Create a temporary file, with its name of the form $1_XXX$2, where XXX is
-# replaced by an unique string.
+# Create a temporary file, with its name of the form $1_XXX$2, where XXX is replaced by an unique string.
 # $1: prefix, $2: suffix
 mymktemp () {
     tmp=$(mktemp --suffix="$2" "$1_XXXXXXXXXX" 2> /dev/null)
@@ -67,12 +65,9 @@ list_set () {
     list_add "$@"
 }
 
-# Get the content of a list: positional parameters ($1, $2, ...) are set to the
-# content of the list
+# Get the content of a list: positional parameters ($1, $2, ...) are set to the content of the list
 # $1: list
 # usage:  eval $(list_get list)
 list_get () {
     printf 'IFS="$LISTSEP"; eval set -- \\$%s; IFS="$SAVEIFS"' "$1"
 }
-
-#---- end of smpitools.sh -------------------------------------------------#
index e9e250f..c9644fc 100644 (file)
@@ -50,7 +50,8 @@ xbt_mheap_t mmalloc_set_current_heap(xbt_mheap_t new_heap)
   return heap;
 }
 
-#ifdef MMALLOC_WANT_OVERRIDE_LEGACY
+/* Override the malloc-like functions if MC is activated at compile time */
+#ifdef HAVE_MC 
 
 /* ***** Temporary allocator
  *
@@ -255,4 +256,4 @@ void free(void *p)
   mfree(mdp, p);
   UNLOCK(mdp);
 }
-#endif /* WANT_MALLOC_OVERRIDE */
+#endif /* HAVE_MC */
index ff685cd..319a422 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "xbt/misc.h"
 #include "simgrid_config.h"
-#include "src/internal_config.h" /* MMALLOC_WANT_OVERRIDE_LEGACY */
+#include "src/internal_config.h" /* HAVE_MC */
 #include "src/portable.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
@@ -127,7 +127,7 @@ static void xbt_postexit(void)
   xbt_dynar_free(&xbt_cmdline);
   xbt_log_postexit();
   free(xbt_binary_name);
-#ifdef MMALLOC_WANT_OVERRIDE_LEGACY
+#ifdef HAVE_MC
   mmalloc_postexit();
 #endif
 }
index db2676b..f3c5e3f 100755 (executable)
@@ -24,7 +24,6 @@ $col_underline  = "\033[04m";
 $col_blink      = "\033[05m";
 
 # Customize colors here...
-#
 $col_default = $col_ltgray;
 my (@coltab) = (
     $col_green,                    $col_yellow,
@@ -39,7 +38,6 @@ my (@coltab) = (
 my %pid;
 
 # Get options
-#
 while (($_ = $ARGV[0]) =~ /^-/) {
     shift;
     if (/-location/i) {
index 2ac7c85..bac9ced 100755 (executable)
@@ -14,8 +14,7 @@ use XFig;
 use POSIX;
 
 my($grid_Y_size)=225; 
-my($grid_X_size)=100550; # Can be changed to improve readability in
-                         # function of the total execution time
+my($grid_X_size)=100550; # Can be changed to improve readability in function of the total execution time
 
 my($color_suspended)=1;
 my($color_compute)=2;
@@ -25,9 +24,6 @@ my($color_communicate)=4;
 # Determine the order of the colors in the legend
 my(@color_list)=($color_compute,$color_communicate,$color_wait_for_recpt,$color_suspended);
 
-
-
-
 sub read_cat {
     my(%Cat);
     my($filename)=@_;
@@ -51,7 +47,6 @@ sub read_cat {
     return \%Cat;
 }
 
-
 sub read_event {
     my($filename,$Cat)=@_;
     my($line);
@@ -101,7 +96,6 @@ sub read_link {
     return \%link;
 }
 
-
 sub build_cat_tree {
     my($root,$Cat)=@_;
     my(@childs)=();
@@ -113,7 +107,6 @@ sub build_cat_tree {
        }
 #      print "$$Cat{$cat}{name}\t\t $Cat{$cat}{father}\n";
     }
-    
     return [$root,@childs];
 }
 
@@ -130,7 +123,6 @@ sub build_cat_list {
     unshift @$tree, $root;
 }
 
-
 sub cat_sorting_function {
     my($cat1,$cat2,$Cat)=@_;
     if (!defined($$Cat{$cat1}{state})) {
@@ -227,8 +219,7 @@ sub draw_cat {
 
     my($max_date)=0;
     foreach $cat (keys %$Cat) {
-       next unless (defined($$Cat{$cat}{Y_min}) && 
-                    defined($$Cat{$cat}{Y_max}));
+       next unless (defined($$Cat{$cat}{Y_min}) && defined($$Cat{$cat}{Y_max}));
        my(@states)=();
        my($e);
        foreach $e (@{$$Cat{$cat}{state}}) {
@@ -244,8 +235,7 @@ sub draw_cat {
                $state = $$old_event[1];
 
 # LM: I added the next line because of "undefined values"...
-# normally, I think that this should not happen, but this part of code
-# is a bit too cryptic to me
+# normally, I think that this should not happen, but this part of code is a bit too cryptic to me
                next unless (defined($state));          
 
                my($line) = new XFig ('polyline');
@@ -291,10 +281,7 @@ sub draw_cat {
        $fig->add ($line);
     }
 
-
-
 # Host visualization
-
     my($max_Y)= 0;
 
     my($index_fill)=0;
@@ -303,8 +290,7 @@ sub draw_cat {
     my($host_text_x)= $min_x_for_host + 200;
 
     foreach $cat (keys %$Cat) {
-       next unless (defined($$Cat{$cat}{Y_min_host}) && 
-                    defined($$Cat{$cat}{Y_max_host}));
+       next unless (defined($$Cat{$cat}{Y_min_host}) && defined($$Cat{$cat}{Y_max_host}));
        my($line) = new XFig ('polyline');
        
        $line->{'depth'} = 150;  
@@ -378,7 +364,6 @@ sub draw_cat {
     }
     
 # Time axis
-        
     my($line) = new XFig ('polyline');
     $line->{'depth'} = 0;  
     $line->{'subtype'} = 1;  # line
@@ -424,7 +409,6 @@ sub draw_cat {
     $line->{'thickness'} = 0;  
     $line->{'points'} = [ [0,0],[0, -400] ];
     $fig->add ($line);
-    
 }
 
 sub main {
@@ -440,7 +424,6 @@ sub main {
     shift @$cat_list;
 #    print "@$cat_list \n";
     set_cat_position($Cat,$cat_list);
-
     
     my($fig)=create_fig("toto.fig");
     draw_cat($fig,$Cat,$Link);
index fea800a..b8213d5 100644 (file)
@@ -422,13 +422,9 @@ set(SIMDAG_SRC
   src/simdag/sd_workstation.cpp
   )
 if(HAVE_GRAPHVIZ)
-  set(SIMDAG_SRC
-    ${SIMDAG_SRC} src/simdag/sd_dotloader.cpp
-    )
+  set(SIMDAG_SRC    ${SIMDAG_SRC} src/simdag/sd_dotloader.cpp)
 else()
-  set(EXTRA_DIST
-    ${EXTRA_DIST} src/simdag/sd_dotloader.cpp
-    )
+  set(EXTRA_DIST    ${EXTRA_DIST} src/simdag/sd_dotloader.cpp)
 endif()
 
 set(BINDINGS_SRC
@@ -758,37 +754,22 @@ set(simgrid_sources
   ${XBT_SRC}
   )
 
-if(${HAVE_JEDULE})
-  set(simgrid_sources
-    ${simgrid_sources}
-    ${JEDULE_SRC}
-    )
+if(${HAVE_JEDULE})  
+  set(simgrid_sources  ${simgrid_sources}  ${JEDULE_SRC})
 else()
-  set(EXTRA_DIST
-    ${EXTRA_DIST}
-    ${JEDULE_SRC}
-    )
+  set(EXTRA_DIST       ${EXTRA_DIST}       ${JEDULE_SRC})
 endif()
 
 if(enable_smpi)
-  set(simgrid_sources
-    ${simgrid_sources}
-    ${SMPI_SRC}
-    )
+  set(simgrid_sources  ${simgrid_sources}  ${SMPI_SRC})
 endif()
 
 if(HAVE_MC)
-  set(simgrid_sources
-    ${simgrid_sources}
-    ${MC_SRC}
-    )
+  set(simgrid_sources  ${simgrid_sources}  ${MC_SRC})
 endif()
 
 if(HAVE_NS3)
-  set(simgrid_sources
-    ${simgrid_sources}
-    ${NS3_SRC}
-    )
+  set(simgrid_sources  ${simgrid_sources}  ${NS3_SRC})
 endif()
 
 # WINDOWS
@@ -802,15 +783,9 @@ if(WIN32)
 endif()
 
 if(${HAVE_LUA})
-  set(simgrid_sources
-    ${simgrid_sources}
-    ${LUA_SRC}
-    )
+  set(simgrid_sources  ${simgrid_sources}  ${LUA_SRC})
 else()
-  set(EXTRA_DIST
-    ${EXTRA_DIST}
-    ${LUA_SRC}
-    )
+  set(EXTRA_DIST       ${EXTRA_DIST}       ${LUA_SRC})
 endif()
 
 set(DOC_SOURCES
@@ -998,8 +973,6 @@ set(CMAKEFILES_TXT
   examples/msg/tracing/CMakeLists.txt
   
   examples/s4u/CMakeLists.txt
-  examples/s4u/basic/CMakeLists.txt
-  examples/s4u/io/CMakeLists.txt
   
   examples/simdag/CMakeLists.txt
   examples/simdag/dax/CMakeLists.txt
index 188a2ec..4115a97 100644 (file)
@@ -88,7 +88,7 @@ if(HAVE_MC)
   endif()
 endif()
 
-if(MMALLOC_WANT_OVERRIDE_LEGACY AND HAVE_GNU_LD)
+if(HAVE_MC AND HAVE_GNU_LD)
   SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl")
 endif()
 
index 730d13c..665c520 100644 (file)
@@ -124,34 +124,6 @@ IF(NOT enable_memcheck)
   ENDIF()
 
   ## INTERFACES ##
-  ### MSG ###
-  # BEGIN TESH TESTS
-  ADD_TESH_FACTORIES(msg-masterslave-kill        "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_kill.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-multicore   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_multicore.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-mailbox   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_mailbox.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic           "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-forwarder "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_forwarder.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-failure   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_failure.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave             "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-forwarder   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_forwarder_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-failure     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_failure_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-mailbox     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_mailbox_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-cpu-ti      "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/masterslave --cd ${CMAKE_HOME_DIRECTORY}/examples/msg masterslave/masterslave_cpu_ti_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-vivaldi     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_vivaldi.tesh)
-  
-  ADD_TESH(tracing-ms                          --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/ms.tesh)
-  ADD_TESH(tracing-trace-platform              --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/trace_platform.tesh)
-  ADD_TESH(tracing-user-variables              --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/user_variables.tesh)
-  ADD_TESH(tracing-link-user-variables         --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/link_user_variables.tesh)
-  ADD_TESH(tracing-link-srcdst-user-variables  --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/link_srcdst_user_variables.tesh)
-  ADD_TESH(tracing-categories                  --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/categories.tesh)
-  ADD_TESH(tracing-process-migration           --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/procmig.tesh)
-  # END TESH TESTS
-
-  ### S4U ###
-  ADD_TESH_FACTORIES(s4u-basic "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/s4u/basic --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/basic s4u_basic.tesh)
-  ADD_TESH_FACTORIES(s4u-io "thread;ucontext;raw;boost"    --setenv bindir=${CMAKE_BINARY_DIR}/examples/s4u/io --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/io s4u_io.tesh)
-
   ### SIMDAG ###
   # BEGIN TESH TESTS
   # these tests need the assertion mechanism
@@ -266,14 +238,12 @@ IF(NOT enable_memcheck)
 
   ## BINDINGS ##
   ### LUA ###
-  # BEGIN TESH TESTS
   IF(HAVE_LUA)
     # Tests testing simulation from C but using lua for platform files. Executed like this
     # ~$ ./masterslave platform.lua deploy.lua
     ADD_TESH(lua-platform-masterslave                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/lua --cd ${CMAKE_BINARY_DIR}/examples/lua ${CMAKE_HOME_DIRECTORY}/teshsuite/lua/lua_platforms.tesh)
     SET_TESTS_PROPERTIES(lua-platform-masterslave    PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
   ENDIF()
-  # END TESH TESTS
 
   ### JAVA ###
   IF(enable_java)
@@ -283,26 +253,6 @@ IF(NOT enable_memcheck)
     ELSE()
       SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${CMAKE_BINARY_DIR}/teshsuite/java/:${SIMGRID_JAR}")
     ENDIF()
-    ADD_TESH(java-async                          --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/async/async.tesh)
-    ADD_TESH(java-bittorrent                     --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/bittorrent/bittorrent.tesh)
-    ADD_TESH(java-bypass                         --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/master_slave_bypass/bypass.tesh)
-    ADD_TESH(java-chord                          --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/chord/chord.tesh)
-    ADD_TESH(java-cloud                          --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/cloud/cloud.tesh)
-    ADD_TESH(java-cloud-energy                   --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/cloud/energy/energy.tesh)
-    ADD_TESH(java-cloud-migration                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/cloud/migration/migration.tesh)
-    ADD_TESH(java-commTime                       --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/commTime/commtime.tesh)
-    ADD_TESH(java-energy                         --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/energy/energy.tesh)
-    ADD_TESH(java-storage                        --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/io/storage.tesh)
-    ADD_TESH(java-kademlia                       --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/kademlia/kademlia.tesh)
-    ADD_TESH(java-kill                           --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/master_slave_kill/kill.tesh)
-    ADD_TESH(java-masterslave                    --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/masterslave/masterslave.tesh)
-    ADD_TESH(java-migration                      --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/migration/migration.tesh)
-    ADD_TESH(java-mutualExclusion                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/mutualExclusion/mutualexclusion.tesh)
-    ADD_TESH(java-pingPong                       --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/pingPong/pingpong.tesh)
-    ADD_TESH(java-priority                       --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/priority/priority.tesh)
-    ADD_TESH(java-startKillTime                  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/startKillTime/startKillTime.tesh)
-    ADD_TESH(java-suspend                        --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/suspend/suspend.tesh)
-    ADD_TESH(java-tracing                        --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/tracing/tracingPingPong.tesh)
   ENDIF()
 ENDIF()
 
index 4ee6bcb..590c80f 100644 (file)
 /* Variables for the SysV contexts */
 @sg_makecontext_stack_addr@
 @sg_makecontext_stack_size@
+
+/* Variable for SysV, raw and Boost contexts */
 #cmakedefine PTH_STACKGROWTH @PTH_STACKGROWTH@ /* Does the stack growth upward, or downward? */
 
 /* MC variables */
 #cmakedefine HAVE_GETDTABLESIZE    @HAVE_GETDTABLESIZE@    /* getdtablesize: get descriptor table size */
 #cmakedefine HAVE_MMALLOC          @HAVE_MMALLOC@          /* Did we compile mmalloc in? */
 #cmakedefine HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@ /* process_vm_readv: transfer data between process address spaces */
-#cmakedefine MMALLOC_WANT_OVERRIDE_LEGACY @MMALLOC_WANT_OVERRIDE_LEGACY@ /* Set to true if enable_model-checking is true */
-#cmakedefine HAVE_MC @HAVE_MC@
+#cmakedefine HAVE_MC @HAVE_MC@ /* Set to true if enable_model-checking is true and the dependencies available */
 
 /* SMPI variables */
 #cmakedefine HAVE_SMPI          @HAVE_SMPI@
index bad8593..987f2a1 100755 (executable)
@@ -56,7 +56,6 @@ This file was generated by tools/doxygen/index_create.pl. DO NOT EDIT.
  *
  * \\htmlonly Although completely useless, the complete list of structures defined can be found <a href="annotated.html">here</a> \\endhtmlonly
 
-
 EOF
 
 foreach $type (qw(define enumeration enumvalue function typedef)) {
index ba13f8a..28db032 100755 (executable)
@@ -18,9 +18,8 @@ print "        \@{\n";
 # Search for calls to macros defining new channels, and prepare the tree representation
 my %ancestor;
 my %desc;
-# $ancestor{"toto"} is the ancestor of the toto channel
-#    as declared by XBT_LOG_NEW_SUBCATEGORY and XBT_LOG_NEW_DEFAULT_SUBCATEGORY
-#    ie, when the channel toto is initialized (does not work under windows)
+# $ancestor{"toto"} is the ancestor of the toto channel as declared by XBT_LOG_NEW_SUBCATEGORY and 
+# XBT_LOG_NEW_DEFAULT_SUBCATEGORY ie, when the channel toto is initialized (does not work under windows)
 
 # $desc{"toto"} is its description
 my %connected;
@@ -48,12 +47,11 @@ sub cleanup_ctn {
     return @elms;
 }
 
-
 sub parse_file {
     my $filename = shift;
-    
+
     my $data = "";
-    
+
     print "Parse $filename\n" if $debug;
     open IN, "$filename" || die "Cannot read $filename: $!\n";
     while (<IN>) {
@@ -70,16 +68,15 @@ sub parse_file {
     my $connect_data = $data; # save a copy for second parsing phase
     while ($data =~ s/^.*?XBT_LOG_NEW(_DEFAULT)?_(SUB)?CATEGORY\(//s) {
        $data =~ s/([^"]*"[^"]*")\)//s || die "unparsable macro: $data";
-           
+
         my ($name,$anc,$desc) = cleanup_ctn($1);
-           
+    
         # build the tree, checking for name conflict
         die "ERROR: Category name conflict: $name used several times (in $ancestor{$name} and $anc, last time in $filename)\n"
-          if defined ($ancestor{$name}) && $ancestor{$name} ne $anc &&
-              defined ($desc{$name}) && $desc{$name} ne $desc;
+          if defined ($ancestor{$name}) && $ancestor{$name} ne $anc && defined ($desc{$name}) && $desc{$name} ne $desc;
        $ancestor{$name}=$anc;
        $desc{$name}=$desc;
-   
+
        print " $name -> $anc\n" if $debug;
    }
 
@@ -101,7 +98,7 @@ close FILES;
 
 # Display the tree, looking for disconnected elems    
 my %used;
-       
+
 sub display_subtree {
     my $name=shift;
     my $indent=shift;
@@ -114,7 +111,7 @@ sub display_subtree {
        display_subtree($cat,"$indent  ");
     }
 }
-    
+
 display_subtree("XBT_LOG_ROOT_CAT","");
 
 map {
@@ -126,5 +123,4 @@ map {
     warn "Category $_ does not seem to be connected to the root (anc=$ancestor{$_})\n";
 } grep {!defined $used{$_}} sort keys %ancestor;
 
-       
 print "@}*/\n";
index cfd98f1..05d6a46 100644 (file)
@@ -4,17 +4,7 @@ set_target_properties(graphicator PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BI
 
 ## Clean generated files
 get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
-set_directory_properties(
-  PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
-  "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/simgrid.trace;")
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/simgrid.trace;")
 
-set(tesh_files
-  ${tesh_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.tesh
-  PARENT_SCOPE
-  )
-set(tools_src
-  ${tools_src}
-  ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.c
-  PARENT_SCOPE
-  )
+set(tesh_files  ${tesh_files}  ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.tesh  PARENT_SCOPE)
+set(tools_src   ${tools_src}   ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.c     PARENT_SCOPE)
index d0b485c..32f6225 100644 (file)
@@ -1,8 +1,6 @@
-This directory contains some tools that we use to build and maintain
-SimGrid itself. I doubt that any of them are useful out of that
-context, but you are welcome to dig and inspect everything you want.
+This directory contains some tools that we use to build and maintain SimGrid itself. I doubt that any of them are useful
+out of that context, but you are welcome to dig and inspect everything you want.
 
-They are not included in the archive and are thus not mandatory to use
-SimGrid.
+They are not included in the archive and are thus not mandatory to use SimGrid.
 
 These little codes are under the same licence than SimGrid itself.
index 1d51086..7245c97 100644 (file)
@@ -1,4 +1,4 @@
-# Expected dfferences between git repository and tardists
+# Expected differences between git repository and tardists
 #
 # lines beginning with '#', and empty lines are ignored
 # lines beginning with '- ' are expected in archive only
 
 + contrib/.*
 
-+ examples/msg/actions/NAS_LU_S_4/.*
-+ examples/msg/chord/chord3\.xml
-
-+ examples/smpi/MM/host
 + examples/smpi/NAS/.*
 
 + src/simix/README_attempt_without_stack
-+ src/simix/simix_network\.tla
 
 + src/smpi/BUGS
 + src/smpi/colls/alltoall-bruck\.c
-+ src/smpi/fixsrc\.pl
-+ src/smpi/myprintloc\.cocci
-+ src/smpi/patch_source\.sh
-+ src/smpi/replace_globals\.cocci
-+ src/smpi/replace_static\.cocci
 
 + teshsuite/smpi/mpich3-test/f77/attr/.*
 
index 345caff..aa72529 100755 (executable)
@@ -121,7 +121,7 @@ cmake -G"$GENERATOR"\
   -Denable_mallocators=$(onoff test "$build_mode" != "DynamicAnalysis") \
   -Denable_memcheck=$(onoff test "$build_mode" = "DynamicAnalysis") \
   -Denable_compile_warnings=$(onoff test "$GENERATOR" != "MSYS Makefiles") -Denable_smpi=ON \
-  -Denable_jedule=OFF -Denable_tracing=ON -Denable_java=ON -Denable_lua=OFF $SRCFOLDER
+  -Denable_jedule=OFF -Denable_java=ON -Denable_lua=OFF $SRCFOLDER
 #  -Denable_lua=$(onoff test "$build_mode" != "DynamicAnalysis") \
 
 make -j$NUMBER_OF_PROCESSORS VERBOSE=1
index bb2f59a..e138111 100755 (executable)
@@ -10,7 +10,6 @@
 Tool for normalizing pointers such as two runs have the same 'addresses'
 
 first address encountered will be replaced by 0X0000001, second by 0X0000002, ...
-
 """
 
 import sys
index 9cbc2f5..2dee83a 100755 (executable)
@@ -5,10 +5,6 @@
 # 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.
 
-
-
-use strict;
-
 use strict;
 use Getopt::Long qw(GetOptions);
 
index 3aff70a..e31ca86 100644 (file)
@@ -5,8 +5,7 @@ Provides stack-cleaning compilers for x86_64:
  * c++
  * fortran
 
-Each of them modify the generated/given X86_64 assembly by prepending
-stack-cleanup code to each function:
+Each of them modify the generated/given X86_64 assembly by prepending stack-cleanup code to each function:
 
        movq $0x7ffff7ff8000, %r11
        cmpq %r11, %rsp
@@ -18,9 +17,7 @@ stack-cleanup code to each function:
         jne  .Lstack_cleaner_loop0:
 .Lstack_cleaner_done0:
 
-The modification of the assembly is done by the clean-stack-filter
-program.
+The modification of the assembly is done by the clean-stack-filter program.
 
-If the underlying compiler is clang, it might be necessary to add the
--no-integrated-as flag in order to force the usage of an external
-assembler.
+If the underlying compiler is clang, it might be necessary to add the -no-integrated-as flag in order to force the 
+usage of an external assembler.
index 64e7990..8b15cd7 100755 (executable)
@@ -15,7 +15,6 @@ our $lines = "";
 # Size of the stack for this function:
 our $size = 0;
 
-
 # Counter for assigning unique ids to labels:
 our $id=0;
 
@@ -52,14 +51,14 @@ while (<>) {
   if ($scanproc) {
       $lines = $lines . $_;
       if (m/^[ \t]*.cfi_endproc$/) {
-         emit_code();
+        emit_code();
       } elsif (m/^[ \t]*pushq/) {
-         $size += 8;
+         $size += 8;
       } elsif (m/^[ \t]*subq[\t *]\$([0-9]*),[ \t]*%rsp$/) {
-          my $val = $1;
-          $val = oct($val) if $val =~ /^0/;
-          $size += $val;
-          emit_code();
+         my $val = $1;
+         $val = oct($val) if $val =~ /^0/;
+         $size += $val;
+         emit_code();
       }
   } elsif (m/^[ \t]*.cfi_startproc$/) {
       print $_;