Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge remote-tracking branch 'origin/master'
authorjean-noel quintin <jnquintin@dhcp-892b9b4c.ucd.ie>
Wed, 3 Oct 2012 15:28:45 +0000 (16:28 +0100)
committerjean-noel quintin <jnquintin@dhcp-892b9b4c.ucd.ie>
Wed, 3 Oct 2012 15:28:45 +0000 (16:28 +0100)
Conflicts:
src/smpi/smpi_base.c

73 files changed:
ChangeLog
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/Flags.cmake
buildtools/Cmake/memcheck_tests.cmake
examples/msg/actions/actions.c
examples/msg/bittorrent/bittorrent.c
examples/msg/bittorrent/bittorrent_platfgen.c
examples/msg/chord/chord.c
examples/msg/cloud/masterslave_virtual_machines.c
examples/msg/gpu/test_MSG_gpu_task_create.c
examples/msg/gtnets/gtnets.c
examples/msg/icomms/peer.c
examples/msg/icomms/peer2.c
examples/msg/icomms/peer3.c
examples/msg/io/file.c
examples/msg/io/file_unlink.c
examples/msg/kademlia/kademlia.c
examples/msg/masterslave/masterslave_arg.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_console.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_kill.c
examples/msg/masterslave/masterslave_mailbox.c
examples/msg/mc/bugged1.c
examples/msg/migration/migration.c
examples/msg/ns3/ns3.c
examples/msg/parallel_task/parallel_task.c
examples/msg/parallel_task/test_ptask.c
examples/msg/pmm/msg_pmm.c
examples/msg/priority/priority.c
examples/msg/properties/msg_prop.c
examples/msg/sendrecv/sendrecv.c
examples/msg/start_kill_time/sk_time.c
examples/msg/suspend/suspend.c
examples/msg/token_ring/ring_call.c
examples/msg/token_ring/token_bypass.c
examples/msg/tracing/categories.c
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/simdag/test_simdag_fail.tesh
examples/smpi/mc_bugged2.c
examples/smpi/replay/smpi_replay.tesh
include/msg/msg.h
include/simgrid/simix.h
include/smpi/smpi.h
include/xbt/sysdep.h
src/amok/Bandwidth/bandwidth.c
src/bindings/lua/simgrid_lua.c
src/gras/Transport/transport.c
src/gras/Virtu/sg_process.c
src/msg/msg_global.c
src/msg/msg_gos.c
src/simix/smx_global.c
src/simix/smx_network.c
src/smpi/private.h
src/smpi/smpi_base.c
src/smpi/smpi_global.c
src/smpi/smpi_mpi.c
src/smpi/smpi_pmpi.c
src/xbt/datadesc/datadesc.c
src/xbt/xbt_main.c
teshsuite/msg/get_sender.c
teshsuite/msg/trace/test_trace_integration.c
teshsuite/simdag/platforms/basic_tracing.c
tools/graphicator/graphicator.c

index fa21ecf..97393aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,7 +25,8 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    executing comes back (ON_FAILURE="RESTART" on deployment file, 
    MSG_process_auto_restart_set).
  * Use the "msg_" prefix for all datatypes (instead of m_, msg_ and MSG_),
-  please stop using the old ones.
+   please stop using the old ones, they are DEPRECATED.
+ * Deprecate MSG_clean(). No need to call it anymore.
 
  Simix:
  * Bug fixes around the resource failures: don't let the processes
@@ -34,6 +35,8 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    to avoid memory leaks.
  * Add an interface to auto-restart processes when the host in which they are
    executing comes back.
+ * Ensures that SIMIX_clean is called automatically. It's not part of
+   the public interface anymore (bindings should be updated).
 
  SimDag:
  * New types of typed tasks. SD_TASK_COMP_PAR_AMDAHL represents a
index 7ee2360..9170626 100644 (file)
@@ -370,7 +370,7 @@ if(NOT enable_memcheck)
   ADD_TEST(simdag-test-simdag2                  ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag --cd ${CMAKE_BINARY_DIR}/examples/simdag ${CMAKE_HOME_DIRECTORY}/examples/simdag/test_simdag2.tesh)
   ADD_TEST(simdag-test-seq-access               ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag --cd ${CMAKE_BINARY_DIR}/examples/simdag ${CMAKE_HOME_DIRECTORY}/examples/simdag/test_simdag_seq_access.tesh)
   ADD_TEST(simdag-test-typed-tasks              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag --cd ${CMAKE_BINARY_DIR}/examples/simdag ${CMAKE_HOME_DIRECTORY}/examples/simdag/test_simdag_typed_tasks.tesh)
-  ADD_TEST(simdag-test-fail                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag --cd ${CMAKE_BINARY_DIR}/examples/simdag ${CMAKE_HOME_DIRECTORY}/examples/simdag/test_simdag_fail.tesh)
+  ADD_TEST(simdag-test-fail                    ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/simdag --cd ${CMAKE_HOME_DIRECTORY}/examples/simdag test_simdag_fail.tesh)
   ADD_TEST(simdag-test-comm-throttling          ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag --cd ${CMAKE_BINARY_DIR}/examples/simdag ${CMAKE_HOME_DIRECTORY}/examples/simdag/test_simdag_comm_throttling.tesh)
   ADD_TEST(simdag-test-dax-cycle                ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag/dax --cd ${CMAKE_BINARY_DIR}/examples/simdag/dax ${CMAKE_HOME_DIRECTORY}/examples/simdag/dax/simple_dax_with_cycle.tesh)
   ADD_TEST(simdag-test-prop                     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/simdag --cd ${CMAKE_BINARY_DIR}/examples/simdag ${CMAKE_HOME_DIRECTORY}/examples/simdag/properties/test_prop.tesh)
@@ -472,7 +472,7 @@ if(NOT enable_memcheck)
     endif(CONTEXT_UCONTEXT)
     if(HAVE_TRACING)
       ADD_TEST(smpi-tracing-ptp                 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/tracing/smpi_traced.tesh)
-      ADD_TEST(smpi-replay                     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/smpi_replay.tesh)
+      ADD_TEST(smpi-replay                     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/smpi_replay.tesh)
     endif(HAVE_TRACING)
   endif(enable_smpi)
 
