Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 6 Dec 2012 09:57:01 +0000 (10:57 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 6 Dec 2012 09:57:01 +0000 (10:57 +0100)
20 files changed:
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
examples/msg/mc/chord/chord_neverjoin.tesh
examples/msg/mc/test/snapshot_comparison1.c
examples/msg/mc/test/snapshot_comparison1.tesh
examples/msg/mc/test/snapshot_comparison2.c
examples/msg/mc/test/snapshot_comparison2.tesh
examples/msg/mc/test/snapshot_comparison3.c
examples/msg/mc/test/snapshot_comparison3.tesh
examples/msg/mc/test/snapshot_comparison4.c
examples/msg/mc/test/snapshot_comparison4.tesh
examples/msg/mc/test/snapshot_comparison5.c
examples/msg/mc/test/snapshot_comparison5.tesh
src/mc/mc_compare.c
src/mc/mc_global.c
src/smpi/private.h
src/smpi/smpi_base.c
src/surf/surf_routing.c
src/surf/surf_routing_generic.c
teshsuite/smpi/mpich-test/pt2pt/runtests

index 72a4ce7..ab0ca12 100644 (file)
@@ -386,13 +386,15 @@ if(NOT enable_memcheck)
       ADD_TEST(mc-bugged1-ucontext              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1.tesh)
       ADD_TEST(mc-bugged2-ucontext              ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged2.tesh)
       ADD_TEST(mc-centralized-ucontext          ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc centralized.tesh)
-      ADD_TEST(mc-bugged1-liveness-ucontext     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness.tesh)
-      ADD_TEST(mc-chord-neverjoin-ucontext      ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/chord chord_neverjoin.tesh)
-      ADD_TEST(mc-test-snapshot-comparison1     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison1.tesh)
-      ADD_TEST(mc-test-snapshot-comparison2     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison2.tesh)
-      ADD_TEST(mc-test-snapshot-comparison3     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison3.tesh)
-      ADD_TEST(mc-test-snapshot-comparison4     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison4.tesh)
-      ADD_TEST(mc-test-snapshot-comparison5     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison5.tesh)
+      if(PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...)
+        ADD_TEST(mc-bugged1-liveness-ucontext     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness.tesh)
+        ADD_TEST(mc-chord-neverjoin-ucontext      ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/chord chord_neverjoin.tesh)
+        ADD_TEST(mc-test-snapshot-comparison1     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison1.tesh)
+        ADD_TEST(mc-test-snapshot-comparison2     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison2.tesh)
+        ADD_TEST(mc-test-snapshot-comparison3     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison3.tesh)
+        ADD_TEST(mc-test-snapshot-comparison4     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison4.tesh)
+        ADD_TEST(mc-test-snapshot-comparison5     ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc/test --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/test snapshot_comparison5.tesh)
+      endif()
     endif()
     if(HAVE_RAWCTX)
       ADD_TEST(mc-bugged1-raw                   ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:raw --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1.tesh)
index f41f069..0331064 100644 (file)
@@ -83,6 +83,9 @@ set(EXTRA_DIST
   src/xbt/mmalloc/mmtrace.awk
   src/xbt/mmalloc/mrealloc.c
   src/xbt/setset_private.h
+  src/win32/config.h
+  src/xbt/win32_ucontext.c
+  include/xbt/win32_ucontext.h
   tools/tesh/run_context.h
   tools/tesh/tesh.h
   )
index 5e64854..532811d 100644 (file)
@@ -1,7 +1,7 @@
 #! ./tesh
 
 ! expect signal SIGABRT
-! timeout 120
+! timeout 200
 $ ${bindir:=.}/chord_liveness --cfg=model-check:1 --cfg=contexts/factory:ucontext "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) type in variable = 2
index 982b146..126c590 100644 (file)
@@ -35,7 +35,7 @@ int test(int argc, char **argv){
   
   XBT_INFO("**** End test ****");
 
-  return 0;
+  xbt_abort();
 }
 
 int main(int argc, char **argv){
index 8e2dc36..eafc8c6 100644 (file)
@@ -2,25 +2,13 @@
 
 ! expect signal SIGABRT
 ! timeout 200
-$ ${bindir:=.}/snapshot_comparison1 --cfg=model-check:1 --cfg=contexts/factory:ucontext "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/snapshot_comparison1 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) type in variable = 2
 > [  0.000000] (0:@) Check the liveness property promela
-> [  1.000000] (1:test@HostA) **** Start test ****
-> [  1.000000] (1:test@HostA) Take two successive snapshots (No modification)
-> [  1.000000] (1:test@HostA) First snapshot
-> [  3.000000] (1:test@HostA) Second snapshot
-> [  3.000000] (1:test@HostA) Test result : 0 (0 = state equality, 1 = different states)
-> [  3.000000] (1:test@HostA) **** End test ****
-> [  0.000000] (0:@) Next pair (depth = 5) already reached !
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) |             ACCEPTANCE CYCLE            |
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) Counter-example that violates formula :
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_COMPARE_SNAPSHOTS ((null))
-> [  0.000000] (0:@) End of system requests but evolution in Büchi automaton
-> [  0.000000] (0:@) Expanded pairs = 5
-> [  0.000000] (0:@) Visited pairs = 4
-> [  0.000000] (0:@) Expanded / Visited = 0.800000
+> [  0.000000] (1:test@HostA) **** Start test ****
+> [  0.000000] (1:test@HostA) Take two successive snapshots (No modification)
+> [  0.000000] (1:test@HostA) First snapshot
+> [  0.000000] (1:test@HostA) Second snapshot
+> [  0.000000] (1:test@HostA) Test result : 0 (0 = state equality, 1 = different states)
+> [  0.000000] (1:test@HostA) **** End test ****
index e3b04b0..9c08973 100644 (file)
@@ -40,7 +40,7 @@ int test(int argc, char **argv){
 
   xbt_free(toto);
 
-  return 0;
+  xbt_abort();
 }
 
 int main(int argc, char **argv){
index 8e3798c..c383fd2 100644 (file)
@@ -6,22 +6,10 @@ $ ${bindir:=.}/snapshot_comparison2 --cfg=model-check:1 "--log=root.fmt:[%10.6r]
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) type in variable = 2
 > [  0.000000] (0:@) Check the liveness property promela
