Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authormlaurent <mathieu.laurent@ens-rennes.fr>
Wed, 7 Jun 2023 10:46:36 +0000 (12:46 +0200)
committermlaurent <mathieu.laurent@ens-rennes.fr>
Wed, 7 Jun 2023 10:46:36 +0000 (12:46 +0200)
31 files changed:
MANIFEST.in
examples/cpp/mc-bugged1/s4u-mc-bugged1.tesh
examples/cpp/mc-bugged2/s4u-mc-bugged2.tesh
examples/cpp/mc-electric-fence/s4u-mc-electric-fence.tesh
examples/cpp/mc-failing-assert/s4u-mc-failing-assert-nodpor.tesh
examples/cpp/mc-failing-assert/s4u-mc-failing-assert.tesh
examples/cpp/synchro-barrier/s4u-mc-synchro-barrier.tesh
examples/cpp/synchro-mutex/s4u-mc-synchro-mutex-stateful.tesh
examples/cpp/synchro-mutex/s4u-mc-synchro-mutex.tesh
examples/cpp/synchro-semaphore/s4u-mc-synchro-semaphore.tesh
examples/smpi/mc/only_send_deterministic.tesh
examples/smpi/mc/sendsend.tesh
examples/sthread/pthread-mc-mutex-simple.tesh
examples/sthread/pthread-mc-mutex-simpledeadlock.tesh
examples/sthread/pthread-mc-producer-consumer.tesh
examples/sthread/stdobject/stdobject.tesh
src/mc/api/State.cpp
src/mc/api/strategy/BasicStrategy.hpp
src/mc/api/strategy/MaxMatchComm.hpp [new file with mode: 0644]
src/mc/api/strategy/MinMatchComm.hpp [new file with mode: 0644]
src/mc/api/strategy/Strategy.hpp
src/mc/api/strategy/UniformStrategy.hpp [new file with mode: 0644]
src/mc/api/strategy/WaitStrategy.hpp [deleted file]
src/mc/explo/DFSExplorer.cpp
src/mc/mc_config.cpp
src/mc/mc_config.hpp
src/mc/transition/TransitionAny.cpp
src/mc/transition/TransitionAny.hpp
teshsuite/mc/random-bug/random-bug.tesh
teshsuite/smpi/coll-allreduce-with-leaks/mc-coll-allreduce-with-leaks.tesh
tools/cmake/DefinePackages.cmake

index 5fac1c7..0caa0f9 100644 (file)
@@ -2192,8 +2192,10 @@ include src/mc/api/RemoteApp.hpp
 include src/mc/api/State.cpp
 include src/mc/api/State.hpp
 include src/mc/api/strategy/BasicStrategy.hpp
+include src/mc/api/strategy/MaxMatchComm.hpp
+include src/mc/api/strategy/MinMatchComm.hpp
 include src/mc/api/strategy/Strategy.hpp
-include src/mc/api/strategy/WaitStrategy.hpp
+include src/mc/api/strategy/UniformStrategy.hpp
 include src/mc/compare.cpp
 include src/mc/datatypes.h
 include src/mc/explo/CommunicationDeterminismChecker.cpp
index 27b2bc5..c04f3f2 100644 (file)
@@ -9,40 +9,56 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (2:client@HostB) Sent!
-> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (1:server@HostA) OK
+> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (2:client@HostB) Sent!
 > [  0.000000] (1:server@HostA) OK
-> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (4:client@HostD) Sent!
+> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (2:client@HostB) Sent!
-> [  0.000000] (1:server@HostA) OK
 > [  0.000000] (3:client@HostC) Sent!