index 77f54c4..0162d0a 100644 (file)
@@ -888,6 +888,9 @@ else("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY)
   configure_file(${CMAKE_HOME_DIRECTORY}/examples/msg/tracing/platform.xml ${CMAKE_BINARY_DIR}/examples/msg/tracing/platform.xml COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
+  configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_bcast.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt COPYONLY)
 
   set(generated_files_to_clean
     ${generated_files_to_clean}
@@ -895,6 +898,9 @@ else("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
     ${CMAKE_BINARY_DIR}/examples/msg/small_platform.xml
     ${CMAKE_BINARY_DIR}/examples/msg/small_platform_with_routers.xml
     ${CMAKE_BINARY_DIR}/examples/msg/tracing/platform.xml
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt
+    ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt
     )
 endif("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
 
index 6a10c8f..3fab3f3 100644 (file)
@@ -54,6 +54,7 @@ if(enable_coverage)
   find_program(GCOV_PATH gcov)
   if(GCOV_PATH)
     SET(COVERAGE_COMMAND "${GCOV_PATH}" CACHE TYPE FILEPATH FORCE)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOVERAGE")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
     set(TESH_OPTION --enable-coverage)
index 406d3d2..e4bb71a 100644 (file)
@@ -473,7 +473,7 @@ ADD_TEST(memcheck-simdag-test-simdag-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_te
 ADD_TEST(memcheck-simdag-test-simdag2-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_test2 ${CMAKE_HOME_DIRECTORY}/examples/simdag/2clusters.xml --cd ${CMAKE_BINARY_DIR}/examples/simdag/)
 ADD_TEST(memcheck-simdag-test-seq-access-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_seq_access ${CMAKE_HOME_DIRECTORY}/examples/simdag/2clusters.xml --cd ${CMAKE_BINARY_DIR}/examples/simdag/)
 ADD_TEST(memcheck-simdag-test-typed-tasks-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_typed_tasks_test --cfg=network/TCP_gamma:4194304 ${CMAKE_HOME_DIRECTORY}/examples/simdag/2clusters.xml --cd ${CMAKE_BINARY_DIR}/examples/simdag/)
-ADD_TEST(memcheck-simdag-test-fail-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_fail --cd ${CMAKE_BINARY_DIR}/examples/simdag/)
+ADD_TEST(memcheck-simdag-test-fail-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_fail --cd ${CMAKE_HOME_DIRECTORY}/examples/simdag/)
 ADD_TEST(memcheck-simdag-test-comm-throttling-0 ${CMAKE_BINARY_DIR}/examples/simdag/sd_comm_throttling --cfg=network/TCP_gamma:4194304 ${CMAKE_HOME_DIRECTORY}/examples/simdag/2clusters.xml --cd ${CMAKE_BINARY_DIR}/examples/simdag/)
 ADD_TEST(memcheck-simdag-test-dax-cycle-0 ${CMAKE_BINARY_DIR}/examples/simdag/dax/dax_test --log=no_loc ${CMAKE_HOME_DIRECTORY}/examples/simdag/dax/../2clusters.xml ${CMAKE_HOME_DIRECTORY}/examples/simdag/dax/simple_dax_with_cycle.xml --cd ${CMAKE_BINARY_DIR}/examples/simdag/dax/)
 ADD_TEST(memcheck-simdag-test-prop-0 ${CMAKE_BINARY_DIR}/examples/simdag/properties/sd_prop ${CMAKE_HOME_DIRECTORY}/examples/simdag/../platforms/prop.xml --cd ${CMAKE_BINARY_DIR}/examples/simdag/)
index 4866c34..22e5961 100644 (file)
@@ -589,7 +589,6 @@ int main(int argc, char *argv[])
   res = MSG_action_trace_run(argv[3]);  // it's ok to pass a NULL argument here
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 3679330..e0e4c68 100644 (file)
@@ -32,7 +32,5 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 }
index ff18530..7147b50 100644 (file)
@@ -138,7 +138,5 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 }
index 129c79a..5061abd 100644 (file)
@@ -924,7 +924,6 @@ int main(int argc, char *argv[])
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
 
-  MSG_clean();
   chord_exit();
 
   if (res == MSG_OK)
index 8e11b09..b0a073a 100644 (file)
@@ -212,7 +212,6 @@ int main(int argc, char *argv[])
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  MSG_clean();
   free(hosts);
   free(hostnames);
   xbt_dynar_free(&hosts_dynar);
index ad78f79..29362af 100644 (file)
@@ -32,8 +32,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("GPU task %p was created", mytask);
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index defbc80..5236980 100644 (file)
@@ -239,8 +239,6 @@ int main(int argc, char *argv[])
 
   res = test_all(argv[1], argv[2]);
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index cfcfa8d..5ed53e0 100644 (file)
@@ -178,7 +178,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ee1111f..01d03c6 100644 (file)
@@ -131,7 +131,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ae82a7c..a01f2c7 100644 (file)
@@ -165,7 +165,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 6769661..96b70b3 100644 (file)
@@ -89,7 +89,6 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
   if (res == MSG_OK)
     return 0;
   else
index 8a36a78..2d8c5eb 100644 (file)
@@ -121,7 +121,6 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
   if (res == MSG_OK)
     return 0;
   else
index 1f5f732..10c30ce 100644 (file)
@@ -489,7 +489,6 @@ int main(int argc, char *argv[])
 
   XBT_CRITICAL("Messages created: %ld", smx_total_comms);
   XBT_INFO("Simulated time: %g", MSG_get_clock());
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ad3d593..873fedb 100644 (file)
@@ -138,8 +138,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 95bc507..41cb1f8 100644 (file)
@@ -283,7 +283,6 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   res = test_all();
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 8c02de7..d05ec6a 100644 (file)
@@ -220,7 +220,6 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   res = test_all(argv[1]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ecefae1..d49df00 100644 (file)
@@ -131,7 +131,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 7292997..6a4f5e3 100644 (file)
@@ -210,7 +210,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 3817018..20f6841 100644 (file)
@@ -214,7 +214,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 85d50d6..bc0a2dc 100644 (file)
@@ -73,7 +73,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   test_all(argv[1], argv[2]);
-  res = MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index d69ed23..73dd03c 100644 (file)
@@ -125,7 +125,6 @@ int main(int argc, char *argv[])
   res = MSG_main();
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 3200fbd..585a1f3 100644 (file)
@@ -66,8 +66,6 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
-  MSG_clean();
-
   return 0;
 
 }
index fc14097..87df498 100644 (file)
@@ -98,9 +98,6 @@ int main(int argc, char *argv[])
   xbt_cond_destroy(cond);
   xbt_mutex_destroy(mutex);
 
-  if (res == MSG_OK)
-    res = MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 44e213e..6db54f3 100644 (file)
@@ -218,8 +218,6 @@ int main(int argc, char *argv[])
 
   res = test_all(argv[1], argv[2]);
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 7bd1811..e70aa46 100644 (file)
@@ -101,7 +101,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 5cae522..efe1356 100644 (file)
@@ -164,7 +164,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 4e2157e..f9b9c8d 100644 (file)
@@ -280,8 +280,6 @@ int main(int argc, char *argv[])
 #endif
   XBT_CRITICAL("Simulated time: %g", MSG_get_clock());
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index 958ebfe..f82d132 100644 (file)
@@ -80,7 +80,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
 #ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
index 7c05736..2347d0c 100644 (file)
@@ -135,7 +135,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   res = test_all(argv[1], argv[2]);
-  MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index bfd7b3b..038697c 100644 (file)
@@ -190,8 +190,6 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Total simulation time: %le", MSG_get_clock());
 
-  MSG_clean();
-
 #ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
 #endif
index af61d37..03bb06b 100644 (file)
@@ -60,7 +60,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   test_all(argv[1], argv[2]);
-  res = MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index ea62f62..bdc0085 100644 (file)
@@ -76,7 +76,6 @@ int main(int argc, char *argv[])
     exit(1);
   }
   test_all(argv[1], argv[2]);
-  res = MSG_clean();
 
   if (res == MSG_OK)
     return 0;
index 94bd2ca..fc60925 100644 (file)
@@ -80,7 +80,6 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
   if (res == MSG_OK)
     return 0;
   else
index 3902008..a5690e7 100644 (file)
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
+
   if (res == MSG_OK)
     return 0;
   else
index fd5221e..19d993c 100644 (file)
@@ -109,6 +109,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index cf228cd..65c0e4c 100644 (file)
@@ -95,6 +95,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 15db60e..46af714 100644 (file)
@@ -87,6 +87,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 532d6f6..69fe71b 100644 (file)
@@ -155,6 +155,5 @@ int main(int argc, char *argv[])
     xbt_dynar_free (&marks);
   }
 
-  MSG_clean();
   return 0;
 }                               /* end_of_main */
index 922495f..25ff189 100644 (file)
@@ -98,6 +98,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }                               /* end_of_main */
index f6c852f..25050e7 100644 (file)
@@ -53,6 +53,5 @@ int main(int argc, char *argv[])
   MSG_launch_application(deployment_file);
 
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 685a8bf..427a891 100644 (file)
@@ -35,6 +35,5 @@ int main(int argc, char *argv[])
   char *platform_file = argv[1];
   MSG_create_environment(platform_file);
   MSG_main();
-  MSG_clean();
   return 0;
 }
index 1a4e607..65697ff 100644 (file)
@@ -104,7 +104,6 @@ int main(int argc, char *argv[])
   FILE *fp;
   fp = fopen ("triva_graph.plist", "w");
   if (!fp){
-    MSG_clean();
     return 1;
   }
   fprintf (fp, "{\n node = (");
@@ -135,6 +134,5 @@ int main(int argc, char *argv[])
   fprintf (fp, "}\n");
   fclose (fp);
 
-  MSG_clean();
   return 0;
 }
index 108ddfd..9d87dfc 100644 (file)
@@ -2,7 +2,7 @@
 
 p Test of the management of failed tasks simdag
 
