Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement CRTP in kernel::activity
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 2 Apr 2019 13:12:41 +0000 (15:12 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 2 Apr 2019 13:12:41 +0000 (15:12 +0200)
25 files changed:
examples/smpi/replay/replay-override-replayer.tesh
examples/smpi/replay/replay.tesh
examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed1.tesh
examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2.tesh
examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st.tesh
examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_noise.tesh
examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr.tesh
examples/smpi/replay_multiple_manual_deploy/replay_multiple_manual_mixed2_st_sr_noise.tesh
include/simgrid/s4u/Comm.hpp
src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/CommImpl.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/IoImpl.hpp
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/SleepImpl.hpp
src/kernel/activity/SynchroRaw.hpp
src/kernel/actor/ActorImpl.cpp
src/msg/msg_task.cpp
src/s4u/s4u_Comm.cpp
src/simix/smx_global.cpp
src/smpi/mpi/smpi_request.cpp

index 745104f..7d1feac 100644 (file)
@@ -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
index 92ab687..38496fd 100644 (file)
@@ -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
index 2c75648..793eaf6 100644 (file)
@@ -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')
index 8f3de7e..3e1221e 100644 (file)
@@ -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')
index b70b166..d67b84f 100644 (file)
@@ -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
index 5a94862..100b277 100644 (file)
@@ -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')
index 36484ff..8eaaa2e 100644 (file)
@@ -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')
index ed71229..d72130b 100644 (file)
@@ -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')
index 439bf65..d59fc2a 100644 (file)
@@ -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()  */
index f7f719c..d50f13c 100644 (file)
@@ -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<Activity> support:
 void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity)
 {
index 8fdd778..239ef1b 100644 (file)
@@ -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<smx_simcall_t> 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<void(ActivityImpl const&)> on_suspended;
   static xbt::signal<void(ActivityImpl const&)> on_resumed;
 };
+
+template <class AnyActivityImpl> 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<AnyActivityImpl&>(*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<AnyActivityImpl&>(*this);
+  }
+  const std::string& get_tracing_category() { return tracing_category_; }
+};
+
 } // namespace activity
 } // namespace kernel
 } // namespace simgrid
index a838619..a878362 100644 (file)
@@ -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(),
index 481b16b..7369c98 100644 (file)
@@ -15,7 +15,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-class XBT_PUBLIC CommImpl : public ActivityImpl {
+class XBT_PUBLIC CommImpl : public ActivityImpl_T<CommImpl> {
   ~CommImpl() override;
   void cleanupSurf();
 
index 07b3c4e..928c959 100644 (file)
@@ -72,18 +72,6 @@ ExecImpl& ExecImpl::set_hosts(const std::vector<s4u::Host*>& 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 {
index 80d25bd..7930636 100644 (file)
@@ -14,7 +14,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-class XBT_PUBLIC ExecImpl : public ActivityImpl {
+class XBT_PUBLIC ExecImpl : public ActivityImpl_T<ExecImpl> {
   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);
index e24fe23..ebabea1 100644 (file)
@@ -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;
index 102b691..ed8cf3e 100644 (file)
@@ -14,14 +14,13 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-class XBT_PUBLIC IoImpl : public ActivityImpl {
+class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
   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);
index 3072fb9..e8b04dd 100644 (file)
@@ -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;
index a4d75b0..ec5c9e2 100644 (file)
@@ -13,12 +13,11 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-class XBT_PUBLIC SleepImpl : public ActivityImpl {
+class XBT_PUBLIC SleepImpl : public ActivityImpl_T<SleepImpl> {
   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;
index a1d4ca3..d11a996 100644 (file)
@@ -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<RawImpl> {
   sg_host_t host_ = nullptr;
   double timeout_ = -1;
 
index b0d47c3..3f63777 100644 (file)
@@ -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;
index 786ebea..188990b 100644 (file)
@@ -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;
 }
 
index d8c952b..f119c5a 100644 (file)
@@ -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)",
index b44d2c8..4a300d8 100644 (file)
@@ -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<simgrid::kernel::activity::ActivityImpl_T<simgrid::kernel::activity::RawImpl>>(
+              process->waiting_synchro)
+              ->get_cname();
 
       if (boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(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());
index 47b37fe..93ba3fa 100644 (file)
@@ -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<kernel::activity::CommImpl>(action_)->set_tracing_category(
+          smpi_process()->get_tracing_category());
     }
 
     if (async_small_thresh != 0 || ((flags_ & MPI_REQ_RMA) != 0))