-> [  1.000000] (1:test@HostA) **** Start test ****
-> [  1.000000] (1:test@HostA) Malloc after first snapshot
-> [  2.000000] (1:test@HostA) First snapshot
-> [  2.000000] (1:test@HostA) Toto allocated
-> [  3.000000] (1:test@HostA) Second snapshot
-> [  3.000000] (1:test@HostA) Test result : 1 (0 = state equality, 1 = different states)
-> [  3.000000] (1:test@HostA) **** End test ****
-> [  0.000000] (0:@) Next pair (depth = 5) already reached !
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) |             ACCEPTANCE CYCLE            |
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) Counter-example that violates formula :
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_COMPARE_SNAPSHOTS ((null))
-> [  0.000000] (0:@) End of system requests but evolution in Büchi automaton
-> [  0.000000] (0:@) Expanded pairs = 5
-> [  0.000000] (0:@) Visited pairs = 4
-> [  0.000000] (0:@) Expanded / Visited = 0.800000
+> [  0.000000] (1:test@HostA) **** Start test ****
+> [  0.000000] (1:test@HostA) Malloc after first snapshot
+> [  0.000000] (1:test@HostA) First snapshot
+> [  0.000000] (1:test@HostA) Toto allocated
+> [  0.000000] (1:test@HostA) Second snapshot
+> [  0.000000] (1:test@HostA) Test result : 1 (0 = state equality, 1 = different states)
+> [  0.000000] (1:test@HostA) **** End test ****
index 8c3efd3..e46578f 100644 (file)
@@ -46,7 +46,7 @@ int test(int argc, char **argv){
   
   XBT_INFO("**** End test ****");
 
-  return 0;
+  xbt_abort();
 }
 
 int main(int argc, char **argv){
index 37a7635..806106b 100644 (file)
@@ -6,23 +6,11 @@ $ ${bindir:=.}/snapshot_comparison3 --cfg=model-check:1 "--log=root.fmt:[%10.6r]
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) type in variable = 2
 > [  0.000000] (0:@) Check the liveness property promela
