X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0dc10aaf6accd03c5b68e8ff178f6aa843e84c85..c9e14224862bdfbb1c7cfc4b96748aa23872df1b:/src/smpi/smpi_base.c diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 2bb5b8c15c..cc9e4097d8 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -260,8 +260,8 @@ void smpi_action_trace_run(char *path) action_fp=NULL; if (path) { action_fp = fopen(path, "r"); - xbt_assert(action_fp != NULL, "Cannot open %s: %s", path, - strerror(errno)); + if (action_fp == NULL) + xbt_die("Cannot open %s: %s", path, strerror(errno)); } if (!xbt_dict_is_empty(action_queues)) { @@ -335,7 +335,7 @@ void smpi_mpi_start(MPI_Request request) smpi_datatype_use(request->old_type); smpi_comm_use(request->comm); request->action = simcall_comm_irecv(mailbox, request->buf, - &request->real_size, &match_recv, + &request->real_size, &match_recv, &smpi_comm_copy_buffer_callback, request, -1.0); //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0 @@ -367,6 +367,8 @@ void smpi_mpi_start(MPI_Request request) XBT_DEBUG("Send request %p is not in the permanent receive mailbox (buf: %p)",request,request->buf); mailbox = smpi_process_remote_mailbox(receiver); } + + void* buf = request->buf; if ( (! (request->flags & SSEND)) && (request->size < sg_cfg_get_int("smpi/send_is_detached_thres"))) { void *oldbuf = NULL; request->detached = 1; @@ -374,8 +376,14 @@ void smpi_mpi_start(MPI_Request request) if(request->old_type->has_subtype == 0){ oldbuf = request->buf; if (!_xbt_replay_is_active() && oldbuf && request->size!=0){ - request->buf = xbt_malloc(request->size); - memcpy(request->buf,oldbuf,request->size); + if((smpi_privatize_global_variables) + && ((char*)request->buf >= start_data_exe) + && ((char*)request->buf < start_data_exe + size_data_exe )){ + XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment "); + switch_data_segment(smpi_process_index()); + } + buf = xbt_malloc(request->size); + memcpy(buf,oldbuf,request->size); } } XBT_DEBUG("Send request %p is detached; buf %p copied into %p",request,oldbuf,request->buf); @@ -387,22 +395,23 @@ void smpi_mpi_start(MPI_Request request) smpi_comm_use(request->comm); //if we are giving back the control to the user without waiting for completion, we have to inject timings - double sleeptime =0.0; + double sleeptime = 0.0; if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend //isend and send timings may be different sleeptime = (request->flags & ISEND)? smpi_ois(request->size) : smpi_os(request->size); } - if(sleeptime!=0.0){ + if(sleeptime != 0.0){ simcall_process_sleep(sleeptime); XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size)); } request->action = simcall_comm_isend(mailbox, request->size, -1.0, - request->buf, request->real_size, + buf, request->real_size, &match_send, &xbt_free, // how to free the userdata if a detached send fails + &smpi_comm_copy_buffer_callback, request, // detach if msg size < eager/rdv switch limit request->detached); @@ -585,6 +594,15 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) MPI_Datatype datatype = req->old_type; if(datatype->has_subtype == 1){ + if (!_xbt_replay_is_active()){ + if( smpi_privatize_global_variables + && ((char*)req->old_buf >= start_data_exe) + && ((char*)req->old_buf < start_data_exe + size_data_exe ) + ){ + XBT_VERB("Privatization : We are unserializing to a zone in global memory - Switch data segment "); + switch_data_segment(smpi_process_index()); + } + } // This part handles the problem of non-contignous memory // the unserialization at the reception s_smpi_subtype_t *subtype = datatype->substruct; @@ -772,7 +790,7 @@ void smpi_mpi_wait(MPI_Request * request, MPI_Status * status) if ((*request)->action != NULL) { // this is not a detached send simcall_comm_wait((*request)->action, -1.0); #ifdef HAVE_MC - if(MC_is_active()) + if(MC_is_active() && (*request)->action) (*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to NULL for system state comparison #endif }