Rename LincsCuda into LincsGpu
authorArtem Zhmurov <zhmurov@gmail.com>
Thu, 9 Jan 2020 16:42:47 +0000 (17:42 +0100)
committerChristian Blau <cblau@gerrit.gromacs.org>
Mon, 20 Jan 2020 14:15:28 +0000 (15:15 +0100)
This is to folow general naming conventions across the code.

Refs #2885, #2888.

Change-Id: Ifa7e3febeff1d958155ed02daa97d26e828e8381

src/gromacs/mdlib/CMakeLists.txt
src/gromacs/mdlib/lincs_gpu.cu [moved from src/gromacs/mdlib/lincs_cuda.cu with 98% similarity]
src/gromacs/mdlib/lincs_gpu.cuh [moved from src/gromacs/mdlib/lincs_cuda.cuh with 92% similarity]
src/gromacs/mdlib/tests/constr.cpp
src/gromacs/mdlib/tests/constrtestrunners.cpp
src/gromacs/mdlib/tests/constrtestrunners.cu
src/gromacs/mdlib/tests/constrtestrunners.h
src/gromacs/mdlib/update_constrain_cuda_impl.cu
src/gromacs/mdlib/update_constrain_cuda_impl.h

index f7d2f579d0fe1b2a590aa83a7ac36fefb387d322..026ed3fe84b8ce3a8b120529241ba295b13404ca 100644 (file)
@@ -41,7 +41,7 @@ if (BUILD_TESTING)
 endif()
 if(GMX_USE_CUDA)
     gmx_add_libgromacs_sources(
-       lincs_cuda.cu
+       lincs_gpu.cu
        settle_cuda.cu
        leapfrog_gpu.cu
        update_constrain_cuda_impl.cu
similarity index 98%
rename from src/gromacs/mdlib/lincs_cuda.cu
rename to src/gromacs/mdlib/lincs_gpu.cu
index 08b17e3083ddde0275c9bc41374c216154eeba49..c5e92b7c296c812e114f95072ecbf06957c8088a 100644 (file)
@@ -40,8 +40,6 @@
  * using CUDA, including class initialization, data-structures management
  * and GPU kernel.
  *
- * \todo Reconsider naming, i.e. "cuda" suffics should be changed to "gpu".
- *
  * \author Artem Zhmurov <zhmurov@gmail.com>
  * \author Alan Gray <alang@nvidia.com>
  *
@@ -49,7 +47,7 @@
  */
 #include "gmxpre.h"
 
-#include "lincs_cuda.cuh"
+#include "lincs_gpu.cuh"
 
 #include <assert.h>
 #include <stdio.h>
@@ -106,7 +104,7 @@ constexpr static int c_maxThreadsPerBlock = c_threadsPerBlock;
  */
 template<bool updateVelocities, bool computeVirial>
 __launch_bounds__(c_maxThreadsPerBlock) __global__
-        void lincs_kernel(LincsCudaKernelParameters kernelParams,
+        void lincs_kernel(LincsGpuKernelParameters kernelParams,
                           const float3* __restrict__ gm_x,
                           float3*     gm_xp,
                           float3*     gm_v,
@@ -427,14 +425,14 @@ inline auto getLincsKernelPtr(const bool updateVelocities, const bool computeVir
     return kernelPtr;
 }
 
-void LincsCuda::apply(const float3* d_x,
-                      float3*       d_xp,
-                      const bool    updateVelocities,
-                      float3*       d_v,
-                      const real    invdt,
-                      const bool    computeVirial,
-                      tensor        virialScaled,
-                      const PbcAiuc pbcAiuc)
+void LincsGpu::apply(const float3* d_x,
+                     float3*       d_xp,
+                     const bool    updateVelocities,
+                     float3*       d_v,
+                     const real    invdt,
+                     const bool    computeVirial,
+                     tensor        virialScaled,
+                     const PbcAiuc pbcAiuc)
 {
     ensureNoPendingCudaError("In CUDA version of LINCS");
 
@@ -508,7 +506,7 @@ void LincsCuda::apply(const float3* d_x,
     return;
 }
 
-LincsCuda::LincsCuda(int numIterations, int expansionOrder, CommandStream commandStream) :
+LincsGpu::LincsGpu(int numIterations, int expansionOrder, CommandStream commandStream) :
     commandStream_(commandStream)
 {
     kernelParams_.numIterations  = numIterations;
@@ -528,7 +526,7 @@ LincsCuda::LincsCuda(int numIterations, int expansionOrder, CommandStream comman
     numAtomsAlloc_              = 0;
 }
 
-LincsCuda::~LincsCuda()
+LincsGpu::~LincsGpu()
 {
     freeDeviceBuffer(&kernelParams_.d_virialScaled);
 
@@ -702,7 +700,7 @@ static std::vector<int> countNumCoupledConstraints(ArrayRef<const int> iatoms,
     return numCoupledConstraints;
 }
 
-bool LincsCuda::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
+bool LincsGpu::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
 {
     for (const gmx_moltype_t& molType : mtop.moltype)
     {
@@ -722,7 +720,7 @@ bool LincsCuda::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
     return true;
 }
 
-void LincsCuda::set(const t_idef& idef, const t_mdatoms& md)
+void LincsGpu::set(const t_idef& idef, const t_mdatoms& md)
 {
     int numAtoms = md.nr;
     // List of constrained atoms (CPU memory)
similarity index 92%
rename from src/gromacs/mdlib/lincs_cuda.cuh
rename to src/gromacs/mdlib/lincs_gpu.cuh
index 1d56e34303582d86e495efaf37d10457ead3f558..40cff3c340a9742e286eb5f6b045d08bcf88ca59 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
  */
 /*! \libinternal \file
  *
- * \brief Declares the class for CUDA implementation of LINCS.
+ * \brief Declares the class for GPU implementation of LINCS.
  *
  * \author Artem Zhmurov <zhmurov@gmail.com>
  *
  * \ingroup module_mdlib
  * \inlibraryapi
  */
-#ifndef GMX_MDLIB_LINCS_CUDA_CUH
-#define GMX_MDLIB_LINCS_CUDA_CUH
+#ifndef GMX_MDLIB_LINCS_GPU_CUH
+#define GMX_MDLIB_LINCS_GPU_CUH
 
 #include "gromacs/gpu_utils/gputraits.cuh"
 #include "gromacs/mdlib/constr.h"
@@ -60,7 +60,7 @@ namespace gmx
  * to the GPU as a single structure.
  *
  */
-struct LincsCudaKernelParameters
+struct LincsGpuKernelParameters
 {
     //! Periodic boundary data
     PbcAiuc pbcAiuc;
@@ -93,8 +93,8 @@ struct LincsCudaKernelParameters
     float* d_massFactors;
 };
 
-/*! \internal \brief Class with interfaces and data for CUDA version of LINCS. */
-class LincsCuda
+/*! \internal \brief Class with interfaces and data for GPU version of LINCS. */
+class LincsGpu
 {
 
 public:
@@ -104,9 +104,9 @@ public:
      * \param[in] expansionOrder   Order of the matrix inversion algorithm.
      * \param[in] commandStream    Device command stream.
      */
-    LincsCuda(int numIterations, int expansionOrder, CommandStream commandStream);
+    LincsGpu(int numIterations, int expansionOrder, CommandStream commandStream);
     /*! \brief Destructor.*/
-    ~LincsCuda();
+    ~LincsGpu();
 
     /*! \brief Apply LINCS.
      *
@@ -159,18 +159,18 @@ public:
 
     /*! \brief
      * Returns whether the maximum number of coupled constraints is supported
-     * by the CUDA LINCS code.
+     * by the GPU LINCS code.
      *
      * \param[in] mtop The molecular topology
      */
     static bool isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop);
 
 private:
-    //! CUDA stream
+    //! GPU stream
     CommandStream commandStream_;
 
-    //! Parameters and pointers, passed to the CUDA kernel
-    LincsCudaKernelParameters kernelParams_;
+    //! Parameters and pointers, passed to the GPU kernel
+    LincsGpuKernelParameters kernelParams_;
 
     //! Scaled virial tensor (6 floats: [XX, XY, XZ, YY, YZ, ZZ])
     std::vector<float> h_virialScaled_;
@@ -192,4 +192,4 @@ private:
 
 } // namespace gmx
 
-#endif // GMX_MDLIB_LINCS_CUDA_CUH
+#endif // GMX_MDLIB_LINCS_GPU_CUH
index 5316e0c849b9f7a1488955107f0aaab601f0edae..c8654f11365b877ce91e23910e5b017231460c77 100644 (file)
@@ -91,7 +91,7 @@ std::vector<std::string> getRunnersNames()
     runnersNames.emplace_back("LINCS");
     if (GMX_GPU == GMX_GPU_CUDA && canComputeOnGpu())
     {
-        runnersNames.emplace_back("LINCS_CUDA");
+        runnersNames.emplace_back("LINCS_GPU");
     }
     return runnersNames;
 }
@@ -153,8 +153,8 @@ public:
         algorithms_["SHAKE"] = applyShake;
         // LINCS
         algorithms_["LINCS"] = applyLincs;
-        // LINCS using CUDA (will only be called if CUDA is available)
-        algorithms_["LINCS_CUDA"] = applyLincsCuda;
+        // LINCS using GPU (will only be called if GPU is available)
+        algorithms_["LINCS_GPU"] = applyLincsGpu;
     }
 
     /*! \brief
index ffd8f99e684670ee6dd6b10897cc8735864c1d36..b1f33560927122ab76ff6aa26b1b749850dd05a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -143,12 +143,12 @@ void applyLincs(ConstraintsTestData* testData, t_pbc pbc)
 
 #if GMX_GPU != GMX_GPU_CUDA
 /*! \brief
- * Stub for LINCS constraints on CUDA-enabled GPU to satisfy compiler.
+ * Stub for GPU version of LINCS constraints to satisfy compiler.
  *
  * \param[in] testData        Test data structure.
  * \param[in] pbc             Periodic boundary data.
  */
-void applyLincsCuda(ConstraintsTestData gmx_unused* testData, t_pbc gmx_unused pbc)
+void applyLincsGpu(ConstraintsTestData gmx_unused* testData, t_pbc gmx_unused pbc)
 {
     FAIL() << "Dummy LINCS CUDA function was called instead of the real one.";
 }
index 43c7edca6a5f5c70da27ad6ec94b520306d05ccb..6d54523506f38f202e27f875c7f7c9ededb6638c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -53,7 +53,7 @@
 
 #include "gromacs/gpu_utils/devicebuffer.cuh"
 #include "gromacs/gpu_utils/gpu_utils.h"
-#include "gromacs/mdlib/lincs_cuda.cuh"
+#include "gromacs/mdlib/lincs_gpu.cuh"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/utility/unique_cptr.h"
 
@@ -63,21 +63,21 @@ namespace test
 {
 
 /*! \brief
- * Initialize and apply LINCS constraints on CUDA-enabled GPU.
+ * Initialize and apply LINCS constraints on GPU.
  *
  * \param[in] testData        Test data structure.
  * \param[in] pbc             Periodic boundary data.
  */
-void applyLincsCuda(ConstraintsTestData* testData, t_pbc pbc)
+void applyLincsGpu(ConstraintsTestData* testData, t_pbc pbc)
 {
-    auto lincsCuda =
-            std::make_unique<LincsCuda>(testData->ir_.nLincsIter, testData->ir_.nProjOrder, nullptr);
+    auto lincsGpu =
+            std::make_unique<LincsGpu>(testData->ir_.nLincsIter, testData->ir_.nProjOrder, nullptr);
 
     bool    updateVelocities = true;
     int     numAtoms         = testData->numAtoms_;
     float3 *d_x, *d_xp, *d_v;
 
-    lincsCuda->set(testData->idef_, testData->md_);
+    lincsGpu->set(testData->idef_, testData->md_);
     PbcAiuc pbcAiuc;
     setPbcAiuc(pbc.ndim_ePBC, pbc.box, &pbcAiuc);
 
@@ -94,8 +94,8 @@ void applyLincsCuda(ConstraintsTestData* testData, t_pbc pbc)
         copyToDeviceBuffer(&d_v, (float3*)(testData->v_.data()), 0, numAtoms, nullptr,
                            GpuApiCallBehavior::Sync, nullptr);
     }
-    lincsCuda->apply(d_x, d_xp, updateVelocities, d_v, testData->invdt_, testData->computeVirial_,
-                     testData->virialScaled_, pbcAiuc);
+    lincsGpu->apply(d_x, d_xp, updateVelocities, d_v, testData->invdt_, testData->computeVirial_,
+                    testData->virialScaled_, pbcAiuc);
 
     copyFromDeviceBuffer((float3*)(testData->xPrime_.data()), &d_xp, 0, numAtoms, nullptr,
                          GpuApiCallBehavior::Sync, nullptr);
index f4d24f6e35f7d2c459a6edfcdf200b650fb7fd81..a9e715625649d9c6d537ec24bdc331691087db63 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -61,12 +61,12 @@ void applyShake(ConstraintsTestData* testData, t_pbc pbc);
 /*! \brief Apply LINCS constraints to the test data.
  */
 void applyLincs(ConstraintsTestData* testData, t_pbc pbc);
-/*! \brief Apply CUDA version of LINCS constraints to the test data.
+/*! \brief Apply GPU version of LINCS constraints to the test data.
  *
  * All the data is copied to the GPU device, then LINCS is applied and
  * the resulting coordinates are copied back.
  */
-void applyLincsCuda(ConstraintsTestData* testData, t_pbc pbc);
+void applyLincsGpu(ConstraintsTestData* testData, t_pbc pbc);
 
 } // namespace test
 } // namespace gmx
index 3d36b7794c5921e2054dc4c13f0ab6f1033e48ce..0d227d3954f1cc0297d0efd82ad8f79e1bf1627f 100644 (file)
@@ -61,7 +61,7 @@
 #include "gromacs/gpu_utils/gputraits.cuh"
 #include "gromacs/gpu_utils/vectype_ops.cuh"
 #include "gromacs/mdlib/leapfrog_gpu.cuh"
-#include "gromacs/mdlib/lincs_cuda.cuh"
+#include "gromacs/mdlib/lincs_gpu.cuh"
 #include "gromacs/mdlib/settle_cuda.cuh"
 #include "gromacs/mdlib/update_constrain_cuda.h"
 
@@ -127,7 +127,7 @@ void UpdateConstrainCuda::Impl::integrate(GpuEventSynchronizer*             fRea
     // Constraints need both coordinates before (d_x_) and after (d_xp_) update. However, after constraints
     // are applied, the d_x_ can be discarded. So we intentionally swap the d_x_ and d_xp_ here to avoid the
     // d_xp_ -> d_x_ copy after constraints. Note that the integrate saves them in the wrong order as well.
-    lincsCuda_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial, pbcAiuc_);
+    lincsGpu_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial, pbcAiuc_);
     settleCuda_->apply(d_xp_, d_x_, updateVelocities, d_v_, 1.0 / dt, computeVirial, virial, pbcAiuc_);
 
     // scaledVirial -> virial (methods above returns scaled values)
@@ -176,7 +176,7 @@ UpdateConstrainCuda::Impl::Impl(const t_inputrec&     ir,
 
 
     integrator_ = std::make_unique<LeapFrogGpu>(commandStream_);
-    lincsCuda_  = std::make_unique<LincsCuda>(ir.nLincsIter, ir.nProjOrder, commandStream_);
+    lincsGpu_   = std::make_unique<LincsGpu>(ir.nLincsIter, ir.nProjOrder, commandStream_);
     settleCuda_ = std::make_unique<SettleCuda>(mtop, commandStream_);
 
     coordinateScalingKernelLaunchConfig_.blockSize[0]     = c_threadsPerBlock;
@@ -212,7 +212,7 @@ void UpdateConstrainCuda::Impl::set(DeviceBuffer<float>       d_x,
 
     // Integrator should also update something, but it does not even have a method yet
     integrator_->set(md, numTempScaleValues, md.cTC);
-    lincsCuda_->set(idef, md);
+    lincsGpu_->set(idef, md);
     settleCuda_->set(idef, md);
 
     coordinateScalingKernelLaunchConfig_.gridSize[0] =
@@ -281,7 +281,7 @@ GpuEventSynchronizer* UpdateConstrainCuda::getCoordinatesReadySync()
 
 bool UpdateConstrainCuda::isNumCoupledConstraintsSupported(const gmx_mtop_t& mtop)
 {
-    return LincsCuda::isNumCoupledConstraintsSupported(mtop);
+    return LincsGpu::isNumCoupledConstraintsSupported(mtop);
 }
 
 } // namespace gmx
index 25ac45b586efa28c27e1396c9d9b33a0aa53db3a..5530c38c0a87ab52e05e93c69e18fb5f76a11465 100644 (file)
@@ -50,7 +50,7 @@
 
 #include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
 #include "gromacs/mdlib/leapfrog_gpu.cuh"
-#include "gromacs/mdlib/lincs_cuda.cuh"
+#include "gromacs/mdlib/lincs_gpu.cuh"
 #include "gromacs/mdlib/settle_cuda.cuh"
 #include "gromacs/mdlib/update_constrain_cuda.h"
 #include "gromacs/mdtypes/inputrec.h"
@@ -199,7 +199,7 @@ private:
     //! Leap-Frog integrator
     std::unique_ptr<LeapFrogGpu> integrator_;
     //! LINCS CUDA object to use for non-water constraints
-    std::unique_ptr<LincsCuda> lincsCuda_;
+    std::unique_ptr<LincsGpu> lincsGpu_;
     //! SETTLE CUDA object for water constrains
     std::unique_ptr<SettleCuda> settleCuda_;