-> [  1.000000] (1:test@HostA) **** Start test ****
-> [  1.000000] (1:test@HostA) Malloc and free after first snapshot
-> [  2.000000] (1:test@HostA) First snapshot
-> [  2.000000] (1:test@HostA) Toto allocated
-> [  2.000000] (1:test@HostA) Toto free
-> [  3.000000] (1:test@HostA) Second snapshot
-> [  3.000000] (1:test@HostA) Test result : 0 (0 = state equality, 1 = different states)
-> [  3.000000] (1:test@HostA) **** End test ****
-> [  0.000000] (0:@) Next pair (depth = 5) already reached !
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) |             ACCEPTANCE CYCLE            |
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) Counter-example that violates formula :
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_COMPARE_SNAPSHOTS ((null))
-> [  0.000000] (0:@) End of system requests but evolution in Büchi automaton
-> [  0.000000] (0:@) Expanded pairs = 5
-> [  0.000000] (0:@) Visited pairs = 4
-> [  0.000000] (0:@) Expanded / Visited = 0.800000
+> [  0.000000] (1:test@HostA) **** Start test ****
+> [  0.000000] (1:test@HostA) Malloc and free after first snapshot
+> [  0.000000] (1:test@HostA) First snapshot
+> [  0.000000] (1:test@HostA) Toto allocated
+> [  0.000000] (1:test@HostA) Toto free
+> [  0.000000] (1:test@HostA) Second snapshot
+> [  0.000000] (1:test@HostA) Test result : 0 (0 = state equality, 1 = different states)
+> [  0.000000] (1:test@HostA) **** End test ****
index e87c65c..bff95bf 100644 (file)
@@ -44,7 +44,7 @@ int test(int argc, char **argv){
   
   XBT_INFO("**** End test ****");
 
-  return 0;
+  xbt_abort();
 }
 
 int main(int argc, char **argv){
index ba6fec7..05db501 100644 (file)
@@ -6,23 +6,11 @@ $ ${bindir:=.}/snapshot_comparison4 --cfg=model-check:1 "--log=root.fmt:[%10.6r]
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) type in variable = 2
 > [  0.000000] (0:@) Check the liveness property promela
-> [  1.000000] (1:test@HostA) **** Start test ****
-> [  1.000000] (1:test@HostA) Free after first snapshot
-> [  1.000000] (1:test@HostA) Toto allocated
-> [  2.000000] (1:test@HostA) First snapshot
-> [  2.000000] (1:test@HostA) Toto free
-> [  2.000000] (1:test@HostA) Second snapshot
-> [  3.000000] (1:test@HostA) Test result : 1 (0 = state equality, 1 = different states)
-> [  3.000000] (1:test@HostA) **** End test ****
-> [  0.000000] (0:@) Next pair (depth = 5) already reached !
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) |             ACCEPTANCE CYCLE            |
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) Counter-example that violates formula :
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_COMPARE_SNAPSHOTS ((null))
-> [  0.000000] (0:@) End of system requests but evolution in Büchi automaton
-> [  0.000000] (0:@) Expanded pairs = 5
-> [  0.000000] (0:@) Visited pairs = 4
-> [  0.000000] (0:@) Expanded / Visited = 0.800000
\ No newline at end of file
+> [  0.000000] (1:test@HostA) **** Start test ****
+> [  0.000000] (1:test@HostA) Free after first snapshot
+> [  0.000000] (1:test@HostA) Toto allocated
+> [  0.000000] (1:test@HostA) First snapshot
+> [  0.000000] (1:test@HostA) Toto free
+> [  0.000000] (1:test@HostA) Second snapshot
+> [  0.000000] (1:test@HostA) Test result : 1 (0 = state equality, 1 = different states)
+> [  0.000000] (1:test@HostA) **** End test ****
\ No newline at end of file
index eef83c8..3078854 100644 (file)
@@ -44,7 +44,7 @@ int test(int argc, char **argv){
   
   XBT_INFO("**** End test ****");
 
-  return 0;
+  xbt_abort();
 }
 
 int main(int argc, char **argv){
index 010ab35..bfed346 100644 (file)
@@ -6,23 +6,11 @@ $ ${bindir:=.}/snapshot_comparison5 --cfg=model-check:1 "--log=root.fmt:[%10.6r]
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) type in variable = 2
 > [  0.000000] (0:@) Check the liveness property promela
