Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[smpi] s4u processes are actors
[simgrid.git] / src / smpi / mpi / smpi_request.cpp
index 3b4f02d..7ba5935 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "smpi_request.hpp"
 
-#include "SmpiHost.hpp"
+#include "smpi_host.hpp"
 #include "mc/mc.h"
 #include "private.hpp"
 #include "smpi_comm.hpp"
@@ -358,7 +358,7 @@ void Request::start()
 
     simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_));
 
-    int async_small_thresh = simgrid::config::get_config<int>("smpi/async-small-thresh");
+    int async_small_thresh = simgrid::config::get_value<int>("smpi/async-small-thresh");
 
     xbt_mutex_t mut = process->mailboxes_mutex();
     if (async_small_thresh != 0 || (flags_ & RMA) != 0)
@@ -401,7 +401,7 @@ void Request::start()
     // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
     real_size_=size_;
     action_   = simcall_comm_irecv(
-        process->process()->get_impl(), mailbox, buf_, &real_size_, &match_recv,
+        process->get_actor()->get_impl(), mailbox, buf_, &real_size_, &match_recv,
         process->replaying() ? &smpi_comm_null_copy_buffer_callback : smpi_comm_copy_data_callback, this, -1.0);
     XBT_DEBUG("recv simcall posted");
 
@@ -418,7 +418,7 @@ void Request::start()
     void* buf = buf_;
     if ((flags_ & SSEND) == 0 &&
         ((flags_ & RMA) != 0 ||
-         static_cast<int>(size_) < simgrid::config::get_config<int>("smpi/send-is-detached-thresh"))) {
+         static_cast<int>(size_) < simgrid::config::get_value<int>("smpi/send-is-detached-thresh"))) {
       void *oldbuf = nullptr;
       detached_ = 1;
       XBT_DEBUG("Send request %p is detached", this);
@@ -444,8 +444,8 @@ void Request::start()
     if (detached_ != 0 || ((flags_ & (ISEND | SSEND)) != 0)) { // issend should be treated as isend
       // isend and send timings may be different
       sleeptime = ((flags_ & ISEND) != 0)
-                      ? simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::SmpiHost>()->oisend(size_)
-                      : simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::SmpiHost>()->osend(size_);
+                      ? simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::Host>()->oisend(size_)
+                      : simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::Host>()->osend(size_);
     }
 
     if(sleeptime > 0.0){
@@ -453,7 +453,7 @@ void Request::start()
       XBT_DEBUG("sending size of %zu : sleep %f ", size_, sleeptime);
     }
 
-    int async_small_thresh = simgrid::config::get_config<int>("smpi/async-small-thresh");
+    int async_small_thresh = simgrid::config::get_value<int>("smpi/async-small-thresh");
 
     xbt_mutex_t mut=process->mailboxes_mutex();
 
@@ -548,7 +548,7 @@ int Request::test(MPI_Request * request, MPI_Status * status) {
       nsleeps=1;//reset the number of sleeps we will do next time
       if (*request != MPI_REQUEST_NULL && ((*request)->flags_ & PERSISTENT) == 0)
         *request = MPI_REQUEST_NULL;
-    } else if (simgrid::config::get_config<bool>("smpi/grow-injected-times")) {
+    } else if (simgrid::config::get_value<bool>("smpi/grow-injected-times")) {
       nsleeps++;
     }
   }
@@ -668,14 +668,14 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   // This can speed up the execution of certain applications by an order of magnitude, such as HPL
   static int nsleeps = 1;
   double speed        = simgrid::s4u::Actor::self()->get_host()->getSpeed();
-  double maxrate = xbt_cfg_get_double("smpi/iprobe-cpu-usage");
+  double maxrate      = simgrid::config::get_value<double>("smpi/iprobe-cpu-usage");
   MPI_Request request = new Request(nullptr, 0, MPI_CHAR,
                                     source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->get_pid(),
                                     simgrid::s4u::this_actor::get_pid(), tag, comm, PERSISTENT | RECV);
   if (smpi_iprobe_sleep > 0) {
     smx_activity_t iprobe_sleep = simcall_execution_start(
         "iprobe", /* flops to executek*/ nsleeps * smpi_iprobe_sleep * speed * maxrate, /* priority */ 1.0,
-        /* performance bound */ maxrate * speed, smpi_process()->process()->get_impl()->host);
+        /* performance bound */ maxrate * speed, smpi_process()->get_actor()->get_host());
     simcall_execution_wait(iprobe_sleep);
   }
   // behave like a receive, but don't do it
@@ -683,7 +683,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
 
   request->print_request("New iprobe");
   // We have to test both mailboxes as we don't know if we will receive one one or another
-  if (simgrid::config::get_config<int>("smpi/async-small-thresh") > 0) {
+  if (simgrid::config::get_value<int>("smpi/async-small-thresh") > 0) {
     mailbox = smpi_process()->mailbox_small();
     XBT_DEBUG("Trying to probe the perm recv mailbox");
     request->action_ = simcall_comm_iprobe(mailbox, 0, &match_recv, static_cast<void*>(request));
@@ -710,7 +710,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   }
   else {
     *flag = 0;
-    if (simgrid::config::get_config<bool>("smpi/grow-injected-times"))
+    if (simgrid::config::get_value<bool>("smpi/grow-injected-times"))
       nsleeps++;
   }
   unref(&request);
@@ -774,7 +774,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
   if(req->detached_sender_ != nullptr){
     //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
     double sleeptime =
-        simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::SmpiHost>()->orecv(req->real_size());
+        simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::Host>()->orecv(req->real_size());
     if(sleeptime > 0.0){
       simcall_process_sleep(sleeptime);
       XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);