A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finally fix memleak.
[simgrid.git]
/
src
/
smpi
/
internals
/
smpi_global.cpp
diff --git
a/src/smpi/internals/smpi_global.cpp
b/src/smpi/internals/smpi_global.cpp
index
fa1605b
..
4a7ef4f
100644
(file)
--- a/
src/smpi/internals/smpi_global.cpp
+++ b/
src/smpi/internals/smpi_global.cpp
@@
-84,12
+84,6
@@
static simgrid::config::Flag<double> smpi_init_sleep(
void (*smpi_comm_copy_data_callback) (smx_activity_t, void*, size_t) = &smpi_comm_copy_buffer_callback;
void (*smpi_comm_copy_data_callback) (smx_activity_t, void*, size_t) = &smpi_comm_copy_buffer_callback;
-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()
{
return process_count;
int smpi_process_count()
{
return process_count;
@@
-118,7
+112,7
@@
void smpi_process_init(int *argc, char ***argv){
}
int smpi_process_index(){
}
int smpi_process_index(){
- return s
mpi_process()->index
();
+ return s
imgrid::s4u::Actor::self()->getPid
();
}
void * smpi_process_get_user_data(){
}
void * smpi_process_get_user_data(){
@@
-197,9
+191,7
@@
void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
(static_cast<char*>(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 !");
(static_cast<char*>(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<simgrid::smpi::Process*>((static_cast<simgrid::msg::ActorExt*>(comm->src_proc->userdata)->data))
- ->index());
+ smpi_switch_data_segment(Actor::self()->getPid());
tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
memcpy_private(tmpbuff, buff, private_blocks);
}
tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
memcpy_private(tmpbuff, buff, private_blocks);
}
@@
-207,9
+199,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");
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<simgrid::smpi::Process*>((static_cast<simgrid::msg::ActorExt*>(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);
}
XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff);
memcpy_private(comm->dst_buff, tmpbuff, private_blocks);
@@
-362,8
+352,7
@@
void smpi_global_destroy()
if (process->comm_intra() != MPI_COMM_NULL) {
simgrid::smpi::Comm::destroy(process->comm_intra());
}
if (process->comm_intra() != MPI_COMM_NULL) {
simgrid::smpi::Comm::destroy(process->comm_intra());
}
- xbt_os_timer_free(process->timer());
- xbt_mutex_destroy(process->mailboxes_mutex());
+ delete process;
}
process_data.clear();
}
process_data.clear();
@@
-631,7
+620,7
@@
int smpi_main(const char* executable, int argc, char *argv[])
// Called either directly from the user code, or from the code called by smpirun
void SMPI_init(){
simgrid::s4u::Actor::onCreation.connect([](simgrid::s4u::ActorPtr actor) {
// Called either directly from the user code, or from the code called by smpirun
void SMPI_init(){
simgrid::s4u::Actor::onCreation.connect([](simgrid::s4u::ActorPtr actor) {
-
smpi_add_process(actor
);
+
process_data.insert({actor, new simgrid::smpi::Process(actor, nullptr)}
);
});
smpi_init_options();
smpi_global_init();
});
smpi_init_options();
smpi_global_init();