-> [  1.000000] (1:test@HostA) **** Start test ****
-> [  1.000000] (1:test@HostA) Increment local variable
-> [  1.000000] (1:test@HostA) j = 0
-> [  2.000000] (1:test@HostA) First snapshot
-> [  2.000000] (1:test@HostA) j = 1
-> [  3.000000] (1:test@HostA) Second snapshot
-> [  3.000000] (1:test@HostA) Test result : 1 (0 = state equality, 1 = different states)
-> [  3.000000] (1:test@HostA) **** End test ****
-> [  0.000000] (0:@) Next pair (depth = 5) already reached !
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) |             ACCEPTANCE CYCLE            |
-> [  0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-> [  0.000000] (0:@) Counter-example that violates formula :
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_SNAPSHOT ((null))
-> [  0.000000] (0:@) [(1)test] MC_COMPARE_SNAPSHOTS ((null))
-> [  0.000000] (0:@) End of system requests but evolution in Büchi automaton
-> [  0.000000] (0:@) Expanded pairs = 5
-> [  0.000000] (0:@) Visited pairs = 4
-> [  0.000000] (0:@) Expanded / Visited = 0.800000
+> [  0.000000] (1:test@HostA) **** Start test ****
+> [  0.000000] (1:test@HostA) Increment local variable
+> [  0.000000] (1:test@HostA) j = 0
+> [  0.000000] (1:test@HostA) First snapshot
+> [  0.000000] (1:test@HostA) j = 1
+> [  0.000000] (1:test@HostA) Second snapshot
+> [  0.000000] (1:test@HostA) Test result : 1 (0 = state equality, 1 = different states)
+> [  0.000000] (1:test@HostA) **** End test ****
index 2174d45..e27511e 100644 (file)
@@ -67,7 +67,7 @@ static int compare_global_variables(int region_type, void *d1, void *d2){
             continue;
           }else{
             if(XBT_LOG_ISENABLED(mc_compare, xbt_log_priority_verbose)){
-              XBT_VERB("Different global variable in libsimgrid : %s", current_var->name);
+              XBT_VERB("Different global variable in libsimgrid : %s at addresses %p - %p (size = %zu)", current_var->name, (char *)d1+offset, (char *)d2+offset, current_var->size);
             }
             return 1;
           }
index ffca4fe..25de83a 100644 (file)
@@ -1718,6 +1718,7 @@ static void MC_get_global_variables(char *elf_file){
        || (strcmp(xbt_dynar_get_as(line_tokens, xbt_dynar_length(line_tokens) - 1, char*), ".data") == 0)
        || (strcmp(xbt_dynar_get_as(line_tokens, xbt_dynar_length(line_tokens) - 1, char*), ".bss") == 0)
        || (strncmp(xbt_dynar_get_as(line_tokens, xbt_dynar_length(line_tokens) - 1, char*), "stderr", 6) == 0)
+       || (strncmp(xbt_dynar_get_as(line_tokens, xbt_dynar_length(line_tokens) - 1, char*), "counter", 7) == 0)
        || ((size_t)strtoul(xbt_dynar_get_as(line_tokens, xbt_dynar_length(line_tokens) - 2, char*), NULL, 16) == 0))
       continue;
 
index 2a59ec5..2f0d57d 100644 (file)
@@ -58,6 +58,12 @@ typedef struct s_smpi_mpi_request {
   int src;
   int dst;
   int tag;
+  //to handle cases where we have an unknown sender
+  //We can't override src, tag, and size, because the request may be reused later
+  int real_src;
+  int real_tag;
+  int truncated;
+  size_t real_size;
   MPI_Comm comm;
   smx_action_t action;
   unsigned flags;
index 0345cbb..a016c1d 100644 (file)
@@ -23,8 +23,16 @@ static int match_recv(void* a, void* b, smx_action_t ignored) {
 
   xbt_assert(ref, "Cannot match recv against null reference");
   xbt_assert(req, "Cannot match recv against null request");
-  return (ref->src == MPI_ANY_SOURCE || req->src == ref->src)
-    && (ref->tag == MPI_ANY_TAG || req->tag == ref->tag);
+  if((ref->src == MPI_ANY_SOURCE || req->src == ref->src)
+    && (ref->tag == MPI_ANY_TAG || req->tag == ref->tag)){
+    //we match, we can transfer some values
+    // FIXME : move this to the copy function ?
+    if(ref->src == MPI_ANY_SOURCE)ref->real_src = req->src;
+    if(ref->tag == MPI_ANY_TAG)ref->real_tag = req->tag;
+    if(ref->real_size < req->real_size) ref->truncated = 1;
+    else ref->truncated = 0;
+    return 1;
+  }else return 0;
 }
 
 static int match_send(void* a, void* b,smx_action_t ignored) {
@@ -33,8 +41,16 @@ static int match_send(void* a, void* b,smx_action_t ignored) {
    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);
+
+   if((req->src == MPI_ANY_SOURCE || req->src == ref->src)
+             && (req->tag == MPI_ANY_TAG || req->tag == ref->tag))
+   {
+     if(req->src == MPI_ANY_SOURCE)req->real_src = ref->src;
+     if(req->tag == MPI_ANY_TAG)req->real_tag = ref->tag;
+     if(req->real_size < ref->real_size) req->truncated = 1;
+     else ref->truncated = 0;
+     return 1;
+   } else return 0;
 }
 
 static MPI_Request build_request(void *buf, int count,
@@ -156,9 +172,10 @@ void smpi_mpi_start(MPI_Request request)
       mailbox = smpi_process_mailbox_small();
     else
       mailbox = smpi_process_mailbox();
-
-    // FIXME: SIMIX does not yet support non-contiguous datatypes
-    request->action = simcall_comm_irecv(mailbox, request->buf, &request->size, &match_recv, request);
+    // 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;
+    request->action = simcall_comm_irecv(mailbox, request->buf, &request->real_size, &match_recv, request);
+    if (request->action)request->action->comm.refcount++;
   } else {
 
     int receiver = smpi_group_index(smpi_comm_group(request->comm), request->dst);
@@ -185,15 +202,18 @@ void smpi_mpi_start(MPI_Request request)
       }
       XBT_DEBUG("Send request %p is detached; buf %p copied into %p",request,oldbuf,request->buf);
     }
+    // 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;
 
     request->action =
       simcall_comm_isend(mailbox, request->size, -1.0,
-                         request->buf, request->size,
+                         request->buf, request->real_size,
                          &match_send,
                          &smpi_mpi_request_free_voidp, // how to free the userdata if a detached send fails
                          request,
                          // detach if msg size < eager/rdv switch limit
                          request->detached);
+    if (request->action)request->action->comm.refcount++;
 
 #ifdef HAVE_TRACING
     /* FIXME: detached sends are not traceable (request->action == NULL) */
@@ -309,33 +329,29 @@ int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype)
 static void finish_wait(MPI_Request * request, MPI_Status * status)
 {
   MPI_Request req = *request;
-  // if we have a sender, we should use its data, and not the data from the receive
-  //FIXME : mail fail if req->action has already been freed, the pointer being invalid
-  if((req->action)&&
-     (req->src==MPI_ANY_SOURCE || req->tag== MPI_ANY_TAG))
-    req = (MPI_Request)SIMIX_comm_get_src_data((*request)->action);
 
   if(status != MPI_STATUS_IGNORE) {
-    status->MPI_SOURCE = req->src;
-    status->MPI_TAG = req->tag;
-    //if((*request)->action && ((MPI_Request)SIMIX_comm_get_src_data((*request)->action))->size == (*request)->size)
-    status->MPI_ERROR = MPI_SUCCESS;
-    //else status->MPI_ERROR = MPI_ERR_TRUNCATE;
+    status->MPI_SOURCE = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
+    status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
+    if(req->truncated)
+    status->MPI_ERROR = MPI_ERR_TRUNCATE;
+    else status->MPI_ERROR = 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?
-    status->count = req->size;
+    status->count = req->real_size;
   }
   req = *request;
 
   print_request("Finishing", req);
   MPI_Datatype datatype = req->old_type;
+
   if(datatype->has_subtype == 1){
       // This part handles the problem of non-contignous memory
       // the unserialization at the reception
     s_smpi_subtype_t *subtype = datatype->substruct;
     if(req->flags & RECV) {
-      subtype->unserialize(req->buf, req->old_buf, req->size/smpi_datatype_size(datatype) , datatype->substruct);
+      subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) , datatype->substruct);
     }
     if(req->detached == 0) free(req->buf);
   }
