From c2e5f5788fb6415942a0c682f8ac801e45479d9c Mon Sep 17 00:00:00 2001 From: Alan Gray Date: Tue, 29 Oct 2019 02:03:05 -0700 Subject: [PATCH] Explicitly destroy PME-PP GPU communication object Add code to destroy object when it is no longer required. Even although object is managed by a unique pointer, this needs to be done while the GPU context still exists, otherwise a seg fault can occur when it is automatically destroyed later. Addresses #3077 Change-Id: I9d6f798d79a73e2ce366c9fb85a0ff9339fc9f88 --- src/gromacs/mdrun/md.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gromacs/mdrun/md.cpp b/src/gromacs/mdrun/md.cpp index 5d50304ee2..9e1d124849 100644 --- a/src/gromacs/mdrun/md.cpp +++ b/src/gromacs/mdrun/md.cpp @@ -63,6 +63,7 @@ #include "gromacs/essentialdynamics/edsam.h" #include "gromacs/ewald/pme.h" #include "gromacs/ewald/pme_load_balancing.h" +#include "gromacs/ewald/pme_pp_comm_gpu.h" #include "gromacs/fileio/trxio.h" #include "gromacs/gmxlib/network.h" #include "gromacs/gmxlib/nrnb.h" @@ -1711,6 +1712,12 @@ void gmx::LegacySimulator::do_md() walltime_accounting_set_nsteps_done(walltime_accounting, step_rel); + if (fr->pmePpCommGpu) + { + // destroy object since it is no longer required. (This needs to be done while the GPU context still exists.) + fr->pmePpCommGpu.reset(); + } + global_stat_destroy(gstat); } -- 2.11.4.GIT