mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-16 12:54:50 +01:00
Refactor to wrap everything in main function into scope, to ensure DHT is freed before MPI_FInalize
This commit is contained in:
parent
b5dedb3422
commit
4784fc3e12
20
src/poet.cpp
20
src/poet.cpp
@ -340,6 +340,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
MPI_Init(&argc, &argv);
|
||||
|
||||
{
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &MY_RANK);
|
||||
|
||||
@ -386,16 +387,7 @@ int main(int argc, char *argv[]) {
|
||||
if (MY_RANK > 0) {
|
||||
|
||||
chemistry.WorkerLoop();
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
|
||||
MSG("finished, cleanup of process " + std::to_string(MY_RANK));
|
||||
|
||||
MPI_Finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
} else {
|
||||
// R.parseEvalQ("mysetup <- setup");
|
||||
// // if (MY_RANK == 0) { // get timestep vector from
|
||||
// // grid_init function ... //
|
||||
@ -436,13 +428,15 @@ int main(int argc, char *argv[]) {
|
||||
r_vis_code = "saveRDS(profiling, file=paste0(fileout,'/timings.rds'));";
|
||||
R.parseEval(r_vis_code);
|
||||
|
||||
// MSG("Done! Results are stored as R objects into <" + run_params.getOutDir()
|
||||
// MSG("Done! Results are stored as R objects into <" +
|
||||
// run_params.getOutDir()
|
||||
// +
|
||||
// "/timings.rds>");
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
}
|
||||
}
|
||||
|
||||
MSG("finished, cleanup of process " + std::to_string(MY_RANK));
|
||||
|
||||
MPI_Finalize();
|
||||
|
||||
if (MY_RANK == 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user