@@ -343,7 +359,8 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
 
 
   if(req->flags & NON_PERSISTENT) {
-    if(req->action &&
+    if(req->flags & RECV &&
+       req->action &&
       (req->action->state == SIMIX_DONE))
     {
       MPI_Request sender_request = (MPI_Request)SIMIX_comm_get_src_data(req->action);
@@ -358,8 +375,28 @@ static void finish_wait(MPI_Request * request, MPI_Status * status)
         smpi_mpi_request_free(&sender_request);
       }
     }
+
+
+    if(req->action){
+      //if we want to free our request, we have to invalidate it at the other end of the comm
+      if(req->flags & SEND){
+        req->action->comm.src_data=MPI_REQUEST_NULL;
+      }else{
+        req->action->comm.dst_data=MPI_REQUEST_NULL;
+      }
+
+      smx_action_t temp=req->action;
+      if(req->action->comm.refcount == 1)req->action = NULL;
+      SIMIX_comm_destroy(temp);
+    }
+
+
+
     smpi_mpi_request_free(request);
+
+
   } else {
+    if(req->action)SIMIX_comm_destroy(req->action);
     req->action = NULL;
   }
 }
@@ -483,7 +520,7 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
       status->MPI_SOURCE = req->src;
       status->MPI_TAG = req->tag;
       status->MPI_ERROR = MPI_SUCCESS;
