Fix the bug with offloading the PME-only ranks to GPU
authorArtem Zhmurov <zhmurov@gmail.com>
Wed, 2 Oct 2019 16:00:54 +0000 (18:00 +0200)
committerBerk Hess <hess@kth.se>
Thu, 3 Oct 2019 15:23:39 +0000 (17:23 +0200)
This fixes the bug introduced with StatePropagatorDataGpu (Commit 092a8f68):

In PME-only ranks, the GPU context and stream were mixed up and passed to
the constructor of StatePropagatorDataGpu in the wrong order. This caused
failure in OpenCL builds with error -34 (CL_INVALID_CONTEXT). Did not
affect the CUDA builds, since the context is not relevant in CUDA.

Change-Id: I5e070e361c7bdef3168887dcac4869bb71c6c5ed

src/gromacs/ewald/pme_only.cpp

index eb81ebb79f90b9d458ed94da5c32a0c0178b9890..6716a83143c84590219e2bfd293584058b56ec18 100644 (file)
@@ -547,8 +547,8 @@ int gmx_pmeonly(struct gmx_pme_t *pme,
     auto        pme_pp       = gmx_pme_pp_init(cr);
     //TODO the variable below should be queried from the task assignment info
     const bool  useGpuForPme   = (runMode == PmeRunMode::GPU) || (runMode == PmeRunMode::Mixed);
-    const void *commandStream  = useGpuForPme ? pme_gpu_get_device_context(pme) : nullptr;
-    const void *gpuContext     = useGpuForPme ? pme_gpu_get_device_stream(pme) : nullptr;
+    const void *commandStream  = useGpuForPme ? pme_gpu_get_device_stream(pme) : nullptr;
+    const void *gpuContext     = useGpuForPme ? pme_gpu_get_device_context(pme) : nullptr;
     const int   paddingSize    = pme_gpu_get_padding_size(pme);
     if (useGpuForPme)
     {