Remove extra device force getter from NBNXM
authorArtem Zhmurov <zhmurov@gmail.com>
Wed, 12 May 2021 08:16:47 +0000 (11:16 +0300)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 14 May 2021 09:13:37 +0000 (09:13 +0000)
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
src/gromacs/nbnxm/nbnxm.cpp
src/gromacs/nbnxm/nbnxm.h
src/gromacs/nbnxm/nbnxm_gpu.h
src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp
src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp

index a93b67770d1fe46ffadc4c9c590bc52fc3443b30..b496d2639f8f5f9193d135e5a8139fdc5adddd17 100644 (file)
@@ -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(
index ecc0ecc2ca6c9ee5dcd9e1bb84fa0216ec69b156..89ad3ea294e176452d937c1bda46ece6c772638e 100644 (file)
@@ -213,11 +213,6 @@ int nonbonded_verlet_t::getNumAtoms(const gmx::AtomLocality locality) const
     return numAtoms;
 }
 
-DeviceBuffer<gmx::RVec> nonbonded_verlet_t::getGpuForces() const
-{
-    return Nbnxm::getGpuForces(gpu_nbv);
-}
-
 real nonbonded_verlet_t::pairlistInnerRadius() const
 {
     return pairlistSets_->params().rlistInner;
index 6d5cdccd694427c814b57850cca351b399b3a3a3..e22e3a089fc7f3ce60179fe21c6e68ef3ecd0ae3 100644 (file)
@@ -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<gmx::RVec> getGpuForces() const;
-
     //! Return the kernel setup
     const Nbnxm::KernelSetup& kernelSetup() const { return kernelSetup_; }
 
index 74e2f07d516ab9964a8e8b91c02adc54c364dfa5..1cf920d35cf85eb08856387a64073e775820e4cf 100644 (file)
@@ -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<gmx::RVec> getGpuForces(NbnxmGpu gmx_unused* nb)
-        GPU_FUNC_TERM_WITH_RETURN(DeviceBuffer<gmx::RVec>{});
-
 } // namespace Nbnxm
 #endif
index 62ef8788aa7334e96d05a2d8501ac29ee1f2691b..284d3e3679c978b1185cb4abb11970972f181958 100644 (file)
@@ -100,9 +100,4 @@ void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid&      grid,
     }
 }
 
-DeviceBuffer<Float3> getGpuForces(NbnxmGpu* nb)
-{
-    return nb->atdat->f;
-}
-
 } // namespace Nbnxm
index 2d35afd3feb32c1efc48ffecc7a519cc5f2d0afb..fd5cbed0d319908a4c6b9163cc33d7ed1a7ca4d0 100644 (file)
@@ -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<gmx::RVec> getGpuForces(NbnxmGpu* /*nb*/)
-{
-    GMX_RELEASE_ASSERT(false, "getGpuForces only supported with CUDA");
-    return DeviceBuffer<gmx::RVec>{};
-}
-
 } // namespace Nbnxm
 
 #endif // !GMX_GPU_CUDA