+> [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (2:client@HostB) Sent!
+> [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (1:server@HostA) OK
+> [  0.000000] (3:client@HostC) Sent!
+> [  0.000000] (2:client@HostB) Sent!
 > [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (3:client@HostC) Sent!
+> [  0.000000] (1:server@HostA) OK
 > [  0.000000] (2:client@HostB) Sent!
+> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
-> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (2:client@HostB) Sent!
 > [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
+> [  0.000000] (2:client@HostB) Sent!
+> [  0.000000] (1:server@HostA) OK
 > [  0.000000] (3:client@HostC) Sent!
+> [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (2:client@HostB) Sent!
 > [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
+> [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (2:client@HostB) Sent!
 > [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
+> [  0.000000] (2:client@HostB) Sent!
+> [  0.000000] (4:client@HostD) Sent!
+> [  0.000000] (1:server@HostA) OK
+> [  0.000000] (3:client@HostC) Sent!
+> [  0.000000] (2:client@HostB) Sent!
+> [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (3:client@HostC) Sent!
 > [  0.000000] (1:server@HostA) OK
 > [  0.000000] (2:client@HostB) Sent!
+> [  0.000000] (3:client@HostC) Sent!
+> [  0.000000] (1:server@HostA) OK
 > [  0.000000] (4:client@HostD) Sent!
 > [  0.000000] (2:client@HostB) Sent!
 > [  0.000000] (0:maestro@) **************************
@@ -60,4 +76,4 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [  0.000000] (0:maestro@)   3: iSend(mbox=0)
 > [  0.000000] (0:maestro@)   1: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;2;1;1;2;4;1;1;3;1'
-> [  0.000000] (0:maestro@) DFS exploration ended. 58 unique states visited; 10 backtracks (140 transition replays, 72 states visited overall)
+> [  0.000000] (0:maestro@) DFS exploration ended. 59 unique states visited; 14 backtracks (119 transition replays, 192 states visited overall)
\ No newline at end of file
index 56813fd..b113f49 100644 (file)
@@ -16,11 +16,11 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;1;3;3;1'
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 1070 unique states visited; 252 backtracks (4082 transition replays, 2760 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 2379 unique states visited; 652 backtracks (7258 transition replays, 10289 states visited overall)
 
 ! expect return 1
 ! timeout 20
-$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:nb_wait ${bindir:=.}/s4u-mc-bugged2 ${platfdir:=.}/model_checker_platform.xml  --log=root.thresh:critical --log=mc.thresh:info
+$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:min_match_comm ${bindir:=.}/s4u-mc-bugged2 ${platfdir:=.}/model_checker_platform.xml  --log=root.thresh:critical --log=mc.thresh:info
 > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
 > [0.000000] [mc_explo/INFO] **************************
 > [0.000000] [mc_explo/INFO] *** PROPERTY NOT VALID ***
@@ -28,11 +28,29 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [0.000000] [mc_explo/INFO] Counter-example execution trace:
 > [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
 > [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
+> [0.000000] [mc_explo/INFO]   3: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
+> [0.000000] [mc_explo/INFO]   2: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
+> [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;3;3;2;1;1;1'
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 662 unique states visited; 144 backtracks (1540 transition replays, 2346 states visited overall)
+
+! expect return 1
+! timeout 20
+$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:max_match_comm ${bindir:=.}/s4u-mc-bugged2 ${platfdir:=.}/model_checker_platform.xml  --log=root.thresh:critical --log=mc.thresh:info
+> [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
+> [0.000000] [mc_explo/INFO] **************************
+> [0.000000] [mc_explo/INFO] *** PROPERTY NOT VALID ***
+> [0.000000] [mc_explo/INFO] **************************
+> [0.000000] [mc_explo/INFO] Counter-example execution trace:
+> [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
+> [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
+> [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   3: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
 > [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
-> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;1;3;3;1'
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 995 unique states visited; 253 backtracks (4006 transition replays, 2758 states visited overall)
-
+> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;3;1;3;1'
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 64 unique states visited; 5 backtracks (23 transition replays, 92 states visited overall)
\ No newline at end of file
index c00a977..6e3c2f0 100644 (file)
@@ -8,11 +8,14 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
+> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
+> [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
+> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
+> [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
@@ -23,32 +26,32 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
+> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
-> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
+> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
+> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
+> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
-> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
+> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
+> [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
@@ -56,37 +59,34 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
-> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
-> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
+> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
-> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
+> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
+> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
-> [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
-> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
+> [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostC:client:(3) 0.000000] [electric_fence/INFO] Sent!
 > [HostA:server:(1) 0.000000] [electric_fence/INFO] OK
 > [HostB:client:(2) 0.000000] [electric_fence/INFO] Sent!
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 169 unique states visited; 28 backtracks (261 transition replays, 64 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 169 unique states visited; 28 backtracks (64 transition replays, 261 states visited overall)
index 4e4777a..7c418cf 100644 (file)
@@ -9,20 +9,41 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [0.000000] [mc_explo/INFO] *** PROPERTY NOT VALID ***
 > [0.000000] [mc_explo/INFO] **************************
 > [0.000000] [mc_explo/INFO] Counter-example execution trace:
+> [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
 > [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
+> [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
+> [0.000000] [mc_explo/INFO]   2: iSend(mbox=0)
+> [0.000000] [mc_explo/INFO]   1: WaitComm(from 2 to 1, mbox=0, no timeout)
+> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;1;2;1'
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 119 unique states visited; 36 backtracks (175 transition replays, 330 states visited overall)
+
+! expect return 1
+! timeout 300
+$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/reduction:none --cfg=model-check/strategy:max_match_comm -- ${bindir:=.}/s4u-mc-failing-assert ${platfdir}/small_platform.xml --log=root.thresh:critical
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/reduction' to 'none'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/strategy' to 'max_match_comm'
+> [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: none.
+> [0.000000] [mc_explo/INFO] **************************
+> [0.000000] [mc_explo/INFO] *** PROPERTY NOT VALID ***
+> [0.000000] [mc_explo/INFO] **************************
+> [0.000000] [mc_explo/INFO] Counter-example execution trace:
+> [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
+> [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [0.000000] [mc_explo/INFO]   3: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
 > [0.000000] [mc_explo/INFO]   2: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 2 to 1, mbox=0, no timeout)
-> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'3;1;1;1;2;1'
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 162 unique states visited; 48 backtracks (438 transition replays, 228 states visited overall)
+> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;3;1;2;1'
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 14 unique states visited; 1 backtracks (1 transition replays, 16 states visited overall)
+
 
 ! expect return 1
 ! timeout 300
-$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/reduction:none --cfg=model-check/strategy:nb_wait -- ${bindir:=.}/s4u-mc-failing-assert ${platfdir}/small_platform.xml --log=root.thresh:critical
+$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/reduction:none --cfg=model-check/strategy:min_match_comm -- ${bindir:=.}/s4u-mc-failing-assert ${platfdir}/small_platform.xml --log=root.thresh:critical
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/reduction' to 'none'
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/strategy' to 'nb_wait'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/strategy' to 'min_match_comm'
 > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: none.
 > [0.000000] [mc_explo/INFO] **************************
 > [0.000000] [mc_explo/INFO] *** PROPERTY NOT VALID ***
@@ -31,10 +52,9 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [0.000000] [mc_explo/INFO]   3: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   2: iSend(mbox=0)
 > [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
-> [0.000000] [mc_explo/INFO]   3: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [0.000000] [mc_explo/INFO]   3: WaitComm(from 3 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   1: iRecv(mbox=0)
-> [0.000000] [mc_explo/INFO]   2: WaitComm(from 2 to 1, mbox=0, no timeout)
 > [0.000000] [mc_explo/INFO]   1: WaitComm(from 2 to 1, mbox=0, no timeout)
-> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'3;2;1;3;1;1;2;1'
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 8 unique states visited; 0 backtracks (8 transition replays, 0 states visited overall)
+> [0.000000] [mc_explo/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'3;2;1;1;3;1;1'
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 23 unique states visited; 2 backtracks (0 transition replays, 25 states visited overall)
\ No newline at end of file
index 36b3ec1..3eda998 100644 (file)
@@ -7,6 +7,16 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [  0.000000] (2:client1@Bourassa) Sent!
 > [  0.000000] (1:server@Boivin) OK
 > [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (1:server@Boivin) OK
+> [  0.000000] (2:client1@Bourassa) Sent!
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (1:server@Boivin) OK
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (2:client1@Bourassa) Sent!
+> [  0.000000] (2:client1@Bourassa) Sent!
+> [  0.000000] (1:server@Boivin) OK
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (2:client1@Bourassa) Sent!
 > [  0.000000] (0:maestro@) **************************
 > [  0.000000] (0:maestro@) *** PROPERTY NOT VALID ***
 > [  0.000000] (0:maestro@) **************************
@@ -18,4 +28,48 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [  0.000000] (0:maestro@)   2: iSend(mbox=0)
 > [  0.000000] (0:maestro@)   1: WaitComm(from 2 to 1, mbox=0, no timeout)
 > [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;1;2;1'
-> [  0.000000] (0:maestro@) DFS exploration ended. 13 unique states visited; 1 backtracks (15 transition replays, 1 states visited overall)
\ No newline at end of file
+> [  0.000000] (0:maestro@) DFS exploration ended. 26 unique states visited; 6 backtracks (21 transition replays, 53 states visited overall)
+
+! expect return 1
+! timeout 20
+$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:min_match_comm ${bindir:=.}/s4u-mc-failing-assert ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" --log=xbt_cfg.thresh:warning
+> [  0.000000] (0:maestro@) Start a DFS exploration. Reduction is: dpor.
+> [  0.000000] (2:client1@Bourassa) Sent!
+> [  0.000000] (1:server@Boivin) OK
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (0:maestro@) **************************
+> [  0.000000] (0:maestro@) *** PROPERTY NOT VALID ***
+> [  0.000000] (0:maestro@) **************************
+> [  0.000000] (0:maestro@) Counter-example execution trace:
+> [  0.000000] (0:maestro@)   1: iRecv(mbox=0)
+> [  0.000000] (0:maestro@)   3: iSend(mbox=0)
+> [  0.000000] (0:maestro@)   2: iSend(mbox=0)
+> [  0.000000] (0:maestro@)   1: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [  0.000000] (0:maestro@)   3: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [  0.000000] (0:maestro@)   1: iRecv(mbox=0)
+> [  0.000000] (0:maestro@)   1: WaitComm(from 2 to 1, mbox=0, no timeout)
+> [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;2;1;3;1;1'
+> [  0.000000] (0:maestro@) DFS exploration ended. 18 unique states visited; 3 backtracks (1 transition replays, 22 states visited overall)
+
+! expect return 1
+! timeout 20
+$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:max_match_comm ${bindir:=.}/s4u-mc-failing-assert ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" --log=xbt_cfg.thresh:warning
+> [  0.000000] (0:maestro@) Start a DFS exploration. Reduction is: dpor.
+> [  0.000000] (2:client1@Bourassa) Sent!
+> [  0.000000] (1:server@Boivin) OK
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (3:client2@Fafard) Sent!
+> [  0.000000] (0:maestro@) **************************
+> [  0.000000] (0:maestro@) *** PROPERTY NOT VALID ***
+> [  0.000000] (0:maestro@) **************************
+> [  0.000000] (0:maestro@) Counter-example execution trace:
+> [  0.000000] (0:maestro@)   1: iRecv(mbox=0)
+> [  0.000000] (0:maestro@)   3: iSend(mbox=0)
+> [  0.000000] (0:maestro@)   1: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [  0.000000] (0:maestro@)   3: WaitComm(from 3 to 1, mbox=0, no timeout)
+> [  0.000000] (0:maestro@)   1: iRecv(mbox=0)
+> [  0.000000] (0:maestro@)   2: iSend(mbox=0)
+> [  0.000000] (0:maestro@)   1: WaitComm(from 2 to 1, mbox=0, no timeout)
+> [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;3;1;3;1;2;1'
+> [  0.000000] (0:maestro@) DFS exploration ended. 14 unique states visited; 1 backtracks (1 transition replays, 16 states visited overall)
\ No newline at end of file
index 2002f4b..6e8010b 100644 (file)
@@ -7,7 +7,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.
 > [Checker] 0 actors remain, but none of them need to be interleaved (depth 4).
 > [Checker] Execution came to an end at 1;1 (state: 3, depth: 3)
 > [Checker] Backtracking from 1;1
-> [Checker] DFS exploration ended. 3 unique states visited; 0 backtracks (3 transition replays, 0 states visited overall)
+> [Checker] DFS exploration ended. 3 unique states visited; 0 backtracks (0 transition replays, 3 states visited overall)
 
 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-barrier 2 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n"
 > [Checker] Start a DFS exploration. Reduction is: dpor.
@@ -49,7 +49,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.
 > [Checker] 0 actors remain, but none of them need to be interleaved (depth 6).
 > [Checker] Execution came to an end at 2;1;1;2 (state: 9, depth: 5)
 > [Checker] Backtracking from 2;1;1;2
-> [Checker] DFS exploration ended. 9 unique states visited; 1 backtracks (10 transition replays, 0 states visited overall)
+> [Checker] DFS exploration ended. 9 unique states visited; 1 backtracks (0 transition replays, 10 states visited overall)
 
 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-barrier 3 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n"
 > [Checker] Start a DFS exploration. Reduction is: dpor.
@@ -124,4 +124,4 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.
 > [Checker] 0 actors remain, but none of them need to be interleaved (depth 8).
 > [Checker] Execution came to an end at 1;3;2;1;2;3 (state: 12, depth: 7)
 > [Checker] Backtracking from 1;3;2;1;2;3
-> [Checker] DFS exploration ended. 12 unique states visited; 1 backtracks (14 transition replays, 1 states visited overall)
\ No newline at end of file
+> [Checker] DFS exploration ended. 12 unique states visited; 1 backtracks (1 transition replays, 14 states visited overall)
\ No newline at end of file
index 8ca73b7..c67f1dc 100644 (file)
@@ -7,7 +7,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/sleep-set' to 'true'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'actors' to '2'
 > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 66 unique states visited; 11 backtracks (97 transition replays, 20 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 66 unique states visited; 11 backtracks (22 transition replays, 99 states visited overall)
 
 p The stats without checkpoints is:               130 unique states visited; 27 backtracks (308 transition replays, 151 states visited overall)
 p But it runs much faster (0.6 sec vs. 1.6 sec), damn slow checkpointing code.
index 4de47b1..dd4f3c1 100644 (file)
@@ -29,63 +29,56 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.
 > [Checker] 0 actors remain, but none of them need to be interleaved (depth 8).
 > [Checker] Execution came to an end at 1;1;1;2;2;2 (state: 7, depth: 7)
 > [Checker] Backtracking from 1;1;1;2;2;2
-> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 1, state: 1, 0 interleaves)
-> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 2, state: 8, 0 interleaves)
-> [Checker] Dependent Transitions:
-> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1)
-> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=8)
-> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 3, state: 9, 0 interleaves)
-> [Checker] INDEPENDENT Transitions:
-> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=8)
-> [Checker]   MUTEX_WAIT(mutex: 0, owner: 2) (state=9)
-> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: 1) (stack depth: 4, state: 10, 0 interleaves)
-> [Checker] INDEPENDENT Transitions:
-> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=8)
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 1) (state=10)
-> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 5, state: 11, 0 interleaves)
-> [Checker] Dependent Transitions:
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 1) (state=10)
-> [Checker]   MUTEX_WAIT(mutex: 0, owner: 1) (state=11)
-> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 12, 0 interleaves)
-> [Checker] Dependent Transitions:
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 1) (state=10)
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: -1) (state=12)
-> [Checker] 0 actors remain, but none of them need to be interleaved (depth 8).
-> [Checker] Execution came to an end at 2;1;2;2;1;1 (state: 13, depth: 7)
-> [Checker] Backtracking from 2;1;2;2;1;1
 > [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 3, state: 3, 0 interleaves)
 > [Checker] INDEPENDENT Transitions:
 > [Checker]   MUTEX_WAIT(mutex: 0, owner: 1) (state=2)
 > [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=3)
-> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: 2) (stack depth: 4, state: 14, 0 interleaves)
-> [Checker] INDEPENDENT Transitions:
+> [Checker] Dependent Transitions:
+> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=1)
 > [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=3)
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=14)
+> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: 2) (stack depth: 4, state: 8, 0 interleaves)
 > [Checker] INDEPENDENT Transitions:
+> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=3)
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=8)
+> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 5, state: 9, 0 interleaves)
+> [Checker] Dependent Transitions:
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=8)
+> [Checker]   MUTEX_WAIT(mutex: 0, owner: 2) (state=9)
+> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 10, 0 interleaves)
+> [Checker] Dependent Transitions:
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=8)
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: -1) (state=10)
+> [Checker] 0 actors remain, but none of them need to be interleaved (depth 8).
+> [Checker] Execution came to an end at 1;1;2;1;2;2 (state: 11, depth: 7)
+> [Checker] Backtracking from 1;1;2;1;2;2
+> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 1, state: 1, 0 interleaves)
+> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 2, state: 12, 0 interleaves)
+> [Checker] Dependent Transitions:
 > [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1)
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=14)
-> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 5, state: 15, 0 interleaves)
+> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=12)
+> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 3, state: 13, 0 interleaves)
+> [Checker] INDEPENDENT Transitions:
+> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=12)
+> [Checker]   MUTEX_WAIT(mutex: 0, owner: 2) (state=13)
+> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: 1) (stack depth: 4, state: 14, 0 interleaves)
+> [Checker] INDEPENDENT Transitions:
+> [Checker]   MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=12)
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 1) (state=14)
+> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 5, state: 15, 0 interleaves)
 > [Checker] Dependent Transitions:
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=14)
-> [Checker]   MUTEX_WAIT(mutex: 0, owner: 2) (state=15)
-> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 16, 0 interleaves)
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 1) (state=14)
+> [Checker]   MUTEX_WAIT(mutex: 0, owner: 1) (state=15)
+> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 16, 0 interleaves)
 > [Checker] Dependent Transitions:
-> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 2) (state=14)
+> [Checker]   MUTEX_UNLOCK(mutex: 0, owner: 1) (state=14)
 > [Checker]   MUTEX_UNLOCK(mutex: 0, owner: -1) (state=16)
 > [Checker] 0 actors remain, but none of them need to be interleaved (depth 8).
-> [Checker] Execution came to an end at 1;1;2;1;2;2 (state: 17, depth: 7)
-> [Checker] Backtracking from 1;1;2;1;2;2
-> [Checker] DFS exploration ended. 17 unique states visited; 2 backtracks (21 transition replays, 2 states visited overall)
+> [Checker] Execution came to an end at 2;1;2;2;1;1 (state: 17, depth: 7)
+> [Checker] Backtracking from 2;1;2;2;1;1
+> [Checker] DFS exploration ended. 17 unique states visited; 2 backtracks (2 transition replays, 21 states visited overall)
 
 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true -- ${bindir:=.}/s4u-synchro-mutex --cfg=actors:2 --log=s4u_test.thres:critical
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/sleep-set' to 'true'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'actors' to '2'
 > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 66 unique states visited; 11 backtracks (126 transition replays, 49 states visited overall)
-
-$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:nb_wait -- ${bindir:=.}/s4u-synchro-mutex  --cfg=actors:3 --log=s4u_test.thres:critical
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/sleep-set' to 'true'
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/strategy' to 'nb_wait'
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'actors' to '3'
-> [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 296 unique states visited; 52 backtracks (765 transition replays, 417 states visited overall)
\ No newline at end of file
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 66 unique states visited; 11 backtracks (49 transition replays, 126 states visited overall)
index 674978d..3a82897 100644 (file)
@@ -3,4 +3,4 @@
 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-check/sleep-set:true --log=mc_dfs.thres:info --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-semaphore --log=sem_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n"
 > [Checker] Configuration change: Set 'model-check/sleep-set' to 'true'
 > [Checker] Start a DFS exploration. Reduction is: dpor.
-> [Checker] DFS exploration ended. 33 unique states visited; 8 backtracks (125 transition replays, 84 states visited overall)
+> [Checker] DFS exploration ended. 33 unique states visited; 8 backtracks (84 transition replays, 125 states visited overall)
index c6529ab..0e54fa6 100644 (file)
@@ -10,4 +10,4 @@ $ $VALGRIND_NO_LEAK_CHECK ../../../smpi_script/bin/smpirun -wrapper "${bindir:=.
 > [0.000000] [mc_comm_determinism/INFO] The recv communications pattern of the actor 0 is different! Different source for communication #1
 > [0.000000] [mc_comm_determinism/INFO] Send-deterministic : Yes
 > [0.000000] [mc_comm_determinism/INFO] Recv-deterministic : No
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 262 unique states visited; 73 backtracks (666 transition replays, 331 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 242 unique states visited; 67 backtracks (303 transition replays, 612 states visited overall)
index 2b6590a..f93185c 100644 (file)
@@ -36,7 +36,7 @@ $ $VALGRIND_NO_LEAK_CHECK ../../../smpi_script/bin/smpirun -quiet -wrapper "${bi
 > Sent 0 to rank 1
 > rank 1 recv the data
 > rank 0 recv the data
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 30 unique states visited; 7 backtracks (56 transition replays, 19 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 30 unique states visited; 7 backtracks (19 transition replays, 56 states visited overall)
 
 p Testing the paranoid model
 ! timeout 60
@@ -54,5 +54,5 @@ $ $VALGRIND_NO_LEAK_CHECK ../../../smpi_script/bin/smpirun -quiet -wrapper "${bi
 > [0.000000] [mc_global/INFO]   1: iSend(mbox=2)
 > [0.000000] [mc_global/INFO]   2: iSend(mbox=0)
 > [0.000000] [mc_Session/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1;2'
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 3 unique states visited; 0 backtracks (3 transition replays, 0 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 3 unique states visited; 0 backtracks (0 transition replays, 3 states visited overall)
 > Execution failed with code 3.
index 3946c2d..6e5bc5f 100644 (file)
@@ -15,4 +15,4 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-chec
 > The thread 1 is terminating.
 > The thread 0 is terminating.
 > User's main is terminating.
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 23 unique states visited; 2 backtracks (27 transition replays, 2 states visited overall)
\ No newline at end of file
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 23 unique states visited; 2 backtracks (2 transition replays, 27 states visited overall)
\ No newline at end of file
index 590fdc6..5e6cac0 100644 (file)
@@ -15,6 +15,9 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-chec
 > The thread 0 is terminating.
 > The thread 1 is terminating.
 > User's main is terminating.
+> The thread 0 is terminating.
+> The thread 1 is terminating.
+> User's main is terminating.
 > [0.000000] [mc_global/INFO] **************************
 > [0.000000] [mc_global/INFO] *** DEADLOCK DETECTED ***
 > [0.000000] [mc_global/INFO] **************************
@@ -31,4 +34,4 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-chec
 > [0.000000] [mc_global/INFO]   3: MUTEX_WAIT(mutex: 1, owner: 3)
 > [0.000000] [mc_global/INFO]   3: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2)
 > [0.000000] [mc_Session/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'2;2;3;2;3;3'
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 28 unique states visited; 2 backtracks (37 transition replays, 7 states visited overall)
\ No newline at end of file
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 38 unique states visited; 3 backtracks (11 transition replays, 52 states visited overall)
\ No newline at end of file
index 89be825..84efe30 100644 (file)
@@ -5,11 +5,5 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-chec
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/sleep-set' to 'true'
 > [0.000000] [sthread/INFO] Starting the simulation.
 > [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 106 unique states visited; 17 backtracks (295 transition replays, 172 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 103 unique states visited; 16 backtracks (163 transition replays, 282 states visited overall)
 
-$ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../bin/simgrid-mc --cfg=model-check/sleep-set:true --cfg=model-check/strategy:nb_wait --cfg=model-check/setenv:LD_PRELOAD=${libdir:=.}/libsgmalloc.so:${libdir:=.}/libsthread.so ${bindir:=.}/pthread-producer-consumer -q -c 2 -C 1 -p 2 -P 1
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/sleep-set' to 'true'
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'model-check/strategy' to 'nb_wait'
-> [0.000000] [sthread/INFO] Starting the simulation.
-> [0.000000] [mc_dfs/INFO] Start a DFS exploration. Reduction is: dpor.
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 107 unique states visited; 18 backtracks (300 transition replays, 175 states visited overall)
\ No newline at end of file
index 8241aed..da50b77 100644 (file)
@@ -25,4 +25,4 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc --cfg=model-c
 > [   0.000000] (maestro@)   2: BeginObjectAccess(&v)
 > [   0.000000] (maestro@)   3: BeginObjectAccess(&v)
 > [   0.000000] (maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'2;3'
-> [   0.000000] (maestro@) DFS exploration ended. 7 unique states visited; 1 backtracks (9 transition replays, 1 states visited overall)
+> [   0.000000] (maestro@) DFS exploration ended. 7 unique states visited; 1 backtracks (1 transition replays, 9 states visited overall)
index 877835f..cc85d8c 100644 (file)
@@ -5,7 +5,9 @@
 
 #include "src/mc/api/State.hpp"
 #include "src/mc/api/strategy/BasicStrategy.hpp"
-#include "src/mc/api/strategy/WaitStrategy.hpp"
+#include "src/mc/api/strategy/MaxMatchComm.hpp"
+#include "src/mc/api/strategy/MinMatchComm.hpp"
+#include "src/mc/api/strategy/UniformStrategy.hpp"
 #include "src/mc/explo/Exploration.hpp"
 #include "src/mc/mc_config.hpp"
 
@@ -21,10 +23,17 @@ long State::expended_states_ = 0;
 State::State(RemoteApp& remote_app) : num_(++expended_states_)
 {
   XBT_VERB("Creating a guide for the state");
+
+  srand(_sg_mc_random_seed);
+  
   if (_sg_mc_strategy == "none")
     strategy_ = std::make_shared<BasicStrategy>();
-  else if (_sg_mc_strategy == "nb_wait")
-    strategy_ = std::make_shared<WaitStrategy>();
+  else if (_sg_mc_strategy == "max_match_comm")
+    strategy_ = std::make_shared<MaxMatchComm>();
+  else if (_sg_mc_strategy == "min_match_comm")
+    strategy_ = std::make_shared<MinMatchComm>();
+  else if (_sg_mc_strategy == "uniform") 
+    strategy_ = std::make_shared<UniformStrategy>();
   else
     THROW_IMPOSSIBLE;
 
@@ -41,13 +50,18 @@ State::State(RemoteApp& remote_app) : num_(++expended_states_)
 State::State(RemoteApp& remote_app, std::shared_ptr<State> parent_state)
     : incoming_transition_(parent_state->get_transition_out()), num_(++expended_states_), parent_state_(parent_state)
 {
-  if (_sg_mc_strategy == "none")
+    
+   if (_sg_mc_strategy == "none")
     strategy_ = std::make_shared<BasicStrategy>();
-  else if (_sg_mc_strategy == "nb_wait")
-    strategy_ = std::make_shared<WaitStrategy>();
+  else if (_sg_mc_strategy == "max_match_comm")
+    strategy_ = std::make_shared<MaxMatchComm>();
+  else if (_sg_mc_strategy == "min_match_comm")
+    strategy_ = std::make_shared<MinMatchComm>();
+  else if (_sg_mc_strategy == "uniform") 
+    strategy_ = std::make_shared<UniformStrategy>();
   else
     THROW_IMPOSSIBLE;
-  *strategy_ = *(parent_state->strategy_);
+  strategy_->copy_from(parent_state_->strategy_.get());
 
   remote_app.get_actors_status(strategy_->actors_to_run_);
 
index 452efd4..1754252 100644 (file)
 
 namespace simgrid::mc {
 
-/** Basic MC guiding class which corresponds to no guide at all (random choice) */
+/** Basic MC guiding class which corresponds to no guide. When asked for different states
+ *  it will follow a depth first search politics to minize the number of opened states. */
 class BasicStrategy : public Strategy {
+    int depth_ = _sg_mc_max_depth; // Arbitrary starting point. next_transition must return a positiv value to work with threshold in DFSExplorer
+
 public:
+  void copy_from(const Strategy* strategy) override
+  {
+    const BasicStrategy* cast_strategy = dynamic_cast<BasicStrategy const*>(strategy);
+    xbt_assert(cast_strategy != nullptr);
+    depth_ = cast_strategy->depth_ - 1;
+    xbt_assert(depth_ > 0, "The exploration reached a depth greater than 100000. We will stop here to prevent weird interaction with DFSExplorer.");
+  }
   BasicStrategy()                     = default;
   ~BasicStrategy() override           = default;
-  BasicStrategy(const BasicStrategy&) = delete;
-  BasicStrategy& operator=(const BasicStrategy&)
-  { /* nothing to copy over while cloning */
-    return *this;
-  }
 
-  std::pair<aid_t, int> next_transition() const override
-  {
-    for (auto const& [aid, actor] : actors_to_run_) {
-      /* Only consider actors (1) marked as interleaving by the checker and (2) currently enabled in the application */
-      if (not actor.is_todo() || not actor.is_enabled() || actor.is_done()) {
+  std::pair<aid_t, int> best_transition(bool must_be_todo) const override {
+      for (auto const& [aid, actor] : actors_to_run_) {
+         /* Only consider actors (1) marked as interleaving by the checker and (2) currently enabled in the application */
+         if ((not actor.is_todo() && must_be_todo) || not actor.is_enabled() || actor.is_done()) {
         continue;
       }
 
-      return std::make_pair(aid, 1);
+      return std::make_pair(aid, depth_);
     }
-    return std::make_pair(-1, 0);
+    return std::make_pair(-1, depth_);
+  
   }
-  void execute_next(aid_t aid, RemoteApp& app) override { return; }
+    
 
-  void consider_best() override
-  {
-    for (auto& [_, actor] : actors_to_run_) {
-      if (actor.is_todo())
-        return;
-      if (actor.is_enabled() and not actor.is_done()) {
-        actor.mark_todo();
-        return;
-      }
-    }
-  }
+  void execute_next(aid_t aid, RemoteApp& app) override { return; }
+    
 };
 
 } // namespace simgrid::mc
diff --git a/src/mc/api/strategy/MaxMatchComm.hpp b/src/mc/api/strategy/MaxMatchComm.hpp
new file mode 100644 (file)
index 0000000..a2f1d60
--- /dev/null
@@ -0,0 +1,100 @@
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_MC_WAITSTRATEGY_HPP
+#define SIMGRID_MC_WAITSTRATEGY_HPP
+
+#include "src/mc/transition/TransitionComm.hpp"
+
+namespace simgrid::mc {
+
+/** Wait MC guiding class that aims at minimizing the number of in-fly communication.
+ *  When possible, it will try to match corresponding in-fly communications. */
+class MaxMatchComm : public Strategy {
+
+  /** Stores for each mailbox what kind of transition is waiting on it.
+   *  Negative number means that much recv are waiting on that mailbox, while
+   *  a positiv number means that much send are waiting there. */
+  std::map<unsigned, int> mailbox_;
+    int value_of_state_ = 0; // used to valuate the state. Corresponds to the number of in-fly communications
+    // The two next values are used to save the operation we execute so the next strategy can update its field accordingly
+  Transition::Type last_transition_; 
+  unsigned last_mailbox_ = 0;
+
+public:
+  void copy_from(const Strategy* strategy) override
+  {
+    const MaxMatchComm* cast_strategy = dynamic_cast<MaxMatchComm const*>(strategy);
+    xbt_assert(cast_strategy != nullptr);
+    for (auto& [id, val] : cast_strategy->mailbox_)
+      mailbox_[id] = val;
+    if (cast_strategy->last_transition_ == Transition::Type::COMM_ASYNC_RECV)
+      mailbox_[cast_strategy->last_mailbox_]--;
+    if (cast_strategy->last_transition_ == Transition::Type::COMM_ASYNC_SEND)
+      mailbox_[cast_strategy->last_mailbox_]++;
+
+    for (auto const& [_, val] : mailbox_)
+       value_of_state_ += std::abs(val);
+  }
+  MaxMatchComm()                     = default;
+  ~MaxMatchComm() override           = default;
+
+  std::pair<aid_t, int> best_transition(bool must_be_todo) const override
+  {
+          std::pair<aid_t, int> min_found = std::make_pair(-1, value_of_state_+2);
+    for (auto const& [aid, actor] : actors_to_run_) {
+       if ((not actor.is_todo() && must_be_todo) || not actor.is_enabled() || actor.is_done())
+           continue;
+
+      int aid_value = value_of_state_;
+      const Transition* transition = actor.get_transition(actor.get_times_considered()).get();
+     
+      const CommRecvTransition* cast_recv = dynamic_cast<CommRecvTransition const*>(transition);
+      if (cast_recv != nullptr) {
+         if (mailbox_.count(cast_recv->get_mailbox()) > 0 and
+             mailbox_.at(cast_recv->get_mailbox()) > 0) { 
+             aid_value--; // This means we have waiting recv corresponding to this recv
+         } else { 
+             aid_value++; 
+
+         }
+      }
+   
+      const CommSendTransition* cast_send = dynamic_cast<CommSendTransition const*>(transition);
+      if (cast_send != nullptr) {
+         if (mailbox_.count(cast_send->get_mailbox()) > 0 and
+             mailbox_.at(cast_send->get_mailbox()) < 0) {
+             aid_value--; // This means we have waiting recv corresponding to this send
+         }else {
+             aid_value++;
+         }
+      }
+   
+      if (aid_value < min_found.second)
+         min_found = std::make_pair(aid, aid_value);
+    }
+    return min_found;
+  }
+
+
+  void execute_next(aid_t aid, RemoteApp& app) override
+  {
+    const Transition* transition = actors_to_run_.at(aid).get_transition(actors_to_run_.at(aid).get_times_considered()).get();
+    last_transition_             = transition->type_;
+
+    const CommRecvTransition* cast_recv = dynamic_cast<CommRecvTransition const*>(transition);
+    if (cast_recv != nullptr)
+      last_mailbox_ = cast_recv->get_mailbox();
+
+    const CommSendTransition* cast_send = dynamic_cast<CommSendTransition const*>(transition);
+    if (cast_send != nullptr)
+      last_mailbox_ = cast_send->get_mailbox();
+  }
+
+};
+
+} // namespace simgrid::mc
+
+#endif
diff --git a/src/mc/api/strategy/MinMatchComm.hpp b/src/mc/api/strategy/MinMatchComm.hpp
new file mode 100644 (file)
index 0000000..665c92f
--- /dev/null
@@ -0,0 +1,101 @@
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_MC_MINWAITTAKEN_HPP
+#define SIMGRID_MC_MINWAITTAKEN_HPP
+
+#include "src/mc/transition/TransitionComm.hpp"
+
+namespace simgrid::mc {
+
+/** Wait MC guiding class that aims at maximizing the number of in-fly communication.
+ *  When possible, it will try not to match communications. */
+class MinMatchComm : public Strategy {
+
+    
+  /** Stores for each mailbox what kind of transition is waiting on it.
+   *  Negative number means that much recv are waiting on that mailbox, while
+   *  a positiv number means that much send are waiting there. */
+  std::map<unsigned, int> mailbox_;
+  /**  Used to valuate the state. Corresponds to a maximum minus the number of in-fly communications.
+   *   Maximum should be set in order not to reach 0.*/
+  int value_of_state_ = _sg_mc_max_depth;
+    
+    // The two next values are used to save the operation we execute so the next strategy can update its field accordingly
+  Transition::Type last_transition_;
+  unsigned last_mailbox_ = 0;
+
+public:
+  void copy_from(const Strategy* strategy) override
+  {
+      const MinMatchComm* cast_strategy = dynamic_cast<MinMatchComm const*>(strategy);
+      xbt_assert(cast_strategy != nullptr);
+      for (auto& [id, val] : cast_strategy->mailbox_)
+         mailbox_[id] = val;
+      if (cast_strategy->last_transition_ == Transition::Type::COMM_ASYNC_RECV)
+         mailbox_[cast_strategy->last_mailbox_]--;
+      if (cast_strategy->last_transition_ == Transition::Type::COMM_ASYNC_SEND)
+         mailbox_[cast_strategy->last_mailbox_]++;
+
+      for (auto const& [_, val] : mailbox_) 
+         value_of_state_ -= std::abs(val);
+      xbt_assert(value_of_state_ > 0, "MinMatchComm value shouldn't reach 0");
+  }
+    MinMatchComm()                     = default;
+  ~MinMatchComm() override           = default;
+
+ std::pair<aid_t, int> best_transition(bool must_be_todo) const override
+  {
+    std::pair<aid_t, int> min_found = std::make_pair(-1, value_of_state_+2);
+    for (auto const& [aid, actor] : actors_to_run_) {
+       if ((not actor.is_todo() && must_be_todo) || not actor.is_enabled() || actor.is_done())
+           continue;
+
+      int aid_value = value_of_state_;
+      const Transition* transition = actor.get_transition(actor.get_times_considered()).get();
+
+      const CommRecvTransition* cast_recv = dynamic_cast<CommRecvTransition const*>(transition);
+      if (cast_recv != nullptr) {
+         if ((mailbox_.count(cast_recv->get_mailbox()) > 0 and
+              mailbox_.at(cast_recv->get_mailbox()) <= 0) or mailbox_.count(cast_recv->get_mailbox()) == 0) 
+             aid_value--; // This means we don't have waiting recv corresponding to this recv
+         else 
+             aid_value++; 
+      }
+      const CommSendTransition* cast_send = dynamic_cast<CommSendTransition const*>(transition);
+      if (cast_send != nullptr) {
+         if ((mailbox_.count(cast_send->get_mailbox()) > 0 and
+              mailbox_.at(cast_send->get_mailbox()) >= 0) or mailbox_.count(cast_send->get_mailbox()) == 0)
+             aid_value--;
+         else
+             aid_value++;
+      }
+      
+      if (aid_value < min_found.second)
+         min_found = std::make_pair(aid, aid_value);
+    }
+    return min_found;
+  }
+
+    
+  void execute_next(aid_t aid, RemoteApp& app) override
+  {
+      const Transition* transition = actors_to_run_.at(aid).get_transition(actors_to_run_.at(aid).get_times_considered()).get();
+    last_transition_             = transition->type_;
+
+    const CommRecvTransition* cast_recv = dynamic_cast<CommRecvTransition const*>(transition);
+    if (cast_recv != nullptr)
+      last_mailbox_ = cast_recv->get_mailbox();
+
+    const CommSendTransition* cast_send = dynamic_cast<CommSendTransition const*>(transition);
+    if (cast_send != nullptr)
+      last_mailbox_ = cast_send->get_mailbox();
+  }
+
+};
+
+} // namespace simgrid::mc
+
+#endif
index de2f941..9bdebad 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "simgrid/forward.h"
 #include "src/mc/api/RemoteApp.hpp"
+#include "src/mc/mc_config.hpp"
 #include "xbt/asserts.h"
 #include <map>
 #include <utility>
@@ -16,32 +17,40 @@ namespace simgrid::mc {
 
 class Strategy {
 protected:
-  /** State's exploration status by actor. Not all the actors are there, only the ones that are ready-to-run in this
-   * state */
+  /** State's exploration status by actor. All actors should be present, eventually disabled for now. */
   std::map<aid_t, ActorState> actors_to_run_;
 
 public:
-  Strategy()                = default;
-  virtual ~Strategy()       = default;
-  Strategy(const Strategy&) = delete;
-  Strategy& operator=(const Strategy&)
-  { /* nothing to copy over while cloning */
-    return *this;
-  }
+  virtual void copy_from(const Strategy*) = 0;
+  Strategy()                              = default;
+  virtual ~Strategy()                     = default;
 
-  virtual std::pair<aid_t, int> next_transition() const = 0;
+  virtual std::pair<aid_t, int> best_transition(bool must_be_todo) const = 0;
+    
+  std::pair<aid_t, int> next_transition() { return best_transition(true); }
   virtual void execute_next(aid_t aid, RemoteApp& app)  = 0;
-  virtual void consider_best()                          = 0;
 
   // Mark the first enabled and not yet done transition as todo
   // If there's already a transition marked as todo, does nothing
+  void consider_best() {
+       for (auto& [_, actor] :actors_to_run_)
+           if (actor.is_todo())
+               return;
+       aid_t best_aid = best_transition(false).first;
+       if (best_aid != -1)
+           actors_to_run_.at(best_aid).mark_todo();
+  }
+
+  // Mark aid as todo. If it makes no sense, ie. if it is already done or not enabled,
+  // raise an error
   void consider_one(aid_t aid)
   {
     xbt_assert(actors_to_run_.at(aid).is_enabled() and not actors_to_run_.at(aid).is_done(),
                "Tried to mark as TODO actor %ld but it is either not enabled or already done", aid);
     actors_to_run_.at(aid).mark_todo();
   }
-  // Matk as todo all actors enabled that are not done yet
+  // Mark as todo all actors enabled that are not done yet and return the number
+  // of marked actors
   unsigned long consider_all()
   {
     unsigned long count = 0;
diff --git a/src/mc/api/strategy/UniformStrategy.hpp b/src/mc/api/strategy/UniformStrategy.hpp
new file mode 100644 (file)
index 0000000..1dfcd07
--- /dev/null
@@ -0,0 +1,68 @@
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_MC_UNIFORMSTRATEGY_HPP
+#define SIMGRID_MC_UNIFORMSTRATEGY_HPP
+
+#include "src/mc/transition/Transition.hpp"
+
+#define MAX_RAND 100000
+
+namespace simgrid::mc {
+
+/** Guiding strategy that valuate states randomly */
+class UniformStrategy : public Strategy {
+  std::map<aid_t, int> valuation;
+
+public:
+  UniformStrategy()
+  {
+    for (long aid = 0; aid < 10; aid++)
+      valuation[aid] = rand() % 10000;
+  }
+  void copy_from(const Strategy* strategy) override
+  {
+    for (auto& [aid, _] : actors_to_run_)
+      valuation[aid] = rand() % 10000;
+  }
+
+  std::pair<aid_t, int> best_transition(bool must_be_todo) const override
+  {
+    int possibilities = 0;
+
+    // Consider only valid actors
+    for (auto const& [aid, actor] : actors_to_run_) {
+       if ((actor.is_todo() or not must_be_todo) and (not actor.is_done()) and actor.is_enabled())
+        possibilities++;
+    }
+
+    int chosen;
+    if (possibilities == 0)
+      return std::make_pair(-1, 0);
+    if (possibilities == 1)
+      chosen = 0;
+    else
+      chosen = rand() % possibilities;
+
+    for (auto const& [aid, actor] : actors_to_run_) {
+       if (((not actor.is_todo()) and must_be_todo) or actor.is_done() or (not actor.is_enabled()))
+        continue;
+      if (chosen == 0) {
+        return std::make_pair(aid, valuation.at(aid));
+      }
+      chosen--;
+    }
+
+    return std::make_pair(-1, 0);
+  }
+
+    
+  void execute_next(aid_t aid, RemoteApp& app) override {}
+    
+};
+
+} // namespace simgrid::mc
+
+#endif
diff --git a/src/mc/api/strategy/WaitStrategy.hpp b/src/mc/api/strategy/WaitStrategy.hpp
deleted file mode 100644 (file)
index ed5b9a0..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef SIMGRID_MC_WAITSTRATEGY_HPP
-#define SIMGRID_MC_WAITSTRATEGY_HPP
-
-#include "Strategy.hpp"
-#include "src/mc/transition/Transition.hpp"
-
-namespace simgrid::mc {
-
-/** Wait MC guiding class that aims at minimizing the number of in-fly communication.
- *  When possible, it will try to take the wait transition. */
-class WaitStrategy : public Strategy {
-  int taken_wait_   = 0;
-  bool taking_wait_ = false;
-
-public:
-  WaitStrategy()                     = default;
-  ~WaitStrategy() override           = default;
-  WaitStrategy(const WaitStrategy&)  = delete;
-  WaitStrategy& operator=(const WaitStrategy& guide)
-  {
-    taken_wait_ = guide.taken_wait_;
-    return *this;
-  }
-
-  bool is_transition_wait(Transition::Type type) const
-  {
-    return type == Transition::Type::WAITANY or type == Transition::Type::BARRIER_WAIT or
-           type == Transition::Type::MUTEX_WAIT or type == Transition::Type::SEM_WAIT;
-  }
-
-  std::pair<aid_t, int> next_transition() const override
-  {
-    std::pair<aid_t, int> if_no_wait = std::make_pair(-1, 0);
-    for (auto const& [aid, actor] : actors_to_run_) {
-      if (not actor.is_todo() || not actor.is_enabled() || actor.is_done())
-        continue;
-      if (is_transition_wait(actor.get_transition(actor.get_times_considered())->type_))
-        return std::make_pair(aid, -(taken_wait_ + 1));
-      if_no_wait = std::make_pair(aid, -taken_wait_);
-    }
-    return if_no_wait;
-  }
-
-  /** If we are taking a wait transition, and last transition wasn't a wait, we need to increment the number
-   *  of wait taken. On the opposite, if we took a wait before, and now we are taking another transition, we need
-   *  to decrease the count. */
-  void execute_next(aid_t aid, RemoteApp& app) override
-  {
-    auto const& actor = actors_to_run_.at(aid);
-    if ((not taking_wait_) and is_transition_wait(actor.get_transition(actor.get_times_considered())->type_)) {
-      taken_wait_++;
-      taking_wait_ = true;
-      return;
-    }
-    if (taking_wait_ and (not is_transition_wait(actor.get_transition(actor.get_times_considered())->type_))) {
-      taken_wait_--;
-      taking_wait_ = false;
-      return;
-    }
-  }
-
-  void consider_best() override
-  {
-    aid_t aid = next_transition().first;
-    if (auto actor = actors_to_run_.find(aid); actor != actors_to_run_.end()) {
-      actor->second.mark_todo();
-      return;
-    }
-    for (auto& [_, actor] : actors_to_run_) {
-      if (actor.is_todo())
-        return;
-      if (actor.is_enabled() and not actor.is_done()) {
-        actor.mark_todo();
-        return;
-      }
-    }
-  }
-};
-
-} // namespace simgrid::mc
-
-#endif
index a5f06d5..aa7fbb0 100644 (file)
@@ -112,8 +112,8 @@ void DFSExplorer::log_state() // override
   on_log_state_signal(get_remote_app());
   XBT_INFO("DFS exploration ended. %ld unique states visited; %lu backtracks (%lu transition replays, %lu states "
            "visited overall)",
-           State::get_expanded_states(), backtrack_count_, visited_states_count_,
-           Transition::get_replayed_transitions());
+           State::get_expanded_states(), backtrack_count_, Transition::get_replayed_transitions(),
+          visited_states_count_);
   Exploration::log_state();
 }
 
@@ -372,7 +372,7 @@ std::shared_ptr<State> DFSExplorer::best_opened_state()
       continue;
     if (valid != current)
       *valid = std::move(*current);
-    if (best == end(opened_states_) || prio > best_prio) {
+    if (best == end(opened_states_) || prio < best_prio) {
       best_prio = prio;
       best      = valid;
     }
index 1d9375f..571ec6e 100644 (file)
@@ -70,8 +70,15 @@ simgrid::config::Flag<std::string> _sg_mc_strategy{
     "model-check/strategy",
     "Specify the the kind of heuristic to use for guided model-checking",
     "none",
-    {{"none", "No specific strategy: simply pick the first available transistion."},
-     {"nb_wait", "Take any enabled wait transition, to reduce the distance between an async and its wait."}}};
+    {{"none", "No specific strategy: simply pick the first available transistion and act as a DFS."},
+     {"max_match_comm", "Try to minimize the number of in-fly communication by appairing matching send and receive."},
+     {"min_match_comm", "Try to maximize the number of in-fly communication by not appairing matching send and receive."},
+     {"uniform", "No specific strategy: choices are made randomly based on a uniform sampling."}
+    }};
+
+simgrid::config::Flag<int> _sg_mc_random_seed{"model-check/rand-seed",
+                                              "give a specific random seed to initialize the uniform distribution", 0,
+                                              [](int) { _mc_cfg_cb_check("Random seed"); }};
 
 #if SIMGRID_HAVE_STATEFUL_MC
 simgrid::config::Flag<int> _sg_mc_checkpoint{
index b544580..07d199f 100644 (file)
@@ -25,6 +25,7 @@ extern XBT_PUBLIC simgrid::config::Flag<bool> _sg_mc_send_determinism;
 extern XBT_PUBLIC simgrid::config::Flag<bool> _sg_mc_unfolding_checker;
 extern XBT_PRIVATE simgrid::config::Flag<bool> _sg_mc_timeout;
 extern XBT_PRIVATE simgrid::config::Flag<int> _sg_mc_max_depth;
+extern XBT_PRIVATE simgrid::config::Flag<int> _sg_mc_random_seed;
 extern "C" XBT_PUBLIC int _sg_mc_max_visited_states;
 extern XBT_PRIVATE simgrid::config::Flag<std::string> _sg_mc_dot_output_file;
 extern XBT_PRIVATE simgrid::config::Flag<bool> _sg_mc_termination;
index f532369..220b7cb 100644 (file)
@@ -27,9 +27,11 @@ TestAnyTransition::TestAnyTransition(aid_t issuer, int times_considered, std::st
 }
 std::string TestAnyTransition::to_string(bool verbose) const
 {
-  auto res = xbt::string_printf("TestAny");
-  for (auto const* t : transitions_)
+  auto res = xbt::string_printf("TestAny(%s){ ", this->result() ? "TRUE" : "FALSE");
+  for (auto const* t : transitions_) {
     res += t->to_string(verbose);
+    res += "; ";
+  }
   res += " }";
   return res;
 }
index df5954e..b064811 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/kernel/actor/SimcallObserver.hpp"
 #include "src/mc/transition/Transition.hpp"
+#include "src/mc/transition/TransitionComm.hpp"
 
 #include <sstream>
 #include <string>
@@ -23,6 +24,15 @@ public:
   bool depends(const Transition* other) const override;
 
   Transition* get_current_transition() const { return transitions_.at(times_considered_); }
+  bool result() const
+  {
+    for (Transition* transition : transitions_) {
+      CommTestTransition* tested_transition = static_cast<CommTestTransition*>(transition);
+      if (tested_transition->get_sender() != -1 and tested_transition->get_receiver() != -1)
+        return true;
+    }
+    return false;
+  }
 };
 
 class WaitAnyTransition : public Transition {
index 5dbc380..46ab37a 100644 (file)
@@ -10,7 +10,7 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [  0.000000] (0:maestro@)   1: Random([0;5] ~> 3)
 > [  0.000000] (0:maestro@)   1: Random([0;5] ~> 4)
 > [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1/3;1/4'
-> [  0.000000] (0:maestro@) DFS exploration ended. 26 unique states visited; 21 backtracks (65 transition replays, 18 states visited overall)
+> [  0.000000] (0:maestro@) DFS exploration ended. 27 unique states visited; 22 backtracks (19 transition replays, 68 states visited overall)
 
 ! expect return 6
 # because SIMGRID_MC_EXIT_PROGRAM_CRASH = 6
@@ -25,14 +25,14 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [  0.000000] (0:maestro@)   1: Random([0;5] ~> 3)
 > [  0.000000] (0:maestro@)   1: Random([0;5] ~> 4)
 > [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1/3;1/4'
-> [  0.000000] (0:maestro@) DFS exploration ended. 26 unique states visited; 21 backtracks (65 transition replays, 18 states visited overall)
+> [  0.000000] (0:maestro@) DFS exploration ended. 27 unique states visited; 22 backtracks (19 transition replays, 68 states visited overall)
 > [  0.000000] (0:maestro@) Stack trace not displayed because you passed --log=no_loc
 
 $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/random-bug printf ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" --log=xbt_cfg.thresh:warning
 > [  0.000000] (0:maestro@) Behavior: printf
 > [  0.000000] (0:maestro@) Start a DFS exploration. Reduction is: dpor.
 > [  0.000000] (1:app@Fafard) Error reached
-> [  0.000000] (0:maestro@) DFS exploration ended. 43 unique states visited; 35 backtracks (108 transition replays, 30 states visited overall)
+> [  0.000000] (0:maestro@) DFS exploration ended. 43 unique states visited; 35 backtracks (30 transition replays, 108 states visited overall)
 
 ! expect return 6
 # because SIMGRID_MC_EXIT_PROGRAM_CRASH = 6
@@ -48,5 +48,5 @@ $ $VALGRIND_NO_TRACE_CHILDREN ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/
 > [  0.000000] (0:maestro@)   1: Random([0;5] ~> 3)
 > [  0.000000] (0:maestro@)   1: Random([0;5] ~> 4)
 > [  0.000000] (0:maestro@) You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'1/3;1/4'
-> [  0.000000] (0:maestro@) DFS exploration ended. 26 unique states visited; 21 backtracks (65 transition replays, 18 states visited overall)
+> [  0.000000] (0:maestro@) DFS exploration ended. 27 unique states visited; 22 backtracks (19 transition replays, 68 states visited overall)
 > [  0.000000] (0:maestro@) Stack trace not displayed because you passed --log=no_loc
index 5377503..a0f2785 100644 (file)
@@ -347,50 +347,6 @@ $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/../../../smpi_script/bin/smpirun -wrapper
 > Largest allocation at once from a single process was 28 bytes, at coll-allreduce-with-leaks.c:28. It was called 1 times during the whole simulation.
 > If this is too much, consider sharing allocations for computation buffers.
 > This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
-> 
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles:
-> [0.000000] [smpi_utils/WARNING] To get more information (location of allocations), compile your code with -trace-call-location flag of smpicc/f90
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Comm
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Group
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed buffers:
-> [0.000000] [smpi_utils/INFO] leaked allocations of total size 152, called 8 times, with minimum size 16 and maximum size 28
-> [0.000000] [smpi_utils/INFO] Memory Usage: Simulated application allocated 152 bytes during its lifetime through malloc/calloc calls.
-> Largest allocation at once from a single process was 28 bytes, at coll-allreduce-with-leaks.c:28. It was called 1 times during the whole simulation.
-> If this is too much, consider sharing allocations for computation buffers.
-> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
-> 
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles:
-> [0.000000] [smpi_utils/WARNING] To get more information (location of allocations), compile your code with -trace-call-location flag of smpicc/f90
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Comm
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Group
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed buffers:
-> [0.000000] [smpi_utils/INFO] leaked allocations of total size 152, called 8 times, with minimum size 16 and maximum size 28
-> [0.000000] [smpi_utils/INFO] Memory Usage: Simulated application allocated 152 bytes during its lifetime through malloc/calloc calls.
-> Largest allocation at once from a single process was 28 bytes, at coll-allreduce-with-leaks.c:28. It was called 1 times during the whole simulation.
-> If this is too much, consider sharing allocations for computation buffers.
-> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
-> 
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles:
-> [0.000000] [smpi_utils/WARNING] To get more information (location of allocations), compile your code with -trace-call-location flag of smpicc/f90
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Comm
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Group
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed buffers:
-> [0.000000] [smpi_utils/INFO] leaked allocations of total size 152, called 8 times, with minimum size 16 and maximum size 28
-> [0.000000] [smpi_utils/INFO] Memory Usage: Simulated application allocated 152 bytes during its lifetime through malloc/calloc calls.
-> Largest allocation at once from a single process was 28 bytes, at coll-allreduce-with-leaks.c:28. It was called 1 times during the whole simulation.
-> If this is too much, consider sharing allocations for computation buffers.
-> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
-> 
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles:
-> [0.000000] [smpi_utils/WARNING] To get more information (location of allocations), compile your code with -trace-call-location flag of smpicc/f90
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Comm
-> [0.000000] [smpi_utils/INFO] 4 leaked handles of type MPI_Group
-> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed buffers:
-> [0.000000] [smpi_utils/INFO] leaked allocations of total size 152, called 8 times, with minimum size 16 and maximum size 28
-> [0.000000] [smpi_utils/INFO] Memory Usage: Simulated application allocated 152 bytes during its lifetime through malloc/calloc calls.
-> Largest allocation at once from a single process was 28 bytes, at coll-allreduce-with-leaks.c:28. It was called 1 times during the whole simulation.
-> If this is too much, consider sharing allocations for computation buffers.
-> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
 >
 > [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles:
 > [0.000000] [smpi_utils/WARNING] To get more information (location of allocations), compile your code with -trace-call-location flag of smpicc/f90
@@ -645,4 +601,4 @@ $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/../../../smpi_script/bin/smpirun -wrapper
 > If this is too much, consider sharing allocations for computation buffers.
 > This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
 > 
-> [0.000000] [mc_dfs/INFO] DFS exploration ended. 1005 unique states visited; 276 backtracks (6560 transition replays, 5279 states visited overall)
+> [0.000000] [mc_dfs/INFO] DFS exploration ended. 936 unique states visited; 254 backtracks (4843 transition replays, 6033 states visited overall)
\ No newline at end of file
index 55875a9..28c0892 100644 (file)
@@ -637,8 +637,10 @@ set(MC_SRC_STATEFUL
   src/mc/mc_record.cpp
 
   src/mc/api/strategy/BasicStrategy.hpp
+  src/mc/api/strategy/MaxMatchComm.hpp
+  src/mc/api/strategy/MinMatchComm.hpp
   src/mc/api/strategy/Strategy.hpp
-  src/mc/api/strategy/WaitStrategy.hpp
+  src/mc/api/strategy/UniformStrategy.hpp
   
   src/xbt/mmalloc/mm_interface.c
   )