Activate GPU update support in SYCL build
authorAndrey Alekseenko <al42and@gmail.com>
Thu, 7 Oct 2021 10:30:22 +0000 (12:30 +0200)
committerAndrey Alekseenko <al42and@gmail.com>
Fri, 22 Oct 2021 09:45:52 +0000 (11:45 +0200)
Set proper flags and conditionals when deciding GPU workload.

Refs #3929, #3930, #3932.

src/gromacs/mdlib/update_constrain_gpu_impl.cpp
src/gromacs/mdrun/runner.cpp
src/gromacs/mdtypes/state_propagator_data_gpu_impl_gpu.cpp
src/gromacs/taskassignment/decidegpuusage.cpp

index 5931dea8c90feb0f093bdda8687f9ac8609e648e..9b8d102d2533889d8a305248b7d939f08ec58954 100644 (file)
@@ -68,7 +68,7 @@
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/topology/mtop_util.h"
 
-static constexpr bool sc_haveGpuConstraintSupport = GMX_GPU_CUDA;
+static constexpr bool sc_haveGpuConstraintSupport = GMX_GPU_CUDA || GMX_GPU_SYCL;
 
 namespace gmx
 {
index 887e7ba7093ee95bbfddcea4cbdce399c1f34446..43551e0fdf4891d03ccacaca0ac9b4c66998d012 100644 (file)
@@ -203,8 +203,8 @@ static DevelopmentFeatureFlags manageDevelopmentFeatures(const gmx::MDLogger& md
 {
     DevelopmentFeatureFlags devFlags;
 
-    devFlags.enableGpuBufferOps =
-            GMX_GPU_CUDA && useGpuForNonbonded && (getenv("GMX_USE_GPU_BUFFER_OPS") != nullptr);
+    devFlags.enableGpuBufferOps = (GMX_GPU_CUDA || GMX_GPU_SYCL) && useGpuForNonbonded
+                                  && (getenv("GMX_USE_GPU_BUFFER_OPS") != nullptr);
     devFlags.enableGpuHaloExchange = GMX_MPI && GMX_GPU_CUDA && getenv("GMX_GPU_DD_COMMS") != nullptr;
     devFlags.forceGpuUpdateDefault = (getenv("GMX_FORCE_UPDATE_DEFAULT_GPU") != nullptr) || GMX_FAHCORE;
     devFlags.enableGpuPmePPComm = GMX_MPI && GMX_GPU_CUDA && getenv("GMX_GPU_PME_PP_COMMS") != nullptr;
index e6db89f1a99512b6cf0592f68d7c5f95987c4a9e..c08c8f59000e13330acb727f470b63fe6c0cd5bb 100644 (file)
@@ -171,9 +171,9 @@ void StatePropagatorDataGpu::Impl::reinit(int numAtomsLocal, int numAtomsAll)
     reallocateDeviceBuffer(&d_f_, numAtomsAll_, &d_fSize_, &d_fCapacity_, deviceContext_);
 
     // Clearing of the forces can be done in local stream since the nonlocal stream cannot reach
-    // the force accumulation stage before syncing with the local stream. Only done in CUDA,
-    // since the force buffer ops are not implemented in OpenCL.
-    if (GMX_GPU_CUDA && d_fCapacity_ != d_fOldCapacity)
+    // the force accumulation stage before syncing with the local stream. Only done in CUDA and
+    // SYCL, since the force buffer ops are not implemented in OpenCL.
+    if ((GMX_GPU_CUDA || GMX_GPU_SYCL) && d_fCapacity_ != d_fOldCapacity)
     {
         clearDeviceBufferAsync(&d_f_, 0, d_fCapacity_, *localStream_);
     }
@@ -334,7 +334,7 @@ void StatePropagatorDataGpu::Impl::copyCoordinatesToGpu(const gmx::ArrayRef<cons
     //   - it's not needed, copy is done in the same stream as the only consumer task (PME)
     //   - we don't consume the events in OpenCL which is not allowed by GpuEventSynchronizer (would leak memory).
     // TODO: remove this by adding an event-mark free flavor of this function
-    if (GMX_GPU_CUDA)
+    if (GMX_GPU_CUDA || GMX_GPU_SYCL)
     {
         xReadyOnDevice_[atomLocality].markEvent(*deviceStream);
     }
index 499076005101d087b6229e4a4d95857f0dc0d9d3..5bac5adcef47df7fd726cdb4fd16aa3d7b02930a 100644 (file)
@@ -618,9 +618,9 @@ bool decideWhetherToUseGpuForUpdate(const bool                     isDomainDecom
     {
         errorMessage += "Compatible GPUs must have been found.\n";
     }
-    if (!GMX_GPU_CUDA)
+    if (!(GMX_GPU_CUDA || GMX_GPU_SYCL))
     {
-        errorMessage += "Only a CUDA build is supported.\n";
+        errorMessage += "Only CUDA and SYCL builds are supported.\n";
     }
     if (inputrec.eI != IntegrationAlgorithm::MD)
     {