From 9ecb956498671c90e7f05c8e831ae243fa917a37 Mon Sep 17 00:00:00 2001 From: Artem Zhmurov Date: Wed, 12 May 2021 11:16:47 +0300 Subject: [PATCH] Remove extra device force getter from NBNXM Having two getters for the same device buffer is confusing and polutes the name space. This removes the extra getter and change to the calls to the other one where it was used. Refs #2608 --- src/gromacs/mdlib/sim_util.cpp | 5 +++-- src/gromacs/nbnxm/nbnxm.cpp | 5 ----- src/gromacs/nbnxm/nbnxm.h | 6 ------ src/gromacs/nbnxm/nbnxm_gpu.h | 9 --------- src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp | 5 ----- src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp | 6 ------ 6 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/gromacs/mdlib/sim_util.cpp b/src/gromacs/mdlib/sim_util.cpp index a93b67770d..b496d2639f 100644 --- a/src/gromacs/mdlib/sim_util.cpp +++ b/src/gromacs/mdlib/sim_util.cpp @@ -1132,7 +1132,7 @@ static void setupGpuForceReductions(gmx::MdrunScheduleWorkload* runScheduleWork, stateGpu->fReducedOnDevice()); // register forces and add dependencies - fr->gpuForceReduction[gmx::AtomLocality::Local]->registerNbnxmForce(nbv->getGpuForces()); + fr->gpuForceReduction[gmx::AtomLocality::Local]->registerNbnxmForce(Nbnxm::gpu_get_f(nbv->gpu_nbv)); if (runScheduleWork->simulationWork.useGpuPme && (thisRankHasDuty(cr, DUTY_PME) || runScheduleWork->simulationWork.useGpuPmePpCommunication)) @@ -1183,7 +1183,8 @@ static void setupGpuForceReductions(gmx::MdrunScheduleWorkload* runScheduleWork, accumulate); // register forces and add dependencies - fr->gpuForceReduction[gmx::AtomLocality::NonLocal]->registerNbnxmForce(nbv->getGpuForces()); + fr->gpuForceReduction[gmx::AtomLocality::NonLocal]->registerNbnxmForce( + Nbnxm::gpu_get_f(nbv->gpu_nbv)); if (runScheduleWork->domainWork.haveCpuBondedWork || runScheduleWork->domainWork.haveFreeEnergyWork) { fr->gpuForceReduction[gmx::AtomLocality::NonLocal]->addDependency( diff --git a/src/gromacs/nbnxm/nbnxm.cpp b/src/gromacs/nbnxm/nbnxm.cpp index ecc0ecc2ca..89ad3ea294 100644 --- a/src/gromacs/nbnxm/nbnxm.cpp +++ b/src/gromacs/nbnxm/nbnxm.cpp @@ -213,11 +213,6 @@ int nonbonded_verlet_t::getNumAtoms(const gmx::AtomLocality locality) const return numAtoms; } -DeviceBuffer nonbonded_verlet_t::getGpuForces() const -{ - return Nbnxm::getGpuForces(gpu_nbv); -} - real nonbonded_verlet_t::pairlistInnerRadius() const { return pairlistSets_->params().rlistInner; diff --git a/src/gromacs/nbnxm/nbnxm.h b/src/gromacs/nbnxm/nbnxm.h index 6d5cdccd69..e22e3a089f 100644 --- a/src/gromacs/nbnxm/nbnxm.h +++ b/src/gromacs/nbnxm/nbnxm.h @@ -395,12 +395,6 @@ public: */ int getNumAtoms(gmx::AtomLocality locality) const; - /*! \brief Get the pointer to the GPU nonbonded force buffer - * - * \returns A pointer to the force buffer in GPU memory - */ - DeviceBuffer getGpuForces() const; - //! Return the kernel setup const Nbnxm::KernelSetup& kernelSetup() const { return kernelSetup_; } diff --git a/src/gromacs/nbnxm/nbnxm_gpu.h b/src/gromacs/nbnxm/nbnxm_gpu.h index 74e2f07d51..1cf920d35c 100644 --- a/src/gromacs/nbnxm/nbnxm_gpu.h +++ b/src/gromacs/nbnxm/nbnxm_gpu.h @@ -306,14 +306,5 @@ GPU_FUNC_QUALIFIER bool haveGpuShortRangeWork(const NbnxmGpu gmx_unused* nb, gmx::InteractionLocality gmx_unused interactionLocality) GPU_FUNC_TERM_WITH_RETURN(false); -/*! \brief Get the pointer to the GPU nonbonded force buffer - * - * \param[in] nb The nonbonded data GPU structure - * \returns A pointer to the force buffer in GPU memory - */ -GPU_FUNC_QUALIFIER -DeviceBuffer getGpuForces(NbnxmGpu gmx_unused* nb) - GPU_FUNC_TERM_WITH_RETURN(DeviceBuffer{}); - } // namespace Nbnxm #endif diff --git a/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp b/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp index 62ef8788aa..284d3e3679 100644 --- a/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp +++ b/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp @@ -100,9 +100,4 @@ void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid& grid, } } -DeviceBuffer getGpuForces(NbnxmGpu* nb) -{ - return nb->atdat->f; -} - } // namespace Nbnxm diff --git a/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp b/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp index 2d35afd3fe..fd5cbed0d3 100644 --- a/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp +++ b/src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp @@ -62,12 +62,6 @@ void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid& /*grid*/, GMX_RELEASE_ASSERT(false, "nbnxn_gpu_x_to_nbat_x only supported with CUDA"); } -DeviceBuffer getGpuForces(NbnxmGpu* /*nb*/) -{ - GMX_RELEASE_ASSERT(false, "getGpuForces only supported with CUDA"); - return DeviceBuffer{}; -} - } // namespace Nbnxm #endif // !GMX_GPU_CUDA -- 2.22.0