-$ $SG_TEST_EXENV ./sd_fail
+$ $SG_TEST_EXENV ${bindir:=.}/sd_fail
 > [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07
 > [0.000000] [sd_fail/INFO] First test: COMP_SEQ task
 > [0.000000] [sd_fail/INFO] Schedule task 'Poor task' on workstation 'Faulty Host'
index 707950e..479b147 100644 (file)
@@ -13,7 +13,7 @@
 
 int main(int argc, char **argv)
 {
-  int recv_buff, err, size, rank;
+  int x,y, err, size, rank;
   MPI_Status status;
 
   /* Initialize MPI */
@@ -32,10 +32,10 @@ int main(int argc, char **argv)
   }
 
   if (rank % 3 == 0) {
-    MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
-    printf("(%d) receive %d\n", rank, recv_buff);
-    MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
-    printf("(%d) receive %d\n", rank, recv_buff);
+    MPI_Recv(&x, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+    printf("(%d) x <- %d\n", rank, x);
+    MPI_Recv(&y, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+    printf("(%d) y <- %d\n", rank, y);
   }else{
     MPI_Send(&rank, 1, MPI_INT, (rank / 3) * 3, 42, MPI_COMM_WORLD);
     printf("Sent %d to rank %d\n", rank, (rank / 3) * 3);
index 4120087..79e5092 100644 (file)
@@ -8,22 +8,23 @@ $ ../../bin/smpirun --log=replay.thresh:critical --log=smpi_replay.thresh:verbos
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
 > [Tremblay:0:(0) 0.000000] [smpi_replay/VERBOSE] 0 comm_size 3 0.000000
-> [Fafard:2:(0) 75.475893] [smpi_replay/VERBOSE] 2 bcast 5e8 75.475893
-> [Fafard:2:(0) 82.029316] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
-> [Jupiter:1:(0) 85.401170] [smpi_replay/VERBOSE] 1 bcast 5e8 85.401170
-> [Tremblay:0:(0) 85.401170] [smpi_replay/VERBOSE] 0 bcast 5e8 85.401170
-> [Jupiter:1:(0) 88.022539] [smpi_replay/VERBOSE] 1 compute 2e8 2.621369
-> [Tremblay:0:(0) 90.498269] [smpi_replay/VERBOSE] 0 compute 5e8 5.097100
-> [Fafard:2:(0) 165.974172] [smpi_replay/VERBOSE] 2 bcast 5e8 83.944856
-> [Fafard:2:(0) 172.527595] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
-> [Jupiter:1:(0) 175.899449] [smpi_replay/VERBOSE] 1 bcast 5e8 87.876910
-> [Tremblay:0:(0) 175.899449] [smpi_replay/VERBOSE] 0 bcast 5e8 85.401180
-> [Jupiter:1:(0) 178.520818] [smpi_replay/VERBOSE] 1 compute 2e8 2.621369
-> [Tremblay:0:(0) 180.996549] [smpi_replay/VERBOSE] 0 compute 5e8 5.097100
-> [Fafard:2:(0) 256.472441] [smpi_replay/VERBOSE] 2 reduce 5e8 5e8 83.944846
-> [Jupiter:1:(0) 266.397728] [smpi_replay/VERBOSE] 1 reduce 5e8 5e8 87.876910
-> [Tremblay:0:(0) 266.397728] [smpi_replay/VERBOSE] 0 reduce 5e8 5e8 85.401180
-> [Tremblay:0:(0) 266.397728] [smpi_replay/INFO] Simulation time 266.398
+> [Fafard:2:(0) 65.176535] [smpi_replay/VERBOSE] 2 bcast 5e8 65.176535
+> [Fafard:2:(0) 71.729958] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
+> [Jupiter:1:(0) 73.739750] [smpi_replay/VERBOSE] 1 bcast 5e8 73.739750
+> [Tremblay:0:(0) 73.739750] [smpi_replay/VERBOSE] 0 bcast 5e8 73.739750
+> [Jupiter:1:(0) 76.361119] [smpi_replay/VERBOSE] 1 compute 2e8 2.621369
+> [Tremblay:0:(0) 78.836850] [smpi_replay/VERBOSE] 0 compute 5e8 5.097100
+> [Fafard:2:(0) 144.013395] [smpi_replay/VERBOSE] 2 bcast 5e8 72.283436
+> [Fafard:2:(0) 150.566818] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
+> [Jupiter:1:(0) 152.576610] [smpi_replay/VERBOSE] 1 bcast 5e8 76.215490
+> [Tremblay:0:(0) 152.576610] [smpi_replay/VERBOSE] 0 bcast 5e8 73.739760
+> [Jupiter:1:(0) 155.197979] [smpi_replay/VERBOSE] 1 compute 2e8 2.621369
+> [Tremblay:0:(0) 157.673709] [smpi_replay/VERBOSE] 0 compute 5e8 5.097100
+> [Fafard:2:(0) 222.850244] [smpi_replay/VERBOSE] 2 reduce 5e8 5e8 72.283426
+> [Jupiter:1:(0) 231.413469] [smpi_replay/VERBOSE] 1 reduce 5e8 5e8 76.215490
+> [Tremblay:0:(0) 231.413469] [smpi_replay/VERBOSE] 0 reduce 5e8 5e8 73.739760
+> [Tremblay:0:(0) 231.413469] [smpi_replay/INFO] Simulation time 231.413
+
 
 p The same with tracing activated
 $ ../../bin/smpirun --log=replay.thresh:critical --log=no_loc  --cfg=tracing:1 --cfg=tracing/smpi:1 --cfg=tracing/smpi/computing:1 -np 3 -platform ${srcdir:=.}/replay/replay_platform.xml -hostfile ${srcdir:=.}/hostfile ./smpi_replay ${srcdir:=.}/replay/one_trace
@@ -34,7 +35,8 @@ $ ../../bin/smpirun --log=replay.thresh:critical --log=no_loc  --cfg=tracing:1 -
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/smpi' to '1'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/smpi/computing' to '1'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
-> [Tremblay:0:(0) 266.397728] [smpi_replay/INFO] Simulation time 266.398
+> [Tremblay:0:(0) 231.413469] [smpi_replay/INFO] Simulation time 231.413
+
 
 $ cat ./simgrid.trace
 > #This file was generated using SimGrid-3.8.0
@@ -163,43 +165,44 @@ $ cat ./simgrid.trace
 > 12 0 2 3 4
 > 13 0 2 3
 > 12 0 2 3 5
-> 13 75.475893 2 3
-> 12 75.475893 2 3 4
-> 13 82.029316 2 3
-> 12 82.029316 2 3 5
-> 13 85.401170 2 2
-> 12 85.401170 2 2 4
-> 13 85.401170 2 1
-> 12 85.401170 2 1 4
+> 13 65.176535 2 3
+> 12 65.176535 2 3 4
+> 13 71.729958 2 3
+> 12 71.729958 2 3 5
+> 13 73.739750 2 2
+> 12 73.739750 2 2 4
+> 13 73.739750 2 1
+> 12 73.739750 2 1 4
 > 5 6 2 action_reduce "0 1 0"
-> 13 88.022539 2 2
-> 12 88.022539 2 2 5
-> 13 90.498269 2 1
-> 12 90.498269 2 1 5
-> 13 165.974172 2 3
-> 12 165.974172 2 3 4
-> 13 172.527595 2 3
-> 12 172.527595 2 3 6
-> 13 175.899449 2 2
-> 12 175.899449 2 2 4
-> 13 175.899449 2 1
-> 12 175.899449 2 1 4
-> 13 178.520818 2 2
-> 12 178.520818 2 2 6
-> 13 180.996549 2 1
-> 12 180.996549 2 1 6
-> 13 256.472441 2 3
-> 12 256.472441 2 3 4
-> 13 256.472442 2 3
-> 7 256.472442 1 3
-> 13 266.397728 2 2
-> 12 266.397728 2 2 4
-> 13 266.397728 2 1
-> 12 266.397728 2 1 4
-> 13 266.397729 2 1
-> 7 266.397729 1 1
-> 13 266.397729 2 2
-> 7 266.397729 1 2
+> 13 76.361119 2 2
+> 12 76.361119 2 2 5
+> 13 78.836850 2 1
+> 12 78.836850 2 1 5
+> 13 144.013395 2 3
+> 12 144.013395 2 3 4
+> 13 150.566818 2 3
+> 12 150.566818 2 3 6
+> 13 152.576610 2 2
+> 12 152.576610 2 2 4
+> 13 152.576610 2 1
+> 12 152.576610 2 1 4
+> 13 155.197979 2 2
+> 12 155.197979 2 2 6
+> 13 157.673709 2 1
+> 12 157.673709 2 1 6
+> 13 222.850244 2 3
+> 12 222.850244 2 3 4
+> 13 222.850244 2 3
+> 7 222.850244 1 3
+> 13 231.413469 2 2
+> 12 231.413469 2 2 4
+> 13 231.413469 2 2
+> 7 231.413469 1 2
+> 13 231.413469 2 1
+> 12 231.413469 2 1 4
+> 13 231.413469 2 1
+> 7 231.413469 1 1
+
 
 $ rm -f ./simgrid.trace
 
@@ -209,12 +212,12 @@ $ ../../bin/smpirun --log=replay.thresh:critical --log=smpi_replay.thresh:verbos
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
-> [Tremblay:0:(0) 0.173741] [smpi_replay/VERBOSE] 0 send 1 1e6 0.173741
-> [Jupiter:1:(0) 0.173741] [smpi_replay/VERBOSE] 1 recv 0 1e6 0.173741
-> [Jupiter:1:(0) 13.280588] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847
-> [Jupiter:1:(0) 13.280588] [smpi_replay/VERBOSE] 1 Isend 0 1e6 0.000000
-> [Jupiter:1:(0) 13.280588] [smpi_replay/VERBOSE] 1 Irecv 0 1e6 0.000000
-> [Tremblay:0:(0) 13.593030] [smpi_replay/VERBOSE] 0 recv 1 1e6 13.419289
-> [Jupiter:1:(0) 13.905472] [smpi_replay/VERBOSE] 1 wait 0.624884
-> [Tremblay:0:(0) 13.905472] [smpi_replay/VERBOSE] 0 send 1 1e6 0.312442
-> [Tremblay:0:(0) 13.905472] [smpi_replay/INFO] Simulation time 13.9055
+> [Tremblay:0:(0) 0.164463] [smpi_replay/VERBOSE] 0 send 1 1e6 0.164463
+> [Jupiter:1:(0) 0.164463] [smpi_replay/VERBOSE] 1 recv 0 1e6 0.164463
+> [Jupiter:1:(0) 13.271310] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847
+> [Jupiter:1:(0) 13.271310] [smpi_replay/VERBOSE] 1 Isend 0 1e6 0.000000
+> [Jupiter:1:(0) 13.271310] [smpi_replay/VERBOSE] 1 Irecv 0 1e6 0.000000
+> [Tremblay:0:(0) 13.574474] [smpi_replay/VERBOSE] 0 recv 1 1e6 13.410011
+> [Jupiter:1:(0) 13.877637] [smpi_replay/VERBOSE] 1 wait 0.606328
+> [Tremblay:0:(0) 13.877637] [smpi_replay/VERBOSE] 0 send 1 1e6 0.303164
+> [Tremblay:0:(0) 13.877637] [smpi_replay/INFO] Simulation time 13.8776
index d11cec3..cfcffee 100644 (file)
@@ -56,7 +56,6 @@ XBT_PUBLIC(void) MSG_config(const char *name, ...);
 
 XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
 XBT_PUBLIC(msg_error_t) MSG_main(void);
-XBT_PUBLIC(msg_error_t) MSG_clean(void);
 XBT_PUBLIC(void) MSG_function_register(const char *name,
                                        xbt_main_func_t code);
 XBT_PUBLIC(void) MSG_function_register_default(xbt_main_func_t code);
@@ -294,6 +293,8 @@ XBT_PUBLIC(msg_host_t *) MSG_get_host_table(void);
 #define MSG_process_change_host(h) MSG_process_migrate(MSG_process_self(),h);
 XBT_PUBLIC(msg_error_t) MSG_get_errno(void);
 
+XBT_PUBLIC(msg_error_t) MSG_clean(void);
+
 XBT_PUBLIC(msg_error_t) MSG_task_get(msg_task_t * task, m_channel_t channel);
 XBT_PUBLIC(msg_error_t) MSG_task_get_with_timeout(msg_task_t * task,
                                                   m_channel_t channel,
index 5fe3313..003500a 100644 (file)
@@ -215,7 +215,6 @@ XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
 /********************************** Global ************************************/
 /* Initialization and exit */
 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
-XBT_PUBLIC(void) SIMIX_clean(void);
 
 
 XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
index 822c1a0..1e768df 100644 (file)
@@ -58,6 +58,10 @@ SG_BEGIN_DECL()
 #define MPI_UNEQUAL   2
 #define MPI_CONGRUENT 3
 #define MPI_WTIME_IS_GLOBAL 1
+#define MPI_TAG_UB           1000000
+#define MPI_HOST             0
+#define MPI_IO               0
+
 typedef ptrdiff_t MPI_Aint;
 typedef long long MPI_Offset;
 
@@ -305,7 +309,10 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Waitsome,
                             (int incount, MPI_Request requests[],
                              int *outcount, int *indices,
                              MPI_Status status[]));
-
+MPI_CALL(XBT_PUBLIC(int), MPI_Testsome,
+                            (int incount, MPI_Request requests[],
+                             int *outcount, int *indices,
+                             MPI_Status status[]));
 MPI_CALL(XBT_PUBLIC(int), MPI_Bcast,
                             (void *buf, int count, MPI_Datatype datatype,
                              int root, MPI_Comm comm));
@@ -407,8 +414,8 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_set, (MPI_Comm comm, MPI_Errhandler err
 MPI_CALL(XBT_PUBLIC(int), MPI_Cancel, (MPI_Request* request));
 MPI_CALL(XBT_PUBLIC(int), MPI_Buffer_attach, (void* buffer, int size));
 MPI_CALL(XBT_PUBLIC(int), MPI_Buffer_detach, (void* buffer, int* size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Testsome, (int incount, MPI_Request* requests, int* outcount, int* indices, MPI_Status* statuses));
 MPI_CALL(XBT_PUBLIC(int), MPI_Comm_test_inter, (MPI_Comm comm, int* flag));
+MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_attr, (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag));
 MPI_CALL(XBT_PUBLIC(int), MPI_Unpack, (void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm));
 MPI_CALL(XBT_PUBLIC(int), MPI_Ssend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
 MPI_CALL(XBT_PUBLIC(int), MPI_Ssend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
index 696dd69..4bc927c 100644 (file)
@@ -31,7 +31,17 @@ SG_BEGIN_DECL()
  * @{
  */
 /** @brief Kill the program in silence */
+#ifdef COVERAGE
+/* Call __gcov_flush on abort when compiling with coverage options. */
+#define xbt_abort()                             \
+  do {                                          \
+    extern void __gcov_flush(void);             \
+    __gcov_flush();                             \
+    abort();                                    \
+  } while (0)
+#else
 #define xbt_abort() abort()
+#endif
 
 /**
  * @brief Kill the program with an error message
index d5fb441..05ebc4e 100644 (file)
@@ -293,8 +293,8 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
   volatile bw_request_t request = *(bw_request_t *) payload;
   bw_request_t answer;
   xbt_ex_t e;
-  int port;
-  int tooshort = 1;
+  volatile int port;
+  volatile int tooshort = 1;
   gras_msg_cb_ctx_t ctx_reask;
   static xbt_dynar_t msgtwaited = NULL;
 
index 440c562..6eb8d7e 100644 (file)
@@ -185,9 +185,11 @@ static int get_clock(lua_State* L) {
  */
 static int simgrid_gc(lua_State * L)
 {
-  if (sglua_is_maestro(L)) {
-    MSG_clean();
-  }
+  // There is no need to cleanup the C world anymore, as it gets cleaned at system process closing automatically
+  // Maybe at some point we'll want to reintroduce this, for example when encapsulating the simulation properly
+  //if (sglua_is_maestro(L)) {
+  //  MSG_clean();
+  //}
   return 0;
 }
 
index ce6a7e5..1c86966 100644 (file)
@@ -85,8 +85,7 @@ xbt_socket_t
 gras_socket_server_range(unsigned short minport, unsigned short maxport,
                          unsigned long int buf_size, int measurement)
 {
-
-  int port;
+  volatile int port;
   xbt_socket_t res = NULL;
   xbt_ex_t e;
 
index 4dfee83..96773db 100644 (file)
@@ -263,7 +263,5 @@ void gras_load_environment_script(const char *script_file)
   return;
 }
 
-void gras_clean()
-{
-  SIMIX_clean();
+void gras_clean(){ /* this function is not needed anymore and could be removed, but I feel so lazy */
 }
index 5aef61a..9daa413 100644 (file)
@@ -18,6 +18,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg,
                                 "Logging specific to MSG (kernel)");
 
 MSG_Global_t msg_global = NULL;
+static void MSG_exit(void);
 
 /********************************* MSG **************************************/
 
@@ -72,6 +73,8 @@ void MSG_init_nocheck(int *argc, char **argv) {
 
   XBT_DEBUG("ADD MSG LEVELS");
   MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_destroy);
+
+  atexit(MSG_exit);
 }
 
 #ifdef MSG_USE_DEPRECATED
@@ -147,19 +150,14 @@ int MSG_process_killall(int reset_PIDs)
 
 }
 
-/** \ingroup msg_simulation
- * \brief Clean the MSG simulation
- */
-msg_error_t MSG_clean(void)
-{
-  XBT_DEBUG("Closing MSG");
+static void MSG_exit(void) {
+  if (msg_global==NULL)
+    return;
 
 #ifdef HAVE_TRACING
   TRACE_surf_release();
 #endif
 
-  MSG_process_killall(0);
-
   /* initialization of the action module */
   _MSG_action_exit();
 
@@ -167,13 +165,9 @@ msg_error_t MSG_clean(void)
   TRACE_end();
 #endif
 
-  SIMIX_clean();
-
   xbt_swag_free(msg_global->vms);
   free(msg_global);
   msg_global = NULL;
-
-  return MSG_OK;
 }
 
 
@@ -189,3 +183,9 @@ unsigned long int MSG_get_sent_msg()
 {
   return msg_global->sent_msg;
 }
+
+#ifdef MSG_USE_DEPRECATED
+msg_error_t MSG_clean(void) {
+  return MSG_OK;
+}
+#endif
index e63d05f..a883deb 100644 (file)
@@ -664,7 +664,7 @@ msg_task_t MSG_comm_get_task(msg_comm_t comm)
 }
 
 /**
- * \brief This function is called by SIMIX to copy the data of a comm.
+ * \brief This function is called by SIMIX in kernel mode to copy the data of a comm.
  * \param comm the comm
  * \param buff the data copied
  * \param buff_size size of the buffer
index 6133fcf..5a350c2 100644 (file)
@@ -22,6 +22,8 @@ static void* SIMIX_action_mallocator_new_f(void);
 static void SIMIX_action_mallocator_free_f(void* action);
 static void SIMIX_action_mallocator_reset_f(void* action);
 
+static void SIMIX_clean(void);
+
 /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
 #include <signal.h>
 
@@ -107,6 +109,8 @@ void SIMIX_global_init(int *argc, char **argv)
 
   XBT_DEBUG("ADD SIMIX LEVELS");
   SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
+
+  atexit(SIMIX_clean);
 }
 
 /**
@@ -115,7 +119,7 @@ void SIMIX_global_init(int *argc, char **argv)
  *
  * This functions remove the memory used by SIMIX
  */
-void SIMIX_clean(void)
+static void SIMIX_clean(void)
 {
 #ifdef TIME_BENCH_PER_SR
   smx_ctx_raw_new_sr();
index 93921fb..8059ee7 100644 (file)
@@ -487,13 +487,19 @@ smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
   XBT_DEBUG("iprobe from %p %p\n", rdv, rdv->comm_fifo);
   smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
 
-  smx_action_t other_action;
+  smx_action_t other_action=NULL;
   if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){
     //find a match in the already received fifo
+      XBT_DEBUG("first try in the perm recv mailbox \n");
+
     other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
-  }else{
-    other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
   }
+ // }else{
+    if(!other_action){
+        XBT_DEBUG("second try in the other mailbox");
+        other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
+    }
+//  }
   if(other_action)other_action->comm.refcount--;
 
   SIMIX_comm_destroy(this_action);
index 0f2487e..108ace8 100644 (file)
@@ -130,7 +130,7 @@ void smpi_datatype_free(MPI_Datatype* type);
 void smpi_datatype_commit(MPI_Datatype* datatype);
 
 
-
+void smpi_empty_status(MPI_Status * status);
 MPI_Op smpi_op_new(MPI_User_function * function, int commute);
 void smpi_op_destroy(MPI_Op op);
 void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
@@ -183,7 +183,7 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
 int smpi_mpi_testall(int count, MPI_Request requests[],
                      MPI_Status status[]);
 void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status);
-MPI_Request smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
+void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
                     MPI_Status* status);
 int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
 void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
@@ -193,6 +193,8 @@ void smpi_mpi_waitall(int count, MPI_Request requests[],
                       MPI_Status status[]);
 int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
                       MPI_Status status[]);
+int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
+                      MPI_Status status[]);
 void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
                     MPI_Comm comm);
 void smpi_mpi_barrier(MPI_Comm comm);
index b4e8aa6..1387109 100644 (file)
@@ -16,8 +16,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi, "Logging specific to SMPI (base
 
 
 static int match_recv(void* a, void* b, smx_action_t ignored) {
-  MPI_Request ref = (MPI_Request)a;
-  MPI_Request req = (MPI_Request)b;
+   MPI_Request ref = (MPI_Request)a;
+   MPI_Request req = (MPI_Request)b;
+   XBT_DEBUG("Trying to match a recv of src %d against %d, tag %d against %d",ref->src,req->src, ref->tag, req->tag);
 
   xbt_assert(ref, "Cannot match recv against null reference");
   xbt_assert(req, "Cannot match recv against null request");
@@ -26,13 +27,13 @@ static int match_recv(void* a, void* b, smx_action_t ignored) {
 }
 
 static int match_send(void* a, void* b,smx_action_t ignored) {
-  MPI_Request ref = (MPI_Request)a;
-  MPI_Request req = (MPI_Request)b;
-
-  xbt_assert(ref, "Cannot match send against null reference");
-  xbt_assert(req, "Cannot match send against null request");
-  return (req->src == MPI_ANY_SOURCE || req->src == ref->src)
-    && (req->tag == MPI_ANY_TAG || req->tag == ref->tag);
+   MPI_Request ref = (MPI_Request)a;
+   MPI_Request req = (MPI_Request)b;
+   XBT_DEBUG("Trying to match a send of src %d against %d, tag %d against %d",ref->src,req->src, ref->tag, req->tag);
+   xbt_assert(ref, "Cannot match send against null reference");
+   xbt_assert(req, "Cannot match send against null request");
+   return (req->src == MPI_ANY_SOURCE || req->src == ref->src)
+          && (req->tag == MPI_ANY_TAG || req->tag == ref->tag);
 }
 
 static MPI_Request build_request(void *buf, int count,
@@ -76,6 +77,15 @@ static MPI_Request build_request(void *buf, int count,
   return request;
 }
 
+
+void smpi_empty_status(MPI_Status * status) {
+  if(status != MPI_STATUS_IGNORE) {
+      status->MPI_SOURCE=MPI_ANY_SOURCE;
+      status->MPI_TAG=MPI_ANY_TAG;
+      status->count=0;
+  }
+}
+
 void smpi_action_trace_run(char *path)
 {
   char *name;
@@ -150,8 +160,7 @@ void smpi_mpi_start(MPI_Request request)
     request->action = simcall_comm_irecv(mailbox, request->buf, &request->size, &match_recv, request);
   } else {
     print_request("New send", request);
-
-    if (request->size < xbt_cfg_get_int(_surf_cfg_set, "smpi/async_small_thres")) { // eager mode => detached send (FIXME: this limit should be configurable)
+    if (request->size < xbt_cfg_get_int(_surf_cfg_set, "smpi/async_small_thres")) { // eager mode
       mailbox = smpi_process_remote_mailbox_small(
                                                   smpi_group_index(smpi_comm_group(request->comm), request->dst));
     }else{
@@ -327,12 +336,15 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
 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)
   if ((*request)->action == NULL)
     flag = 1;
   else
     flag = simcall_comm_test((*request)->action);
   if(flag) {
     finish_wait(request, status);
+  }else{
+    smpi_empty_status(status);
   }
   return flag;
 }
@@ -351,24 +363,29 @@ 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]->action) {
-        xbt_dynar_push(comms, &requests[i]->action);
-        map[size] = i;
-        size++;
+      if((requests[i]!=MPI_REQUEST_NULL) && requests[i]->action) {
+         xbt_dynar_push(comms, &requests[i]->action);
+         map[size] = i;
+         size++;
       }
     }
     if(size > 0) {
       i = simcall_comm_testany(comms);
-      // FIXME: MPI_UNDEFINED or does SIMIX have a return code?
-      if(i != MPI_UNDEFINED) {
+      // not MPI_UNDEFINED, as this is a simix return code
+      if(i != -1) {
         *index = map[i];
-        smpi_mpi_wait(&requests[*index], status);
+        finish_wait(&requests[*index], status);
         flag = 1;
       }
+    }else{
+        //all requests are null or inactive, return true
+        flag=1;
+        smpi_empty_status(status);
     }
     xbt_free(map);
     xbt_dynar_free(&comms);
   }
+
   return flag;
 }
 
@@ -376,12 +393,22 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
 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;
   int flag=1;
   int i;
-  for(i=0; i<count; i++)
-    if (smpi_mpi_test(&requests[i], &status[i])!=1)
-      flag=0;
-
+  for(i=0; i<count; i++){
+    if(requests[i]!= MPI_REQUEST_NULL){
+      if (smpi_mpi_test(&requests[i], pstat)!=1){
+        flag=0;
+      }
+    }else{
+      smpi_empty_status(pstat);
+    }
+    if(status != MPI_STATUSES_IGNORE) {
+      memcpy(&status[i], pstat, sizeof(*pstat));
+    }
+  }
   return flag;
 }
 
