Move the stub for X buffer ops into OpenCL
authorArtem Zhmurov <zhmurov@gmail.com>
Mon, 17 May 2021 10:01:57 +0000 (10:01 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Mon, 17 May 2021 10:01:57 +0000 (10:01 +0000)
src/gromacs/nbnxm/CMakeLists.txt
src/gromacs/nbnxm/nbnxm_gpu_buffer_ops.cpp
src/gromacs/nbnxm/opencl/nbnxm_gpu_buffer_ops_internal_ocl.cpp [moved from src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp with 71% similarity]

index 8759c679bc9d5649ba85062896648f54a7e80968..70cce27c4416c454d9bb94f0a6c42fe59534f2ba 100644 (file)
@@ -76,7 +76,7 @@ endif()
 if(GMX_GPU_OPENCL)
     add_subdirectory(opencl)
     set(NBNXM_OPENCL_KERNELS ${NBNXM_OPENCL_KERNELS} PARENT_SCOPE)
-    gmx_add_libgromacs_sources(nbnxm_gpu_data_mgmt.cpp nbnxm_gpu_buffer_ops_stubs.cpp)
+    gmx_add_libgromacs_sources(nbnxm_gpu_data_mgmt.cpp nbnxm_gpu_buffer_ops.cpp)
 endif()
 
 if(GMX_GPU_SYCL)
index 284d3e3679c978b1185cb4abb11970972f181958..c317b32d845b6061604c13f054a4ace783826a27 100644 (file)
@@ -46,6 +46,8 @@
 #include "gromacs/gpu_utils/device_stream.h"
 #if GMX_GPU_CUDA
 #    include "gromacs/gpu_utils/gpueventsynchronizer.cuh"
+#elif GMX_GPU_OPENCL
+#    include "gromacs/gpu_utils/gpueventsynchronizer_ocl.h"
 #elif GMX_GPU_SYCL
 #    include "gromacs/gpu_utils/gpueventsynchronizer_sycl.h"
 #endif
@@ -55,6 +57,8 @@
 #include "gromacs/nbnxm/nbnxm_gpu_buffer_ops_internal.h"
 #if GMX_GPU_CUDA
 #    include "gromacs/nbnxm/cuda/nbnxm_cuda_types.h"
+#elif GMX_GPU_OPENCL
+#    include "gromacs/nbnxm/opencl/nbnxm_ocl_types.h"
 #elif GMX_GPU_SYCL
 #    include "gromacs/nbnxm/sycl/nbnxm_sycl_types.h"
 #endif
@@ -72,8 +76,8 @@ void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid&      grid,
                            int                     numColumnsMax,
                            bool                    mustInsertNonLocalDependency)
 {
-    static_assert((bool)GMX_GPU_CUDA || (bool)GMX_GPU_SYCL,
-                  "nbnxn_gpu_x_to_nbat_x only supported with CUDA and SYCL");
+    GMX_ASSERT((bool)GMX_GPU_CUDA || (bool)GMX_GPU_SYCL,
+               "NBNXM X buffer operations only supported in CUDA and SYCL");
     GMX_ASSERT(nb, "Need a valid nbnxn_gpu object");
     gmx::InteractionLocality interactionLoc = gmx::atomToInteractionLocality(locality);
 
similarity index 71%
rename from src/gromacs/nbnxm/nbnxm_gpu_buffer_ops_stubs.cpp
rename to src/gromacs/nbnxm/opencl/nbnxm_gpu_buffer_ops_internal_ocl.cpp
index fd5cbed0d319908a4c6b9163cc33d7ed1a7ca4d0..44b65df94fca7d24ab316c8a79d8e7a618649b8f 100644 (file)
@@ -34,8 +34,7 @@
  */
 
 /*! \internal \file
- *  \brief
- *  Common code for GPU buffer operations, namely the coordinate layout conversion
+ *  \brief Define OpenCL implementation for transforming position coordinates from rvec to nbnxm layout.
  *
  *  \ingroup module_nbnxm
  */
 
 #include "config.h"
 
+#include "gromacs/gpu_utils/devicebuffer_datatype.h"
+#include "gromacs/gpu_utils/device_stream.h"
 #include "gromacs/nbnxm/nbnxm_gpu.h"
-
-#if !GMX_GPU_CUDA
+#include "gromacs/nbnxm/nbnxm_gpu_buffer_ops_internal.h"
 
 namespace Nbnxm
 {
 
-void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid& /*grid*/,
-                           NbnxmGpu* /*nb*/,
-                           DeviceBuffer<gmx::RVec> /*d_x*/,
-                           GpuEventSynchronizer* /*xReadyOnDevice*/,
-                           const gmx::AtomLocality /*locality*/,
-                           int /*gridId*/,
-                           int /*numColumnsMax*/,
-                           bool /*mustInsertNonLocalDependency*/)
+void launchNbnxmKernelTransformXToXq(const Grid& /* grid */,
+                                     NbnxmGpu* /* nb */,
+                                     DeviceBuffer<Float3> /* d_x */,
+                                     const DeviceStream& /* deviceStream */,
+                                     unsigned int /* numColumnsMax */,
+                                     int /* gridId */)
 {
-    GMX_RELEASE_ASSERT(false, "nbnxn_gpu_x_to_nbat_x only supported with CUDA");
+    GMX_RELEASE_ASSERT(false, "NBNXM buffer ops are not supported with OpenCL");
 }
 
 } // namespace Nbnxm
-
-#endif // !GMX_GPU_CUDA