From 078a96e4b84369c23073bb68e15273030e9a357b Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Tue, 2 Apr 2019 15:12:41 +0200 Subject: [PATCH] implement CRTP in kernel::activity --- .../smpi/replay/replay-override-replayer.tesh | 4 +-- examples/smpi/replay/replay.tesh | 4 +-- .../replay_multiple_manual_mixed1.tesh | 4 +-- .../replay_multiple_manual_mixed2.tesh | 16 +++++----- .../replay_multiple_manual_mixed2_st.tesh | 2 +- ...eplay_multiple_manual_mixed2_st_noise.tesh | 2 +- .../replay_multiple_manual_mixed2_st_sr.tesh | 2 +- ...ay_multiple_manual_mixed2_st_sr_noise.tesh | 2 +- include/simgrid/s4u/Comm.hpp | 4 ++- src/kernel/activity/ActivityImpl.cpp | 6 ---- src/kernel/activity/ActivityImpl.hpp | 30 ++++++++++++++----- src/kernel/activity/CommImpl.cpp | 1 + src/kernel/activity/CommImpl.hpp | 2 +- src/kernel/activity/ExecImpl.cpp | 14 ++------- src/kernel/activity/ExecImpl.hpp | 4 +-- src/kernel/activity/IoImpl.cpp | 6 ---- src/kernel/activity/IoImpl.hpp | 3 +- src/kernel/activity/SleepImpl.cpp | 6 ---- src/kernel/activity/SleepImpl.hpp | 3 +- src/kernel/activity/SynchroRaw.hpp | 2 +- src/kernel/actor/ActorImpl.cpp | 3 +- src/msg/msg_task.cpp | 6 ++-- src/s4u/s4u_Comm.cpp | 7 +++++ src/simix/smx_global.cpp | 8 +++-- src/smpi/mpi/smpi_request.cpp | 4 +-- 25 files changed, 71 insertions(+), 74 deletions(-) diff --git a/examples/smpi/replay/replay-override-replayer.tesh b/examples/smpi/replay/replay-override-replayer.tesh index 745104fb0a..7d1feac3a3 100644 --- a/examples/smpi/replay/replay-override-replayer.tesh +++ b/examples/smpi/replay/replay-override-replayer.tesh @@ -215,8 +215,8 @@ p Another test of trace replay with SMPI (one trace per process) $ mkfile ./split_traces_tesh_override $ ../../smpi_script/bin/smpirun -no-privatize -replay ./split_traces_tesh_override --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 2 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning -> [Jupiter:1:(2) 0.167158] [smpi_replay/VERBOSE] 1 recv 0 0 1e6 0.167158 > [Tremblay:0:(1) 0.167158] [smpi_replay/VERBOSE] 0 send 1 0 1e6 0.167158 +> [Jupiter:1:(2) 0.167158] [smpi_replay/VERBOSE] 1 recv 0 0 1e6 0.167158 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 isend 0 1 1e6 0.000000 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 irecv 0 2 1e6 0.000000 @@ -233,8 +233,8 @@ p Test of barrier replay with SMPI (one trace for all processes) $ mkfile replay/one_trace_override $ ../../smpi_script/bin/smpirun -no-privatize -replay replay/one_trace_override --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning -> [Jupiter:1:(2) 1.518421] [smpi_replay/VERBOSE] 1 recv 0 0 1e7 1.518421 > [Tremblay:0:(1) 1.518421] [smpi_replay/VERBOSE] 0 send 1 0 1e7 1.518421 +> [Jupiter:1:(2) 1.518421] [smpi_replay/VERBOSE] 1 recv 0 0 1e7 1.518421 > [Tremblay:0:(1) 1.520397] [smpi_replay/VERBOSE] 0 barrier 0.001976 > [Jupiter:1:(2) 1.521858] [smpi_replay/VERBOSE] 1 barrier 0.003438 > [Fafard:2:(3) 1.522373] [smpi_replay/VERBOSE] 2 barrier 1.522373 diff --git a/examples/smpi/replay/replay.tesh b/examples/smpi/replay/replay.tesh index 92ab687831..38496fdc47 100644 --- a/examples/smpi/replay/replay.tesh +++ b/examples/smpi/replay/replay.tesh @@ -215,8 +215,8 @@ p Another test of trace replay with SMPI (one trace per process) $ mkfile ./split_traces_tesh $ ../../smpi_script/bin/smpirun -no-privatize -replay ./split_traces_tesh --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 2 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning -> [Jupiter:1:(2) 0.167158] [smpi_replay/VERBOSE] 1 recv 0 0 1e6 0.167158 > [Tremblay:0:(1) 0.167158] [smpi_replay/VERBOSE] 0 send 1 0 1e6 0.167158 +> [Jupiter:1:(2) 0.167158] [smpi_replay/VERBOSE] 1 recv 0 0 1e6 0.167158 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 isend 0 1 1e6 0.000000 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 irecv 0 2 1e6 0.000000 @@ -233,8 +233,8 @@ p Test of barrier replay with SMPI (one trace for all processes) $ mkfile replay/one_trace $ ../../smpi_script/bin/smpirun -no-privatize -replay replay/one_trace --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning -> [Jupiter:1:(2) 1.518421] [smpi_replay/VERBOSE] 1 recv 0 0 1e7 1.518421 > [Tremblay:0:(1) 1.518421] [smpi_replay/VERBOSE] 0 send 1 0 1e7 1.518421 +> [Jupiter:1:(2) 1.518421] [smpi_replay/VERBOSE] 1 recv 0 0 1e7 1.518421 > [Tremblay:0:(1) 1.520397] [smpi_replay/VERBOSE] 0 barrier 0.001976 > [Jupiter:1:(2) 1.521858] [smpi_replay/VERBOSE] 1 barrier 0.003438 > [Fafard:2:(3) 1.522373] [smpi_replay/VERBOSE] 2 barrier 1.522373 diff --git a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed1.tesh b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed1.tesh index 2c75648f89..793eaf6036 100644 --- a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed1.tesh +++ b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed1.tesh @@ -13,7 +13,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir > [ 0.000000] (job_0000@Bourassa) Executing job 0 (smpi_app 'alone') > [ 0.000000] (rank_0_0@Bourassa) Replaying rank 0 of job 0 (smpi_app 'alone') > [ 0.000000] (rank_0_1@Fafard) Replaying rank 1 of job 0 (smpi_app 'alone') -> [ 737.001374] (rank_0_1@Fafard) Simulation time 737.001374 +> [ 737.001374] (rank_0_0@Bourassa) Simulation time 737.001374 > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'alone') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'alone') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'alone') @@ -29,7 +29,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir > [ 0.000000] (job_0000@Bourassa) Executing job 0 (smpi_app 'alone') > [ 0.000000] (rank_0_0@Bourassa) Replaying rank 0 of job 0 (smpi_app 'alone') > [ 0.000000] (rank_0_1@Fafard) Replaying rank 1 of job 0 (smpi_app 'alone') -> [ 737.001374] (rank_0_1@Fafard) Simulation time 737.001374 +> [ 737.001374] (rank_0_0@Bourassa) Simulation time 737.001374 > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'alone') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'alone') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'alone') diff --git a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2.tesh b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2.tesh index 8f3de7e85e..3e1221e534 100644 --- a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2.tesh +++ b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2.tesh @@ -15,7 +15,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [ 0.000000] (workload@Bourassa) Sleeping 1000 seconds (waiting for job 1000, app 'job1') > [ 0.000000] (rank_0_0@Bourassa) Replaying rank 0 of job 0 (smpi_app 'job0') > [ 0.000000] (rank_0_1@Fafard) Replaying rank 1 of job 0 (smpi_app 'job0') -> [ 737.001374] (rank_0_1@Fafard) Simulation time 737.001374 +> [ 737.001374] (rank_0_0@Bourassa) Simulation time 737.001374 > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'job0') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'job0') @@ -23,7 +23,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [1000.000000] (job_0001@Ginette) Executing job 1 (smpi_app 'job1') > [1000.000000] (rank_1_0@Ginette) Replaying rank 0 of job 1 (smpi_app 'job1') > [1000.000000] (rank_1_1@Jupiter) Replaying rank 1 of job 1 (smpi_app 'job1') -> [1806.923160] (rank_1_1@Jupiter) Simulation time 806.923160 +> [1806.923160] (rank_1_0@Ginette) Simulation time 806.923160 > [1806.923160] (rank_1_0@Ginette) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [1806.923160] (rank_1_1@Jupiter) Finished replaying rank 1 of job 1 (smpi_app 'job1') > [1807.923160] (job_0001@Ginette) Finished job 1 (smpi_app 'job1') @@ -41,7 +41,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [ 0.000000] (workload@Bourassa) Sleeping 1000 seconds (waiting for job 1000, app 'job1') > [ 0.000000] (rank_0_0@Bourassa) Replaying rank 0 of job 0 (smpi_app 'job0') > [ 0.000000] (rank_0_1@Fafard) Replaying rank 1 of job 0 (smpi_app 'job0') -> [ 737.001374] (rank_0_1@Fafard) Simulation time 737.001374 +> [ 737.001374] (rank_0_0@Bourassa) Simulation time 737.001374 > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'job0') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'job0') @@ -49,7 +49,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [1000.000000] (job_0001@Ginette) Executing job 1 (smpi_app 'job1') > [1000.000000] (rank_1_0@Ginette) Replaying rank 0 of job 1 (smpi_app 'job1') > [1000.000000] (rank_1_1@Jupiter) Replaying rank 1 of job 1 (smpi_app 'job1') -> [1806.923160] (rank_1_1@Jupiter) Simulation time 806.923160 +> [1806.923160] (rank_1_0@Ginette) Simulation time 806.923160 > [1806.923160] (rank_1_0@Ginette) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [1806.923160] (rank_1_1@Jupiter) Finished replaying rank 1 of job 1 (smpi_app 'job1') > [1807.923160] (job_0001@Ginette) Finished job 1 (smpi_app 'job1') @@ -75,7 +75,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [ 0.000000] (workload@Bourassa) Sleeping 1000 seconds (waiting for job 1000, app 'job1') > [ 0.000000] (rank_0_0@Bourassa) Replaying rank 0 of job 0 (smpi_app 'job0') > [ 0.000000] (rank_0_1@Fafard) Replaying rank 1 of job 0 (smpi_app 'job0') -> [ 737.001374] (rank_0_1@Fafard) Simulation time 737.001374 +> [ 737.001374] (rank_0_0@Bourassa) Simulation time 737.001374 > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'job0') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'job0') @@ -83,7 +83,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [1000.000000] (job_0001@Bourassa) Executing job 1 (smpi_app 'job1') > [1000.000000] (rank_1_0@Bourassa) Replaying rank 0 of job 1 (smpi_app 'job1') > [1000.000000] (rank_1_1@Fafard) Replaying rank 1 of job 1 (smpi_app 'job1') -> [1737.001374] (rank_1_1@Fafard) Simulation time 737.001374 +> [1737.001374] (rank_1_0@Bourassa) Simulation time 737.001374 > [1737.001374] (rank_1_0@Bourassa) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [1737.001374] (rank_1_1@Fafard) Finished replaying rank 1 of job 1 (smpi_app 'job1') > [1738.001374] (job_0001@Bourassa) Finished job 1 (smpi_app 'job1') @@ -101,7 +101,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [ 0.000000] (workload@Bourassa) Sleeping 1000 seconds (waiting for job 1000, app 'job1') > [ 0.000000] (rank_0_0@Bourassa) Replaying rank 0 of job 0 (smpi_app 'job0') > [ 0.000000] (rank_0_1@Fafard) Replaying rank 1 of job 0 (smpi_app 'job0') -> [ 737.001374] (rank_0_1@Fafard) Simulation time 737.001374 +> [ 737.001374] (rank_0_0@Bourassa) Simulation time 737.001374 > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'job0') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'job0') @@ -109,7 +109,7 @@ $ ./replay_multiple_manual ${platfdir}/small_platform_with_routers.xml ${srcdir: > [1000.000000] (job_0001@Bourassa) Executing job 1 (smpi_app 'job1') > [1000.000000] (rank_1_0@Bourassa) Replaying rank 0 of job 1 (smpi_app 'job1') > [1000.000000] (rank_1_1@Fafard) Replaying rank 1 of job 1 (smpi_app 'job1') -> [1737.001374] (rank_1_1@Fafard) Simulation time 737.001374 +> [1737.001374] (rank_1_0@Bourassa) Simulation time 737.001374 > [1737.001374] (rank_1_0@Bourassa) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [1737.001374] (rank_1_1@Fafard) Finished replaying rank 1 of job 1 (smpi_app 'job1') > [1738.001374] (job_0001@Bourassa) Finished job 1 (smpi_app 'job1') diff --git a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st.tesh b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st.tesh index b70b166713..d67b84fd2f 100644 --- a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st.tesh +++ b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st.tesh @@ -16,8 +16,8 @@ $ ./replay_multiple_manual ${srcdir:=.}/../../platforms/small_platform_with_rout > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'job0') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'job0') +> [ 806.923160] (rank_1_0@Ginette) Simulation time 806.923160 > [ 806.923160] (rank_1_0@Ginette) Finished replaying rank 0 of job 1 (smpi_app 'job1') -> [ 806.923160] (rank_1_1@Jupiter) Simulation time 806.923160 > [ 806.923160] (rank_1_1@Jupiter) Finished replaying rank 1 of job 1 (smpi_app 'job1') > [ 807.923160] (job_0001@Ginette) Finished job 1 (smpi_app 'job1') > [ 807.923160] (maestro@) Simulation finished! Final time: 807.923 diff --git a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_noise.tesh b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_noise.tesh index 5a948628df..100b2778c9 100644 --- a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_noise.tesh +++ b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_noise.tesh @@ -16,7 +16,7 @@ $ ./replay_multiple_manual ${srcdir:=.}/../../platforms/small_platform_with_rout > [ 737.001374] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [ 737.001374] (rank_0_1@Fafard) Finished replaying rank 1 of job 0 (smpi_app 'job0') > [ 738.001374] (job_0000@Bourassa) Finished job 0 (smpi_app 'job0') -> [ 806.923160] (rank_1_1@Jupiter) Simulation time 806.923160 +> [ 806.923160] (rank_1_0@Ginette) Simulation time 806.923160 > [ 806.923160] (rank_1_0@Ginette) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [ 806.923160] (rank_1_1@Jupiter) Finished replaying rank 1 of job 1 (smpi_app 'job1') > [ 807.923160] (job_0001@Ginette) Finished job 1 (smpi_app 'job1') diff --git a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr.tesh b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr.tesh index 36484ff60b..8eaaa2e6aa 100644 --- a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr.tesh +++ b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr.tesh @@ -13,7 +13,7 @@ $ ./replay_multiple_manual ${srcdir:=.}/../../platforms/small_platform_with_rout > [ 0.000000] (job_0001@Bourassa) Executing job 1 (smpi_app 'job1') > [ 0.000000] (rank_1_0@Bourassa) Replaying rank 0 of job 1 (smpi_app 'job1') > [ 0.000000] (rank_1_1@Fafard) Replaying rank 1 of job 1 (smpi_app 'job1') -> [1473.975664] (rank_0_1@Fafard) Simulation time 1473.975664 +> [1473.975664] (rank_0_0@Bourassa) Simulation time 1473.975664 > [1473.975664] (rank_1_0@Bourassa) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [1473.975664] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [1473.975664] (rank_1_1@Fafard) Finished replaying rank 1 of job 1 (smpi_app 'job1') diff --git a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr_noise.tesh b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr_noise.tesh index ed7122928b..d72130b63b 100644 --- a/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr_noise.tesh +++ b/examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr_noise.tesh @@ -13,7 +13,7 @@ $ ./replay_multiple_manual ${srcdir:=.}/../../platforms/small_platform_with_rout > [ 0.000000] (job_0001@Bourassa) Executing job 1 (smpi_app 'job1') > [ 0.000000] (rank_1_0@Bourassa) Replaying rank 0 of job 1 (smpi_app 'job1') > [ 0.000000] (rank_1_1@Fafard) Replaying rank 1 of job 1 (smpi_app 'job1') -> [1473.975664] (rank_0_1@Fafard) Simulation time 1473.975664 +> [1473.975664] (rank_0_0@Bourassa) Simulation time 1473.975664 > [1473.975664] (rank_1_0@Bourassa) Finished replaying rank 0 of job 1 (smpi_app 'job1') > [1473.975664] (rank_0_0@Bourassa) Finished replaying rank 0 of job 0 (smpi_app 'job0') > [1473.975664] (rank_1_1@Fafard) Finished replaying rank 1 of job 1 (smpi_app 'job1') diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 439bf65459..d59fc2a8ea 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -27,8 +27,8 @@ class XBT_PUBLIC Comm : public Activity { size_t dst_buff_size_ = 0; void* src_buff_ = nullptr; size_t src_buff_size_ = sizeof(void*); + std::string tracing_category_ = ""; std::atomic_int_fast32_t refcount_{0}; - /* FIXME: expose these elements in the API */ int detached_ = 0; int (*match_fun_)(void*, void*, kernel::activity::CommImpl*) = nullptr; @@ -111,6 +111,8 @@ public: * That's a buffer where the sent data will be copied */ CommPtr set_dst_data(void** buff, size_t size); + CommPtr set_tracing_category(const std::string& category); + /** Retrieve the mailbox on which this comm acts */ Mailbox* get_mailbox(); /** Retrieve the size of the received data. Not to be mixed with @ref Activity::set_remaining() */ diff --git a/src/kernel/activity/ActivityImpl.cpp b/src/kernel/activity/ActivityImpl.cpp index f7f719c20a..d50f13ccfd 100644 --- a/src/kernel/activity/ActivityImpl.cpp +++ b/src/kernel/activity/ActivityImpl.cpp @@ -38,12 +38,6 @@ void ActivityImpl::resume() on_resumed(*this); } -void ActivityImpl::set_category(const std::string& category) -{ - if (surf_action_) - surf_action_->set_category(category); -} - // boost::intrusive_ptr support: void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity) { diff --git a/src/kernel/activity/ActivityImpl.hpp b/src/kernel/activity/ActivityImpl.hpp index 8fdd778157..239ef1b829 100644 --- a/src/kernel/activity/ActivityImpl.hpp +++ b/src/kernel/activity/ActivityImpl.hpp @@ -22,20 +22,13 @@ namespace activity { class XBT_PUBLIC ActivityImpl { std::atomic_int_fast32_t refcount_{0}; - std::string name_; /* Activity name if any */ public: virtual ~ActivityImpl(); ActivityImpl() = default; - explicit ActivityImpl(const std::string& name) : name_(name) {} e_smx_state_t state_ = SIMIX_WAITING; /* State of the activity */ std::list simcalls_; /* List of simcalls waiting for this activity */ resource::Action* surf_action_ = nullptr; - const std::string& get_name() const { return name_; } - const char* get_cname() const { return name_.c_str(); } - void set_name(const std::string& name) { name_ = name; } - void set_category(const std::string& category); - virtual void suspend(); virtual void resume(); virtual void post() = 0; // What to do when a simcall terminates @@ -48,6 +41,29 @@ public: static xbt::signal on_suspended; static xbt::signal on_resumed; }; + +template class ActivityImpl_T : public ActivityImpl { +private: + std::string name_ = ""; + std::string tracing_category_ = ""; + +public: + AnyActivityImpl& set_name(const std::string& name) + { + name_ = name; + return static_cast(*this); + } + const std::string& get_name() { return name_; } + const char* get_cname() { return name_.c_str(); } + + AnyActivityImpl& set_tracing_category(const std::string& category) + { + tracing_category_ = category; + return static_cast(*this); + } + const std::string& get_tracing_category() { return tracing_category_; } +}; + } // namespace activity } // namespace kernel } // namespace simgrid diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index a8386198a0..a87836256e 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -424,6 +424,7 @@ CommImpl* CommImpl::start() surf_action_ = surf_network_model->communicate(sender, receiver, size_, rate_); surf_action_->set_data(this); + surf_action_->set_category(get_tracing_category()); state_ = SIMIX_RUNNING; XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", this, sender->get_cname(), diff --git a/src/kernel/activity/CommImpl.hpp b/src/kernel/activity/CommImpl.hpp index 481b16be3b..7369c983dd 100644 --- a/src/kernel/activity/CommImpl.hpp +++ b/src/kernel/activity/CommImpl.hpp @@ -15,7 +15,7 @@ namespace simgrid { namespace kernel { namespace activity { -class XBT_PUBLIC CommImpl : public ActivityImpl { +class XBT_PUBLIC CommImpl : public ActivityImpl_T { ~CommImpl() override; void cleanupSurf(); diff --git a/src/kernel/activity/ExecImpl.cpp b/src/kernel/activity/ExecImpl.cpp index 07b3c4eb81..928c959909 100644 --- a/src/kernel/activity/ExecImpl.cpp +++ b/src/kernel/activity/ExecImpl.cpp @@ -72,18 +72,6 @@ ExecImpl& ExecImpl::set_hosts(const std::vector& hosts) return *this; } -ExecImpl& ExecImpl::set_name(const std::string& name) -{ - ActivityImpl::set_name(name); - return *this; -} - -ExecImpl& ExecImpl::set_tracing_category(const std::string& category) -{ - ActivityImpl::set_category(category); - return *this; -} - ExecImpl& ExecImpl::set_timeout(double timeout) { if (timeout > 0 && not MC_is_active() && not MC_record_replay_is_active()) { @@ -121,6 +109,8 @@ ExecImpl* ExecImpl::start() if (hosts_.size() == 1) { surf_action_ = hosts_.front()->pimpl_cpu->execution_start(flops_amounts_.front()); surf_action_->set_priority(priority_); + surf_action_->set_category(get_tracing_category()); + if (bound_ > 0) surf_action_->set_bound(bound_); } else { diff --git a/src/kernel/activity/ExecImpl.hpp b/src/kernel/activity/ExecImpl.hpp index 80d25bdd63..7930636ffa 100644 --- a/src/kernel/activity/ExecImpl.hpp +++ b/src/kernel/activity/ExecImpl.hpp @@ -14,7 +14,7 @@ namespace simgrid { namespace kernel { namespace activity { -class XBT_PUBLIC ExecImpl : public ActivityImpl { +class XBT_PUBLIC ExecImpl : public ActivityImpl_T { resource::Action* timeout_detector_ = nullptr; double priority_ = 1.0; double bound_ = 0.0; @@ -24,8 +24,6 @@ class XBT_PUBLIC ExecImpl : public ActivityImpl { ~ExecImpl(); public: - ExecImpl& set_name(const std::string& name); - ExecImpl& set_tracing_category(const std::string& category); ExecImpl& set_timeout(double timeout); ExecImpl& set_bound(double bound); ExecImpl& set_priority(double priority); diff --git a/src/kernel/activity/IoImpl.cpp b/src/kernel/activity/IoImpl.cpp index e24fe2385b..ebabea1abf 100644 --- a/src/kernel/activity/IoImpl.cpp +++ b/src/kernel/activity/IoImpl.cpp @@ -37,12 +37,6 @@ namespace simgrid { namespace kernel { namespace activity { -IoImpl& IoImpl::set_name(const std::string& name) -{ - ActivityImpl::set_name(name); - return *this; -} - IoImpl& IoImpl::set_type(s4u::Io::OpType type) { type_ = type; diff --git a/src/kernel/activity/IoImpl.hpp b/src/kernel/activity/IoImpl.hpp index 102b691bfe..ed8cf3e3c5 100644 --- a/src/kernel/activity/IoImpl.hpp +++ b/src/kernel/activity/IoImpl.hpp @@ -14,14 +14,13 @@ namespace simgrid { namespace kernel { namespace activity { -class XBT_PUBLIC IoImpl : public ActivityImpl { +class XBT_PUBLIC IoImpl : public ActivityImpl_T { resource::StorageImpl* storage_ = nullptr; sg_size_t size_ = 0; s4u::Io::OpType type_ = s4u::Io::OpType::READ; sg_size_t performed_ioops_ = 0; public: - IoImpl& set_name(const std::string& name); IoImpl& set_size(sg_size_t size); IoImpl& set_type(s4u::Io::OpType type); IoImpl& set_storage(resource::StorageImpl* storage); diff --git a/src/kernel/activity/SleepImpl.cpp b/src/kernel/activity/SleepImpl.cpp index 3072fb9ac3..e8b04ddb21 100644 --- a/src/kernel/activity/SleepImpl.cpp +++ b/src/kernel/activity/SleepImpl.cpp @@ -18,12 +18,6 @@ namespace simgrid { namespace kernel { namespace activity { -SleepImpl& SleepImpl::set_name(const std::string& name) -{ - ActivityImpl::set_name(name); - return *this; -} - SleepImpl& SleepImpl::set_host(s4u::Host* host) { host_ = host; diff --git a/src/kernel/activity/SleepImpl.hpp b/src/kernel/activity/SleepImpl.hpp index a4d75b02b1..ec5c9e271f 100644 --- a/src/kernel/activity/SleepImpl.hpp +++ b/src/kernel/activity/SleepImpl.hpp @@ -13,12 +13,11 @@ namespace simgrid { namespace kernel { namespace activity { -class XBT_PUBLIC SleepImpl : public ActivityImpl { +class XBT_PUBLIC SleepImpl : public ActivityImpl_T { sg_host_t host_ = nullptr; double duration_ = 0; public: - SleepImpl& set_name(const std::string& name); SleepImpl& set_host(s4u::Host* host); SleepImpl& set_duration(double duration); void post() override; diff --git a/src/kernel/activity/SynchroRaw.hpp b/src/kernel/activity/SynchroRaw.hpp index a1d4ca3fc3..d11a996443 100644 --- a/src/kernel/activity/SynchroRaw.hpp +++ b/src/kernel/activity/SynchroRaw.hpp @@ -14,7 +14,7 @@ namespace kernel { namespace activity { /** Used to implement mutexes, semaphores and conditions */ -class XBT_PUBLIC RawImpl : public ActivityImpl { +class XBT_PUBLIC RawImpl : public ActivityImpl_T { sg_host_t host_ = nullptr; double timeout_ = -1; diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index b0d47c3289..3f6377734c 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -226,8 +226,7 @@ void ActorImpl::exit() io->cancel(); } else { simgrid::kernel::activity::ActivityImplPtr activity = waiting_synchro; - xbt_die("Activity %s is of unknown type %s", activity->get_cname(), - simgrid::xbt::demangle(typeid(activity).name()).get()); + xbt_die("Activity is of unknown type %s", simgrid::xbt::demangle(typeid(activity).name()).get()); } waiting_synchro = nullptr; diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index 786ebea5e0..188990ba13 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -111,6 +111,9 @@ s4u::CommPtr Task::send_async(const std::string& alias, void_f_pvoid_t cleanup, msg_global->sent_msg++; s4u::CommPtr s4u_comm = s4u::Mailbox::by_name(alias)->put_init(this, bytes_amount)->set_rate(get_rate()); + if (TRACE_is_enabled() && has_tracing_category()) + s4u_comm->set_tracing_category(tracing_category_); + comm = s4u_comm; if (detached) @@ -118,9 +121,6 @@ s4u::CommPtr Task::send_async(const std::string& alias, void_f_pvoid_t cleanup, else comm->start(); - if (TRACE_is_enabled() && has_tracing_category()) - simgrid::simix::simcall([this] { comm->get_impl()->set_category(std::move(tracing_category_)); }); - return comm; } diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index d8c952b3c7..f119c5aff8 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -106,6 +106,13 @@ CommPtr Comm::set_dst_data(void** buff, size_t size) return this; } +CommPtr Comm::set_tracing_category(const std::string& category) +{ + xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start"); + tracing_category_ = category; + return this; +} + Comm* Comm::start() { xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)", diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index b44d2c8648..4a300d811c 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -569,6 +569,11 @@ void SIMIX_display_process_status() if (process->waiting_synchro) { const char* synchro_description = "unknown"; + // we don't care about the Activity type to get its name, use RawImpl + const char* name = + boost::static_pointer_cast>( + process->waiting_synchro) + ->get_cname(); if (boost::dynamic_pointer_cast(process->waiting_synchro) != nullptr) synchro_description = "execution"; @@ -587,8 +592,7 @@ void SIMIX_display_process_status() XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->get_pid(), process->get_cname(), process->get_host()->get_cname(), synchro_description, - process->waiting_synchro.get(), process->waiting_synchro->get_cname(), - (int)process->waiting_synchro->state_); + process->waiting_synchro.get(), name, (int)process->waiting_synchro->state_); } else { XBT_INFO("Process %ld (%s@%s)", process->get_pid(), process->get_cname(), process->get_host()->get_cname()); diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 47b37fea93..93ba3fabb2 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -490,8 +490,8 @@ void Request::start() /* FIXME: detached sends are not traceable (action_ == nullptr) */ if (action_ != nullptr) { - std::string category = smpi_process()->get_tracing_category(); - simgrid::simix::simcall([this, category] { this->action_->set_category(category); }); + boost::static_pointer_cast(action_)->set_tracing_category( + smpi_process()->get_tracing_category()); } if (async_small_thresh != 0 || ((flags_ & MPI_REQ_RMA) != 0)) -- 2.20.1