From b4bb065ce3dec478d2a2d7101cefc5f5faade084 Mon Sep 17 00:00:00 2001 From: Volker Springel <volker.springel@h-its.org> Date: Wed, 23 Dec 2020 17:05:02 +0100 Subject: [PATCH] added an update of the All-structure on the shared memory handler in begrun2() also in cases comoving integration is not used --- src/main/begrun.cc | 4 ++++ src/mpi_utils/mpi_utils.h | 1 + src/mpi_utils/shared_mem_handler.cc | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/src/main/begrun.cc b/src/main/begrun.cc index 916b06f..486d581 100644 --- a/src/main/begrun.cc +++ b/src/main/begrun.cc @@ -318,6 +318,10 @@ void sim::begrun2(void) All.FlushLast = Logs.CPUThisRun; #endif + // update All on shared memory handler, just to allow it to access its elements if needed + if(Shmem.Island_NTask != Shmem.World_NTask && Shmem.Island_ThisTask == 0) + MPI_Send(All.get_data_ptr(), All.get_data_size(), MPI_BYTE, Shmem.MyShmRankInGlobal, TAG_ALL_UPDATE, MPI_COMM_WORLD); + #if defined(FORCETEST) && defined(FORCETEST_TESTFORCELAW) gravity_forcetest_testforcelaw(); #endif diff --git a/src/mpi_utils/mpi_utils.h b/src/mpi_utils/mpi_utils.h index f62434c..f205155 100644 --- a/src/mpi_utils/mpi_utils.h +++ b/src/mpi_utils/mpi_utils.h @@ -97,6 +97,7 @@ #define TAG_NODE_DATA 84 #define TAG_RESULTS 85 #define TAG_DRIFT_INIT 86 +#define TAG_ALL_UPDATE 87 #define TAG_METDATA 500 #define TAG_FETCH_GRAVTREE 1000 #define TAG_FETCH_SPH_DENSITY 2000 diff --git a/src/mpi_utils/shared_mem_handler.cc b/src/mpi_utils/shared_mem_handler.cc index ee9edfd..2bc5042 100644 --- a/src/mpi_utils/shared_mem_handler.cc +++ b/src/mpi_utils/shared_mem_handler.cc @@ -200,6 +200,11 @@ void shmem::shared_memory_handler(void) Mem.myfree(message); Driftfac.init_drift_table(); } + else if(tag == TAG_ALL_UPDATE) // make the shared memory handler update the contents of the All structure + { + memcpy(All.get_data_ptr(), message, All.get_data_size()); + Mem.myfree(message); + } } } -- GitLab