F buffer operations in CUDA
[alexxy/gromacs.git] / src / gromacs / nbnxm / atomdata.h
index 4e4e0c0a55ec831b5dd83731b7844248ea5bf408..d627732014cfaeb8bfba904722c1887d76c13e68 100644 (file)
@@ -57,12 +57,16 @@ struct nonbonded_verlet_t;
 struct t_mdatoms;
 struct tMPI_Atomic;
 
+enum class BufferOpsUseGpu;
+
 namespace Nbnxm
 {
 class GridSet;
 enum class KernelType;
 }
 
+enum class GpuBufferOpsAccumulateForce;
+
 /* Convenience type for vector with aligned memory */
 template<typename T>
 using AlignedVector = std::vector < T, gmx::AlignedAllocator < T>>;
@@ -335,13 +339,38 @@ void nbnxn_atomdata_copy_x_to_nbat_x<false>(const Nbnxm::GridSet &,
                                             void *);
 
 //! Add the computed forces to \p f, an internal reduction might be performed as well
-void reduceForces(nbnxn_atomdata_t     *nbat,
-                  Nbnxm::AtomLocality   locality,
-                  const Nbnxm::GridSet &gridSet,
-                  rvec                 *f);
+template <bool  useGpu>
+void reduceForces(nbnxn_atomdata_t                   *nbat,
+                  Nbnxm::AtomLocality                 locality,
+                  const Nbnxm::GridSet               &gridSet,
+                  rvec                               *f,
+                  gmx_nbnxn_gpu_t                    *gpu_nbv,
+                  GpuBufferOpsAccumulateForce         accumulateForce);
+
+
+extern template
+void reduceForces<true>(nbnxn_atomdata_t             *nbat,
+                        const Nbnxm::AtomLocality     locality,
+                        const Nbnxm::GridSet         &gridSet,
+                        rvec                         *f,
+                        gmx_nbnxn_gpu_t              *gpu_nbv,
+                        GpuBufferOpsAccumulateForce   accumulateForce);
+
+extern template
+void reduceForces<false>(nbnxn_atomdata_t             *nbat,
+                         const Nbnxm::AtomLocality     locality,
+                         const Nbnxm::GridSet         &gridSet,
+                         rvec                         *f,
+                         gmx_nbnxn_gpu_t              *gpu_nbv,
+                         GpuBufferOpsAccumulateForce   accumulateForce);
 
 /* Add the fshift force stored in nbat to fshift */
 void nbnxn_atomdata_add_nbat_fshift_to_fshift(const nbnxn_atomdata_t *nbat,
                                               rvec                   *fshift);
 
+/* Get the atom start index and number of atoms for a given locality */
+void nbnxn_get_atom_range(Nbnxm::AtomLocality              atomLocality,
+                          const Nbnxm::GridSet            &gridSet,
+                          int                             *atomStart,
+                          int                             *nAtoms);
 #endif