Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix MPI_Type_dup for derived datatypes.
[simgrid.git] / src / smpi / mpi / smpi_request.cpp
index 18173a3..b12e4b0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2020. 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. */
@@ -376,7 +376,7 @@ void Request::start()
       mailbox = process->mailbox_small();
       XBT_DEBUG("Is there a corresponding send already posted in the small mailbox %s (in case of SSEND)?",
                 mailbox->get_cname());
-      smx_activity_t action = mailbox->iprobe(0, &match_recv, static_cast<void*>(this));
+      simgrid::kernel::activity::ActivityImplPtr action = mailbox->iprobe(0, &match_recv, static_cast<void*>(this));
 
       if (action == nullptr) {
         mailbox = process->mailbox();
@@ -392,7 +392,7 @@ void Request::start()
     } else {
       mailbox = process->mailbox_small();
       XBT_DEBUG("Is there a corresponding send already posted the small mailbox?");
-      smx_activity_t action = mailbox->iprobe(0, &match_recv, static_cast<void*>(this));
+      simgrid::kernel::activity::ActivityImplPtr action = mailbox->iprobe(0, &match_recv, static_cast<void*>(this));
 
       if (action == nullptr) {
         XBT_DEBUG("No, nothing in the permanent receive mailbox");
@@ -470,7 +470,7 @@ void Request::start()
     } else if (((flags_ & MPI_REQ_RMA) != 0) || static_cast<int>(size_) < smpi_cfg_async_small_thresh()) { // eager mode
       mailbox = process->mailbox();
       XBT_DEBUG("Is there a corresponding recv already posted in the large mailbox %s?", mailbox->get_cname());
-      smx_activity_t action = mailbox->iprobe(1, &match_send, static_cast<void*>(this));
+      simgrid::kernel::activity::ActivityImplPtr action = mailbox->iprobe(1, &match_send, static_cast<void*>(this));
       if (action == nullptr) {
         if ((flags_ & MPI_REQ_SSEND) == 0) {
           mailbox = process->mailbox_small();
@@ -496,8 +496,9 @@ 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_;
+    size_t payload_size_ = size_ + 16;//MPI enveloppe size (tag+dest+communicator)
     action_   = simcall_comm_isend(
-        simgrid::s4u::Actor::by_pid(src_)->get_impl(), mailbox->get_impl(), size_, -1.0, buf, real_size_, &match_send,
+        simgrid::s4u::Actor::by_pid(src_)->get_impl(), mailbox->get_impl(), payload_size_, -1.0, buf, real_size_, &match_send,
         &xbt_free_f, // how to free the userdata if a detached send fails
         process->replaying() ? &smpi_comm_null_copy_buffer_callback : smpi_comm_copy_data_callback, this,
         // detach if msg size < eager/rdv switch limit
@@ -562,7 +563,7 @@ int Request::test(MPI_Request * request, MPI_Status * status, int* flag) {
   if (((*request)->flags_ & MPI_REQ_PREPARED) == 0) {
     if ((*request)->action_ != nullptr && (*request)->cancelled_ != 1){
       try{
-        *flag = simcall_comm_test((*request)->action_);
+        *flag = simcall_comm_test((*request)->action_.get());
       } catch (const Exception&) {
         *flag = 0;
         return ret;
@@ -917,7 +918,7 @@ int Request::wait(MPI_Request * request, MPI_Status * status)
   if ((*request)->action_ != nullptr){
       try{
         // this is not a detached send
-        simcall_comm_wait((*request)->action_, -1.0);
+        simcall_comm_wait((*request)->action_.get(), -1.0);
       } catch (const Exception&) {
         XBT_VERB("Request cancelled");
       }