@@ -389,34 +416,34 @@ void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status){
   int flag=0;
   //FIXME find another wait to avoid busy waiting ?
   // the issue here is that we have to wait on a nonexistent comm
-  MPI_Request request;
   while(flag==0){
-    request = smpi_mpi_iprobe(source, tag, comm, &flag, status);
+    smpi_mpi_iprobe(source, tag, comm, &flag, status);
     XBT_DEBUG("Busy Waiting on probing : %d", flag);
     if(!flag) {
-      smpi_mpi_request_free(&request);
       simcall_process_sleep(0.0001);
     }
   }
 }
 
-MPI_Request 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, smpi_comm_rank(comm), tag,
-                                     comm, NON_PERSISTENT | RECV);
+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, smpi_comm_rank(comm), tag,
+            comm, NON_PERSISTENT | RECV);
+
   // behave like a receive, but don't do it
   smx_rdv_t mailbox;
 
   print_request("New iprobe", request);
   // We have to test both mailboxes as we don't know if we will receive one one or another
-  if (xbt_cfg_get_int(_surf_cfg_set, "smpi/async_small_thres")>0){
-    mailbox = smpi_process_mailbox_small();
-    request->action = simcall_comm_iprobe(mailbox, request->src, request->tag, &match_recv, (void*)request);
-
-  }
-  if (request->action==NULL){
-    mailbox = smpi_process_mailbox();
-    request->action = simcall_comm_iprobe(mailbox, request->src, request->tag, &match_recv, (void*)request);
-  }
+    if (xbt_cfg_get_int(_surf_cfg_set, "smpi/async_small_thres")>0){
+        mailbox = smpi_process_mailbox_small();
+        XBT_DEBUG("trying to probe the perm recv mailbox");
+        request->action = simcall_comm_iprobe(mailbox, request->src, request->tag, &match_recv, (void*)request);
+    }
+    if (request->action==NULL){
+       mailbox = smpi_process_mailbox();
+        XBT_DEBUG("trying to probe the other mailbox");
+        request->action = simcall_comm_iprobe(mailbox, request->src, request->tag, &match_recv, (void*)request);
+    }
 
   if(request->action){
     MPI_Request req = (MPI_Request)SIMIX_comm_get_src_data(request->action);
@@ -429,8 +456,9 @@ MPI_Request smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_S
     }
   }
   else *flag=false;
