X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f685334597e6b8bcdfe353d69be908914eed4dd6..d53a2108a1ea38b2f952abb48c39730ccc91c2a8:/src/smpi/internals/smpi_global.cpp diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index fa1605beb0..5aade555a7 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -87,7 +87,6 @@ void (*smpi_comm_copy_data_callback) (smx_activity_t, void*, size_t) = &smpi_com void smpi_add_process(ActorPtr actor) { process_data.insert({actor, new simgrid::smpi::Process(actor, nullptr)}); - // smpi_deployment_register_process("master_mpi", 0, actor); } int smpi_process_count() @@ -118,7 +117,7 @@ void smpi_process_init(int *argc, char ***argv){ } int smpi_process_index(){ - return smpi_process()->index(); + return simgrid::s4u::Actor::self()->getPid(); } void * smpi_process_get_user_data(){ @@ -197,9 +196,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b (static_cast(buff) < smpi_data_exe_start + smpi_data_exe_size)) { XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !"); - smpi_switch_data_segment( - static_cast((static_cast(comm->src_proc->userdata)->data)) - ->index()); + smpi_switch_data_segment(Actor::self()->getPid()); tmpbuff = static_cast(xbt_malloc(buff_size)); memcpy_private(tmpbuff, buff, private_blocks); } @@ -207,9 +204,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b if ((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && ((char*)comm->dst_buff >= smpi_data_exe_start) && ((char*)comm->dst_buff < smpi_data_exe_start + smpi_data_exe_size)) { XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment"); - smpi_switch_data_segment( - static_cast((static_cast(comm->dst_proc->userdata)->data)) - ->index()); + smpi_switch_data_segment(Actor::self()->getPid()); } XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff); memcpy_private(comm->dst_buff, tmpbuff, private_blocks); @@ -633,6 +628,11 @@ void SMPI_init(){ simgrid::s4u::Actor::onCreation.connect([](simgrid::s4u::ActorPtr actor) { smpi_add_process(actor); }); + simgrid::s4u::Actor::onDestruction.connect([](simgrid::s4u::ActorPtr actor) { + delete process_data.at(actor); + process_data.erase(actor); + }); + smpi_init_options(); smpi_global_init(); smpi_check_options();