From 06a801de9f0c069a4198d071d57fcaf408e6f1e3 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Wed, 8 Jun 2016 15:46:44 +0200 Subject: [PATCH] [SMPI] Fix missing timings for MPI_Send. Timings were never injected for MPI_Send since request->detached was only set to something != 0 after the timings were already injected. I therefore moved the block that computes this value up. See also 825ad35c811f --- src/smpi/smpi_base.cpp | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 6766e4a176..fc2a0b0260 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -423,6 +423,29 @@ void smpi_mpi_start(MPI_Request request) } print_request("New send", request); + void* buf = request->buf; + if ( (request->flags & SSEND) == 0 + && ( (request->flags & RMA) != 0 || static_cast(request->size) < xbt_cfg_get_int("smpi/send-is-detached-thresh") ) ) { + void *oldbuf = NULL; + request->detached = 1; + XBT_DEBUG("Send request %p is detached", request); + request->refcount++; + if(request->old_type->sizeof_substruct == 0){ + oldbuf = request->buf; + if (!smpi_process_get_replaying() && oldbuf != NULL && request->size!=0){ + if((smpi_privatize_global_variables != 0) + && (static_cast(request->buf) >= smpi_start_data_exe) + && (static_cast(request->buf) < smpi_start_data_exe + smpi_size_data_exe )){ + XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment "); + smpi_switch_data_segment(request->src); + } + buf = xbt_malloc(request->size); + memcpy(buf,oldbuf,request->size); + XBT_DEBUG("buf %p copied into %p",oldbuf,buf); + } + } + } + //if we are giving back the control to the user without waiting for completion, we have to inject timings double sleeptime = 0.0; if(request->detached != 0 || ((request->flags & (ISEND|SSEND)) != 0)){// issend should be treated as isend @@ -473,29 +496,6 @@ void smpi_mpi_start(MPI_Request request) XBT_DEBUG("Send request %p is in the large mailbox %p (buf: %p)",mailbox, request,request->buf); } - void* buf = request->buf; - if ( (request->flags & SSEND) == 0 - && ( (request->flags & RMA) != 0 || static_cast(request->size) < xbt_cfg_get_int("smpi/send-is-detached-thresh") ) ) { - void *oldbuf = NULL; - request->detached = 1; - XBT_DEBUG("Send request %p is detached", request); - request->refcount++; - if(request->old_type->sizeof_substruct == 0){ - oldbuf = request->buf; - if (!smpi_process_get_replaying() && oldbuf != NULL && request->size!=0){ - if((smpi_privatize_global_variables != 0) - && (static_cast(request->buf) >= smpi_start_data_exe) - && (static_cast(request->buf) < smpi_start_data_exe + smpi_size_data_exe )){ - XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment "); - smpi_switch_data_segment(request->src); - } - buf = xbt_malloc(request->size); - memcpy(buf,oldbuf,request->size); - XBT_DEBUG("buf %p copied into %p",oldbuf,buf); - } - } - } - // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later request->real_size=request->size; request->action = simcall_comm_isend(SIMIX_process_from_PID(request->src+1), mailbox, request->size, -1.0, -- 2.20.1