-      status->count = req->size;
+      status->count = req->real_size;
     }
   }
   else *flag = 0;
index b6bb950..eb7ac33 100644 (file)
@@ -10,8 +10,6 @@
 #include "surf/surf_routing.h"
 #include "surf/surfxml_parse_values.h"
 
-#include <pcre.h>               /* regular expression library */
-
 /**
  * @ingroup SURF_build_api
  * @brief A library containing all known workstations
index 6f6d587..177c092 100644 (file)
@@ -10,8 +10,6 @@
 #include "surf/surf_routing.h"
 #include "surf/surfxml_parse_values.h"
 
-#include <pcre.h>               /* regular expression library */
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
 static int no_bypassroute_declared = 1;
index f9b9ff2..f831471 100755 (executable)
@@ -264,8 +264,8 @@ RunTest exittest 3 "**** Checking Exit Processing ****"
 
 #uses MPI_Errors
 #RunTest trunc 2 "*** Testing Message truncation ***"
-#TODO: handle MPI_ERR_IN_STATUS
-#RunTest truncmult 2 '*** Testing Message trunction in multiple completions ***'
+
+RunTest truncmult 2 '*** Testing Message trunction in multiple completions ***'
 
 RunTest nullproc 2 "*** Testing handling of MPI_PROC_NULL ***"