+  smpi_mpi_request_free(&request);
 
-  return request;
+  return;
 }
 
 void smpi_mpi_wait(MPI_Request * request, MPI_Status * status)
@@ -468,38 +496,54 @@ int smpi_mpi_waitany(int count, MPI_Request requests[],
     if(size > 0) {
       i = simcall_comm_waitany(comms);
 
-      // FIXME: MPI_UNDEFINED or does SIMIX have a return code?
-      if (i != MPI_UNDEFINED) {
+      // not MPI_UNDEFINED, as this is a simix return code
+      if (i != -1) {
         index = map[i];
         finish_wait(&requests[index], status);
-
       }
     }
     xbt_free(map);
     xbt_dynar_free(&comms);
   }
+
+  if (index==MPI_UNDEFINED)
+    smpi_empty_status(status);
+
   return index;
 }
 
 void smpi_mpi_waitall(int count, MPI_Request requests[],
                       MPI_Status status[])
 {
-  int index, c;
+  int  index, c;
   MPI_Status stat;
-  MPI_Status *pstat = status == MPI_STATUS_IGNORE ? MPI_STATUS_IGNORE : &stat;
-
+  MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
+  //tag invalid requests in the set
   for(c = 0; c < count; c++) {
-    if(MC_IS_ENABLED) {
-      smpi_mpi_wait(&requests[c], pstat);
-      index = c;
-    } else {
-      index = smpi_mpi_waitany(count, requests, pstat);
-      if(index == MPI_UNDEFINED) {
-        break;
+    if(requests[c]==MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL ){
+      if(status != MPI_STATUSES_IGNORE)
+        smpi_empty_status(&status[c]);
+    }else if(requests[c]->src == MPI_PROC_NULL ){
+      if(status != MPI_STATUSES_IGNORE) {
+        smpi_empty_status(&status[c]);
+        status[c].MPI_SOURCE=MPI_PROC_NULL;
       }
     }
-    if(status != MPI_STATUS_IGNORE) {
-      memcpy(&status[index], pstat, sizeof(*pstat));
+  }
+
+  for(c = 0; c < count; c++) {
+      if(MC_IS_ENABLED) {
+        smpi_mpi_wait(&requests[c], pstat);
+        index = c;
+      } else {
+        index = smpi_mpi_waitany(count, requests, pstat);
+        if(index == MPI_UNDEFINED) {
+          break;
+       }
+      if(status != MPI_STATUSES_IGNORE) {
+        memcpy(&status[index], pstat, sizeof(*pstat));
+
+      }
     }
   }
 }
@@ -508,17 +552,51 @@ int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
                       MPI_Status status[])
 {
   int i, count, index;
+  MPI_Status stat;
+  MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
 
   count = 0;
-  for(i = 0; i < incount; i++) {
-    if(smpi_mpi_testany(incount, requests, &index, status)) {
+  for(i = 0; i < incount; i++)
+  {
+    index=smpi_mpi_waitany(incount, requests, pstat);
+    if(index!=MPI_UNDEFINED){
       indices[count] = index;
       count++;
+      if(status != MPI_STATUSES_IGNORE) {
+        memcpy(&status[index], pstat, sizeof(*pstat));
+      }
+    }else{
+      return MPI_UNDEFINED;
     }
   }
   return count;
 }
 
+int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
+                      MPI_Status status[])
+{
+  int i, count, count_dead;
+  MPI_Status stat;
+  MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
+
+  count = 0;
+  for(i = 0; i < incount; i++) {
+    if((requests[i] != MPI_REQUEST_NULL)) {
+      if(smpi_mpi_test(&requests[i], pstat)) {
+         indices[count] = i;
+         count++;
+         if(status != MPI_STATUSES_IGNORE) {
+            memcpy(&status[i], pstat, sizeof(*pstat));
+         }
+      }
+    }else{
+      count_dead++;
+    }
+  }
+  if(count_dead==incount)return MPI_UNDEFINED;
+  else return count;
+}
+
 void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
                     MPI_Comm comm)
 {
@@ -806,7 +884,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
     smpi_mpi_startall(size - 1, requests);
     for(src = 0; src < size - 1; src++) {
       index = smpi_mpi_waitany(size - 1, requests, MPI_STATUS_IGNORE);
-      XBT_VERB("finished waiting any request with index %d", index);
+      XBT_DEBUG("finished waiting any request with index %d", index);
       if(index == MPI_UNDEFINED) {
         break;
       }
index c0706b2..43e5c0c 100644 (file)
@@ -332,6 +332,5 @@ int MAIN__(void)
   TRACE_end();
 #endif
 
-  SIMIX_clean();
   return 0;
 }
index 483bbf5..505d92d 100644 (file)
@@ -169,6 +169,11 @@ int MPI_Comm_size(MPI_Comm comm, int *size)
   return PMPI_Comm_size(comm, size);
 }
 
+int MPI_Comm_get_attr (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag)
+{
+  return PMPI_Comm_get_attr (comm, comm_keyval, attribute_val, flag);
+}
+
 int MPI_Comm_get_name (MPI_Comm comm, char* name, int* len)
 {
   return PMPI_Comm_get_name(comm, name, len);
index d730222..caf671e 100644 (file)
@@ -825,6 +825,8 @@ int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
+  } else if (dst == MPI_PROC_NULL) {
+    retval = MPI_SUCCESS;
   } else {
     *request = smpi_mpi_send_init(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -843,6 +845,8 @@ int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
+  } else if (src == MPI_PROC_NULL) {
+      retval = MPI_SUCCESS;
   } else {
     *request = smpi_mpi_recv_init(buf, count, datatype, src, tag, comm);
     retval = MPI_SUCCESS;
@@ -856,7 +860,7 @@ int PMPI_Start(MPI_Request * request)
   int retval;
 
   smpi_bench_end();
-  if (request == NULL) {
+  if (request == NULL || *request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     smpi_mpi_start(*request);
@@ -886,7 +890,7 @@ int PMPI_Request_free(MPI_Request * request)
   int retval;
 
   smpi_bench_end();
-  if (request == NULL) {
+  if (request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     smpi_mpi_request_free(request);
@@ -903,14 +907,17 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
-  int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+  int src_traced = smpi_group_index(smpi_comm_group(comm), src);
   TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
 #endif
   if (request == NULL) {
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
+  }else if (src == MPI_PROC_NULL) {
+    *request = MPI_REQUEST_NULL;
+    retval = MPI_SUCCESS;
   } else {
     *request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
     retval = MPI_SUCCESS;
@@ -930,26 +937,33 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
   int retval;
 
   smpi_bench_end();
-#ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
-  TRACE_smpi_computing_out(rank);
-  int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
-  TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
-  TRACE_smpi_send(rank, rank, dst_traced);
-#endif
   if (request == NULL) {
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
+  } else if (dst == MPI_PROC_NULL) {
+    *request = MPI_REQUEST_NULL;
+    retval = MPI_SUCCESS;
   } else {
+
+#ifdef HAVE_TRACING
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+  TRACE_smpi_computing_out(rank);
+  int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
+  TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
+  TRACE_smpi_send(rank, rank, dst_traced);
+#endif
+
     *request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
-  }
+
 #ifdef HAVE_TRACING
   TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
   (*request)->send = 1;
   TRACE_smpi_computing_in(rank);
 #endif
+  }
+
   smpi_bench_begin();
   return retval;
 }
@@ -962,26 +976,34 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
   int retval;
 
   smpi_bench_end();
+
+  if (comm == MPI_COMM_NULL) {
+    retval = MPI_ERR_COMM;
+  } else if (src == MPI_PROC_NULL) {
+    smpi_empty_status(status);
+    status->MPI_SOURCE = MPI_PROC_NULL;
+    retval = MPI_SUCCESS;
+  } else {
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
-  int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+  int src_traced = smpi_group_index(smpi_comm_group(comm), src);
   TRACE_smpi_computing_out(rank);
 
   TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
 #endif
-  if (comm == MPI_COMM_NULL) {
-    retval = MPI_ERR_COMM;
-  } else {
+
     smpi_mpi_recv(buf, count, datatype, src, tag, comm, status);
     retval = MPI_SUCCESS;
-  }
+
 #ifdef HAVE_TRACING
   //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
-  if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_rank(smpi_comm_group(comm), status->MPI_SOURCE);
+  if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE);
   TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
   TRACE_smpi_recv(rank, src_traced, rank);
   TRACE_smpi_computing_in(rank);
 #endif
+  }
+
   smpi_bench_begin();
   return retval;
 }
@@ -993,14 +1015,16 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
+  int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
   TRACE_smpi_send(rank, rank, dst_traced);
 #endif
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
+  } else if (dst == MPI_PROC_NULL) {
+    retval = MPI_SUCCESS;
   } else {
     smpi_mpi_send(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -1022,10 +1046,10 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
-  int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
+  int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
+  int src_traced = smpi_group_index(smpi_comm_group(comm), src);
   TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
   TRACE_smpi_send(rank, rank, dst_traced);
   TRACE_smpi_send(rank, src_traced, rank);
@@ -1035,6 +1059,10 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   } else if (sendtype == MPI_DATATYPE_NULL
              || recvtype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
+  } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
+      smpi_empty_status(status);
+      status->MPI_SOURCE = MPI_PROC_NULL;
+      retval = MPI_SUCCESS;
   } else {
     smpi_mpi_sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf,
                       recvcount, recvtype, src, recvtag, comm, status);
@@ -1074,9 +1102,10 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
   int retval;
 
   smpi_bench_end();
-  if (request == NULL || flag == NULL) {
+  if (request == MPI_REQUEST_NULL || flag == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*request == MPI_REQUEST_NULL) {
+    *flag= TRUE;
     retval = MPI_ERR_REQUEST;
   } else {
     *flag = smpi_mpi_test(request, status);
@@ -1122,12 +1151,16 @@ int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
   smpi_bench_end();
 
   if (status == NULL) {
-     retval = MPI_ERR_ARG;
-  }else if (comm == MPI_COMM_NULL) {
-       retval = MPI_ERR_COMM;
+    retval = MPI_ERR_ARG;
+  } else if (comm == MPI_COMM_NULL) {
+    retval = MPI_ERR_COMM;
+  } else if (source == MPI_PROC_NULL) {
+    smpi_empty_status(status);
+    status->MPI_SOURCE = MPI_PROC_NULL;
+    retval = MPI_SUCCESS;
   } else {
-       smpi_mpi_probe(source, tag, comm, status);
-       retval = MPI_SUCCESS;
+    smpi_mpi_probe(source, tag, comm, status);
+    retval = MPI_SUCCESS;
   }
   smpi_bench_begin();
   return retval;
@@ -1139,14 +1172,18 @@ int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* statu
   smpi_bench_end();
 
   if (flag == NULL) {
-       retval = MPI_ERR_ARG;
-    }else if (status == NULL) {
-     retval = MPI_ERR_ARG;
-  }else if (comm == MPI_COMM_NULL) {
-       retval = MPI_ERR_COMM;
+    retval = MPI_ERR_ARG;
+  } else if (status == NULL) {
+    retval = MPI_ERR_ARG;
+  } else if (comm == MPI_COMM_NULL) {
+    retval = MPI_ERR_COMM;
+  } else if (source == MPI_PROC_NULL) {
+    smpi_empty_status(status);
+    status->MPI_SOURCE = MPI_PROC_NULL;
+    retval = MPI_SUCCESS;
   } else {
-       smpi_mpi_iprobe(source, tag, comm, flag, status);
-       retval = MPI_SUCCESS;
+    smpi_mpi_iprobe(source, tag, comm, flag, status);
+    retval = MPI_SUCCESS;
   }
   smpi_bench_begin();
   return retval;
@@ -1157,34 +1194,39 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status)
   int retval;
 
   smpi_bench_end();
+
+  if (request == NULL) {
+    retval = MPI_ERR_ARG;
+  } else if (*request == MPI_REQUEST_NULL) {
+    retval = MPI_ERR_REQUEST;
+  } else {
+
 #ifdef HAVE_TRACING
   int rank = request && (*request)->comm != MPI_COMM_NULL
-      ? smpi_comm_rank((*request)->comm)
+      ? smpi_process_index()
       : -1;
   TRACE_smpi_computing_out(rank);
 
   MPI_Group group = smpi_comm_group((*request)->comm);
-  int src_traced = smpi_group_rank(group, (*request)->src);
-  int dst_traced = smpi_group_rank(group, (*request)->dst);
+  int src_traced = smpi_group_index(group, (*request)->src);
+  int dst_traced = smpi_group_index(group, (*request)->dst);
   int is_wait_for_receive = (*request)->recv;
   TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
 #endif
-  if (request == NULL) {
-    retval = MPI_ERR_ARG;
-  } else if (*request == MPI_REQUEST_NULL) {
-    retval = MPI_ERR_REQUEST;
-  } else {
+
     smpi_mpi_wait(request, status);
     retval = MPI_SUCCESS;
-  }
+
 #ifdef HAVE_TRACING
   TRACE_smpi_ptp_out(rank, src_traced, dst_traced, __FUNCTION__);
   if (is_wait_for_receive) {
     TRACE_smpi_recv(rank, src_traced, dst_traced);
   }
   TRACE_smpi_computing_in(rank);
-
 #endif
+
+  }
+
   smpi_bench_begin();
   return retval;
 }
@@ -1223,7 +1265,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
       xbt_free(t);
     }
   }
-  int rank_traced = smpi_comm_rank(MPI_COMM_WORLD);
+  int rank_traced = smpi_process_index();
   TRACE_smpi_computing_out(rank_traced);
 
   TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
@@ -1266,21 +1308,29 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
   xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
   xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
   for (i = 0; i < count; i++) {
-    MPI_Request req = requests[i];      //all req should be valid in Waitall
-    int *asrc = xbt_new(int, 1);
-    int *adst = xbt_new(int, 1);
-    int *arecv = xbt_new(int, 1);
-    *asrc = req->src;
-    *adst = req->dst;
-    *arecv = req->recv;
-    xbt_dynar_insert_at(srcs, i, asrc);
-    xbt_dynar_insert_at(dsts, i, adst);
-    xbt_dynar_insert_at(recvs, i, arecv);
-    xbt_free(asrc);
-    xbt_free(adst);
-    xbt_free(arecv);
-  }
-  int rank_traced = smpi_comm_rank (MPI_COMM_WORLD);
+    MPI_Request req = requests[i];
+    if(req){
+      int *asrc = xbt_new(int, 1);
+      int *adst = xbt_new(int, 1);
+      int *arecv = xbt_new(int, 1);
+      *asrc = req->src;
+      *adst = req->dst;
+      *arecv = req->recv;
+      xbt_dynar_insert_at(srcs, i, asrc);
+      xbt_dynar_insert_at(dsts, i, adst);
+      xbt_dynar_insert_at(recvs, i, arecv);
+      xbt_free(asrc);
+      xbt_free(adst);
+      xbt_free(arecv);
+    }else {
+      int *t = xbt_new(int, 1);
+      xbt_dynar_insert_at(srcs, i, t);
+      xbt_dynar_insert_at(dsts, i, t);
+      xbt_dynar_insert_at(recvs, i, t);
+      xbt_free(t);
+    }
+  }
+  int rank_traced = smpi_process_index();
   TRACE_smpi_computing_out(rank_traced);
 
   TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
@@ -1323,15 +1373,32 @@ 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 retval;
+
+   smpi_bench_end();
+   if (outcount == NULL || indices == NULL) {
+     retval = MPI_ERR_ARG;
+   } else {
+     *outcount = smpi_mpi_testsome(incount, requests, indices, status);
+     retval = MPI_SUCCESS;
+   }
+   smpi_bench_begin();
+   return retval;
+}
+
+
 int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
 {
   int retval;
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1354,7 +1421,7 @@ int PMPI_Barrier(MPI_Comm comm)
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1380,9 +1447,9 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1411,9 +1478,9 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1444,7 +1511,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1473,7 +1540,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1505,9 +1572,10 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
+
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1536,9 +1604,9 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1568,9 +1636,9 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1596,7 +1664,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1625,7 +1693,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1652,7 +1720,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
 {
   int retval, i, size, count;
   int *displs;
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
@@ -1699,7 +1767,7 @@ int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1744,7 +1812,7 @@ int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -2024,11 +2092,12 @@ int PMPI_Buffer_detach(void* buffer, int* size) {
    return not_yet_implemented();
 }
 
-int PMPI_Testsome(int incount, MPI_Request* requests, int* outcount, int* indices, MPI_Status* statuses) {
+int PMPI_Comm_test_inter(MPI_Comm comm, int* flag) {
    return not_yet_implemented();
 }
 
-int PMPI_Comm_test_inter(MPI_Comm comm, int* flag) {
+int PMPI_Comm_get_attr (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag)
+{
    return not_yet_implemented();
 }
 
index 8c2328f..40856a5 100644 (file)
@@ -170,10 +170,8 @@ void xbt_datadesc_preinit(void)
  **/
 void xbt_datadesc_postexit(void)
 {
-  XBT_VERB("Exiting DataDesc");
   xbt_set_free(&xbt_datadesc_set_local);
   xbt_dict_free(&xbt_dd_constants);
-  XBT_DEBUG("Exited DataDesc");
 }
 
 /** This is mainly to debug */
index 030dd34..1dae308 100644 (file)
@@ -37,7 +37,7 @@ char* _surf_mc_property_file=NULL;
  * This is crude and rather compiler-specific, unfortunately.
  */
 static void xbt_preinit(void) _XBT_GNUC_CONSTRUCTOR(200);
-static void xbt_postexit(void) _XBT_GNUC_DESTRUCTOR(200);
+static void xbt_postexit(void);
 
 #ifdef _XBT_WIN32
 # undef _XBT_NEED_INIT_PRAGMA
@@ -45,7 +45,6 @@ static void xbt_postexit(void) _XBT_GNUC_DESTRUCTOR(200);
 
 #ifdef _XBT_NEED_INIT_PRAGMA
 #pragma init (xbt_preinit)
-#pragma fini (xbt_postexit)
 #endif
 
 #ifdef _XBT_WIN32
@@ -73,7 +72,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
   } else if (fdwReason == DLL_PROCESS_DETACH
       && xbt_dll_process_is_attached == 1) {
     xbt_dll_process_is_attached = 0;
-      xbt_postexit();
   }
   return 1;
 }
@@ -94,6 +92,8 @@ static void xbt_preinit(void)
   xbt_dict_preinit();
   xbt_datadesc_preinit();
   xbt_trp_preinit();
+
+  atexit(xbt_postexit);
 }
 
 static void xbt_postexit(void)
index b9ffa48..452fad6 100644 (file)
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
   MSG_create_environment(argv[1]);
   MSG_launch_application(argv[1]);
   res = MSG_main();
-  MSG_clean();
+
   if (res == MSG_OK)
     return 0;
   else
index 4ed7b37..135509b 100644 (file)
@@ -67,8 +67,6 @@ int main(int argc, char *argv[])
   /* Run the example. */
   res = MSG_main();
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else
index cd2907c..73153ef 100644 (file)
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
 
   res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
-  MSG_clean();
+
   if (res == MSG_OK)
     return 0;
   else
index ae54a73..4f24150 100644 (file)
@@ -33,7 +33,6 @@ int main(int argc, char **argv)
   if (status == 0){
     XBT_INFO ("%s expects --cfg=tracing:1 --cfg=tracing/platform:1", argv[0]);
   }
-  MSG_clean();
 #else
   XBT_INFO ("works only if simgrid was compiled with tracing enabled.");
 #endif