X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0ec122a780b6dd27347cca4d240de563e607f349..66c32fe92919cf7ca8ad796794f79bc647bffe1e:/src/smpi/smpi_base.cpp diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index d9ae5eefa1..687a6d83ed 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -126,7 +126,7 @@ static xbt_dynar_t parse_factor(const char *smpi_coef_string) static double smpi_os(double size) { if (!smpi_os_values) { - smpi_os_values = parse_factor(sg_cfg_get_string("smpi/os")); + smpi_os_values = parse_factor(xbt_cfg_get_string("smpi/os")); smpi_register_static(smpi_os_values, xbt_dynar_free_voidp); } unsigned int iter = 0; @@ -155,7 +155,7 @@ static double smpi_os(double size) static double smpi_ois(double size) { if (!smpi_ois_values) { - smpi_ois_values = parse_factor(sg_cfg_get_string("smpi/ois")); + smpi_ois_values = parse_factor(xbt_cfg_get_string("smpi/ois")); smpi_register_static(smpi_ois_values, xbt_dynar_free_voidp); } unsigned int iter = 0; @@ -182,7 +182,7 @@ static double smpi_ois(double size) static double smpi_or(double size) { if (!smpi_or_values) { - smpi_or_values = parse_factor(sg_cfg_get_string("smpi/or")); + smpi_or_values = parse_factor(xbt_cfg_get_string("smpi/or")); smpi_register_static(smpi_or_values, xbt_dynar_free_voidp); } unsigned int iter = 0; @@ -237,11 +237,11 @@ static MPI_Request build_request(void *buf, int count, MPI_Datatype datatype, in s_smpi_subtype_t *subtype = static_cast(datatype->substruct); - if(((flags & RECV) && (flags & ACCUMULATE)) || (datatype->has_subtype == 1)){ + if(((flags & RECV) && (flags & ACCUMULATE)) || (datatype->sizeof_substruct != 0)){ // This part handles the problem of non-contiguous memory old_buf = buf; buf = count==0 ? NULL : xbt_malloc(count*smpi_datatype_size(datatype)); - if ((datatype->has_subtype == 1) && (flags & SEND)) { + if ((datatype->sizeof_substruct != 0) && (flags & SEND)) { subtype->serialize(old_buf, buf, count, datatype->substruct); } } @@ -272,7 +272,7 @@ static MPI_Request build_request(void *buf, int count, MPI_Datatype datatype, in request->op = MPI_REPLACE; request->send = 0; request->recv = 0; - if (flags & SEND) smpi_datatype_unuse(datatype); + // if (flags & SEND) smpi_datatype_unuse(datatype); return request; } @@ -334,7 +334,7 @@ void smpi_mpi_start(MPI_Request request) if (request->flags & RECV) { print_request("New recv", request); - int async_small_thresh = sg_cfg_get_int("smpi/async_small_thresh"); + int async_small_thresh = xbt_cfg_get_int("smpi/async_small_thresh"); xbt_mutex_t mut = smpi_process_mailboxes_mutex(); if (async_small_thresh != 0 ||request->flags & RMA) @@ -412,7 +412,7 @@ void smpi_mpi_start(MPI_Request request) XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size)); } - int async_small_thresh = sg_cfg_get_int("smpi/async_small_thresh"); + int async_small_thresh = xbt_cfg_get_int("smpi/async_small_thresh"); xbt_mutex_t mut=smpi_process_remote_mailboxes_mutex(receiver); @@ -448,13 +448,13 @@ void smpi_mpi_start(MPI_Request request) } void* buf = request->buf; - if ( (! (request->flags & SSEND)) && - (static_cast(request->size) < sg_cfg_get_int("smpi/send_is_detached_thresh"))) { + if ( (! (request->flags & SSEND)) && ((request->flags & RMA) || + (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->has_subtype == 0){ + if(request->old_type->sizeof_substruct == 0){ oldbuf = request->buf; if (!smpi_process_get_replaying() && oldbuf && request->size!=0){ if((smpi_privatize_global_variables) @@ -671,7 +671,7 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) print_request("Finishing", req); MPI_Datatype datatype = req->old_type; - if((req->flags & ACCUMULATE) || (datatype->has_subtype == 1)){ + if((req->flags & ACCUMULATE) || (datatype->sizeof_substruct != 0)){ if (!smpi_process_get_replaying()){ if( smpi_privatize_global_variables && ((char*)req->old_buf >= smpi_start_data_exe) && ((char*)req->old_buf < smpi_start_data_exe + smpi_size_data_exe )){ @@ -680,7 +680,7 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) } } - if(datatype->has_subtype == 1){ + if(datatype->sizeof_substruct != 0){ // This part handles the problem of non-contignous memory the unserialization at the reception s_smpi_subtype_t *subtype = static_cast(datatype->substruct); if(req->flags & RECV) @@ -693,7 +693,7 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) } } smpi_comm_unuse(req->comm); - smpi_datatype_unuse(datatype); + smpi_datatype_unuse(req->old_type); } if (TRACE_smpi_view_internals()) { @@ -705,6 +705,8 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) } if(req->detached_sender!=NULL){ + smpi_datatype_unuse(req->detached_sender->old_type); + smpi_comm_unuse(req->detached_sender->comm); smpi_mpi_request_free(&(req->detached_sender)); } if(req->flags & PERSISTENT) @@ -836,7 +838,7 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* print_request("New iprobe", request); // We have to test both mailboxes as we don't know if we will receive one one or another - if (sg_cfg_get_int("smpi/async_small_thresh")>0){ + if (xbt_cfg_get_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, request->src, request->tag, &match_recv, (void*)request); @@ -1085,7 +1087,7 @@ void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_ { int i, size, count; int *displs; - int rank = smpi_process_index(); + int rank = smpi_comm_rank(comm); void *tmpbuf; /* arbitrarily choose root as rank 0 */