Extend GPU traits class
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 30 Aug 2019 16:27:05 +0000 (18:27 +0200)
committerArtem Zhmurov <zhmurov@gmail.com>
Mon, 7 Oct 2019 15:45:01 +0000 (17:45 +0200)
Now GPU traits provide a non-GPU header, so that generic code
can use CommandStream, CommandEvent and DeviceContext types.
The header also diverges to a platform-specific version when
needed upon compilation. This change allows for passing the
variables of the above types in the general (non-GPU) parts
of the code and can be included where the code is shared
between different platforms.

Renamed a Context variable to DeviceContext for greater clarity.

Change-Id: If21b9dacac66ff7203948eb03de96f9473b7359a

16 files changed:
src/gromacs/ewald/pme_gpu_program_impl.h
src/gromacs/ewald/pme_gpu_types_host_impl.h
src/gromacs/ewald/pme_only.cpp
src/gromacs/gpu_utils/devicebuffer.cuh
src/gromacs/gpu_utils/devicebuffer.h
src/gromacs/gpu_utils/devicebuffer_ocl.h
src/gromacs/gpu_utils/gputraits.cuh
src/gromacs/gpu_utils/gputraits.h [new file with mode: 0644]
src/gromacs/gpu_utils/gputraits_ocl.h
src/gromacs/mdrun/runner.cpp
src/gromacs/mdtypes/state_propagator_data_gpu.h
src/gromacs/mdtypes/state_propagator_data_gpu_impl.cpp
src/gromacs/mdtypes/state_propagator_data_gpu_impl.h
src/gromacs/mdtypes/state_propagator_data_gpu_impl_gpu.cpp
src/gromacs/nbnxm/cuda/nbnxm_cuda_data_mgmt.cu
src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp

index f1c114115fea72a0dcc20bd03913e3f254369142..bfe4815af78ff658dbf341a411bd2e197ab99520 100644 (file)
 
 #include "config.h"
 
+#include "gromacs/gpu_utils/gputraits.h"
 #include "gromacs/utility/classhelpers.h"
 
-#if GMX_GPU == GMX_GPU_CUDA
-#include "gromacs/gpu_utils/gputraits.cuh"
-#elif GMX_GPU == GMX_GPU_OPENCL
-#include "gromacs/gpu_utils/gputraits_ocl.h"
-#elif GMX_GPU == GMX_GPU_NONE
-// TODO place in gputraits_stub.h
-using Context = void *;
-#endif
-
 struct gmx_device_info_t;
 
 /*! \internal
@@ -85,7 +77,7 @@ struct PmeGpuProgramImpl
      * TODO: Later we want to be able to own the context at a higher level and not here,
      * but this class would still need the non-owning context handle to build the kernels.
      */
-    Context context;
+    DeviceContext context;
 
     //! Conveniently all the PME kernels use the same single argument type
 #if GMX_GPU == GMX_GPU_CUDA
index be865c87787fed9609fdd37ebebc6f1fbd7c7aee..b113fcba4e734caa6ef15eed1e69c7edf9e5c85b 100644 (file)
@@ -76,7 +76,7 @@ struct PmeGpuSpecific
      * but should be a constructor parameter to PmeGpu, as well as PmeGpuProgram,
      * managed by high-level code.
      */
-    Context context;
+    DeviceContext context;
 
     /* Synchronization events */
     /*! \brief Triggered after the PME Force Calculations have been completed */
index dc2a2ec7e8da2264b8701f65dd2cedf15a378300..01518afbb709fd719717e3c37be3549ba59a477f 100644 (file)
@@ -548,7 +548,7 @@ int gmx_pmeonly(struct gmx_pme_t *pme,
     //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_stream(pme) : nullptr;
-    const void *gpuContext     = useGpuForPme ? pme_gpu_get_device_context(pme) : nullptr;
+    const void *deviceContext  = useGpuForPme ? pme_gpu_get_device_context(pme) : nullptr;
     const int   paddingSize    = pme_gpu_get_padding_size(pme);
     if (useGpuForPme)
     {
@@ -557,7 +557,7 @@ int gmx_pmeonly(struct gmx_pme_t *pme,
     }
 
     // Unconditionally initialize the StatePropagatorDataGpu object to get more verbose message if it is used from CPU builds
-    auto stateGpu = std::make_unique<gmx::StatePropagatorDataGpu>(commandStream, gpuContext, GpuApiCallBehavior::Sync, paddingSize);
+    auto stateGpu = std::make_unique<gmx::StatePropagatorDataGpu>(commandStream, deviceContext, GpuApiCallBehavior::Sync, paddingSize);
 
     clear_nrnb(mynrnb);
 
index ea95f021d65a6d34bd9ca038dfe3f1c125c1cd56..7e7cfe91a7955c6c4d3dc9abca0c491ef8324f56 100644 (file)
  * \tparam        ValueType            Raw value type of the \p buffer.
  * \param[in,out] buffer               Pointer to the device-side buffer.
  * \param[in]     numValues            Number of values to accomodate.
- * \param[in]     context              The buffer's dummy context - not managed explicitly in CUDA RT.
+ * \param[in]     deviceContext        The buffer's dummy device  context - not managed explicitly in CUDA RT.
  */
 template <typename ValueType>
 void allocateDeviceBuffer(DeviceBuffer<ValueType> *buffer,
                           size_t                   numValues,
-                          Context                  /* context */)
+                          DeviceContext            /* deviceContext */)
 {
     GMX_ASSERT(buffer, "needs a buffer pointer");
     cudaError_t stat = cudaMalloc((void **)buffer, numValues * sizeof(ValueType));
index 7e0ff99e7723de8a98da8e71d0e52856f358646d..5c469cead9b2bb02f3cfd8ecb2223f8bb69bc0eb 100644 (file)
@@ -65,7 +65,7 @@
  *  Allocation is buffered and therefore freeing is only needed
  *  if the previously allocated space is not enough.
  *  \p currentNumValues and \p currentMaxNumValues are updated.
- *  TODO: \p currentNumValues, \p currentMaxNumValues, \p context
+ *  TODO: \p currentNumValues, \p currentMaxNumValues, \p deviceContext
  *  should all be encapsulated in a host-side class together with the buffer.
  *
  *  \tparam        ValueType            Raw value type of the \p buffer.
  *  \param[in]     numValues            Number of values to accommodate.
  *  \param[in,out] currentNumValues     The pointer to the buffer's number of values.
  *  \param[in,out] currentMaxNumValues  The pointer to the buffer's capacity.
- *  \param[in]     context              The buffer's context.
+ *  \param[in]     deviceContext        The buffer's device context.
  */
 template <typename ValueType>
 void reallocateDeviceBuffer(DeviceBuffer<ValueType> *buffer,
                             size_t                   numValues,
                             int                     *currentNumValues,
                             int                     *currentMaxNumValues,
-                            Context                  context)
+                            DeviceContext            deviceContext)
 {
     GMX_ASSERT(buffer, "needs a buffer pointer");
     GMX_ASSERT(currentNumValues, "needs a size pointer");
@@ -95,7 +95,7 @@ void reallocateDeviceBuffer(DeviceBuffer<ValueType> *buffer,
         }
 
         *currentMaxNumValues = over_alloc_large(numValues);
-        allocateDeviceBuffer(buffer, *currentMaxNumValues, context);
+        allocateDeviceBuffer(buffer, *currentMaxNumValues, deviceContext);
     }
     /* size could have changed without actual reallocation */
     *currentNumValues = numValues;
index 1c92a7aa003288bc7c98f2b2ac5f25c618c1fbfa..723b391b135c37989094db5a3c322d23e77b12de 100644 (file)
  * \tparam        ValueType            Raw value type of the \p buffer.
  * \param[in,out] buffer               Pointer to the device-side buffer.
  * \param[in]     numValues            Number of values to accomodate.
- * \param[in]     context              The buffer's context-to-be.
+ * \param[in]     deviceContext        The buffer's device context-to-be.
  */
 template <typename ValueType>
 void allocateDeviceBuffer(DeviceBuffer<ValueType> *buffer,
                           size_t                   numValues,
-                          Context                  context)
+                          DeviceContext            deviceContext)
 {
     GMX_ASSERT(buffer, "needs a buffer pointer");
     void  *hostPtr = nullptr;
     cl_int clError;
-    *buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, numValues * sizeof(ValueType), hostPtr, &clError);
+    *buffer = clCreateBuffer(deviceContext, CL_MEM_READ_WRITE, numValues * sizeof(ValueType), hostPtr, &clError);
     GMX_RELEASE_ASSERT(clError == CL_SUCCESS, "clCreateBuffer failure");
 }
 
index f3bb0437e7544a532da268ee50169aa9d372d9ba..559cad265f0a85708bded768d5f8b92d1f39ff02 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
@@ -40,6 +40,7 @@
  *  \author Aleksei Iupinov <a.yupinov@gmail.com>
  *
  * \inlibraryapi
+ * \ingroup module_gpu_utils
  */
 
 //! \brief GPU command stream
@@ -47,7 +48,7 @@ using CommandStream = cudaStream_t;
 //! \brief Single GPU call timing event - meaningless in CUDA
 using CommandEvent  = void;
 //! \brief Context used explicitly in OpenCL, does nothing in CUDA
-using Context       = void *;
+using DeviceContext = void *;
 
 /*! \internal \brief
  * GPU kernels scheduling description. This is same in OpenCL/CUDA.
diff --git a/src/gromacs/gpu_utils/gputraits.h b/src/gromacs/gpu_utils/gputraits.h
new file mode 100644 (file)
index 0000000..0a8b365
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2018,2019, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#ifndef GMX_GPU_UTILS_GPUTRAITS_H
+#define GMX_GPU_UTILS_GPUTRAITS_H
+
+/*! \libinternal \file
+ *  \brief Declares the GPU type traits for non-GPU builds
+ *  \author Mark Abraham <mark.j.abraham@gmail.com>
+ *
+ * \inlibraryapi
+ * \ingroup module_gpu_utils
+ */
+
+#include "config.h"
+
+#if GMX_GPU == GMX_GPU_CUDA
+
+#include "gromacs/gpu_utils/gputraits.cuh"
+
+#elif GMX_GPU == GMX_GPU_OPENCL
+
+#include "gromacs/gpu_utils/gputraits_ocl.h"
+
+#else
+
+//! \brief GPU command stream
+using CommandStream = void *;
+//! \brief Single GPU call timing event
+using CommandEvent  = void *;
+//! \brief GPU context
+using DeviceContext = void *;
+
+#endif // GMX_GPU
+
+#endif // GMX_GPU_UTILS_GPUTRAITS_H
index 5287d32727df1b12f7ff9154617b46cfb6fd906d..5e936983186dd8cda3c158c7076e5f777d791baa 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, 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.
@@ -40,6 +40,7 @@
  *  \author Aleksei Iupinov <a.yupinov@gmail.com>
  *
  * \inlibraryapi
+ * \ingroup module_gpu_utils
  */
 
 #include "gromacs/gpu_utils/gmxopencl.h"
@@ -49,7 +50,7 @@ using CommandStream = cl_command_queue;
 //! \brief Single GPU call timing event
 using CommandEvent  = cl_event;
 //! \brief Context used explicitly in OpenCL
-using Context       = cl_context;
+using DeviceContext = cl_context;
 
 /*! \internal \brief
  * GPU kernels scheduling description. This is same in OpenCL/CUDA.
index 56b399151d079b41bd4c58e9546e7f927fbd729d..f7f24405b553349924a728a8d2232533b272355d 100644 (file)
@@ -1502,7 +1502,7 @@ int Mdrunner::mdrunner()
                                                          fcd->disres.nsystems != 0);
 
         const void *commandStream = ((GMX_GPU == GMX_GPU_OPENCL) && thisRankHasPmeGpuTask) ? pme_gpu_get_device_stream(fr->pmedata) : nullptr;
-        const void *gpuContext    = ((GMX_GPU == GMX_GPU_OPENCL) && thisRankHasPmeGpuTask) ? pme_gpu_get_device_context(fr->pmedata) : nullptr;
+        const void *deviceContext = ((GMX_GPU == GMX_GPU_OPENCL) && thisRankHasPmeGpuTask) ? pme_gpu_get_device_context(fr->pmedata) : nullptr;
         const int   paddingSize   = pme_gpu_get_padding_size(fr->pmedata);
 
         const bool  inputIsCompatibleWithModularSimulator = ModularSimulator::isInputCompatible(
@@ -1517,7 +1517,7 @@ int Mdrunner::mdrunner()
         // We initialize GPU state even for the CPU runs so we will have a more verbose
         // error if someone will try accessing it from the CPU codepath
         gmx::StatePropagatorDataGpu stateGpu(commandStream,
-                                             gpuContext,
+                                             deviceContext,
                                              transferKind,
                                              paddingSize);
         fr->stateGpu = &stateGpu;
index a7cda77663c5adb0d9df190aa29137e79fd51d0c..212fde53dd32bcb3cd52eb64b162a2d4bbbcd119 100644 (file)
@@ -87,22 +87,22 @@ class StatePropagatorDataGpu
          * PME work on the GPU, and if that rank also does PP work that is the only
          * rank. So all coordinates are always transferred.
          *
-         * \note \p commandStream and \p gpuContext are allowed to be nullptr if
+         * \note \p commandStream and \p deviceContext are allowed to be nullptr if
          *       StatePropagatorDataGpu is not used in the OpenCL run (e.g. if PME
          *       does not run on the GPU).
          *
-         * \todo Make \p CommandStream visible in the CPU parts of the code so we
-         *       will not have to pass a void*.
-         * \todo Make \p Context visible in CPU parts of the code so we will not
-         *       have to pass a void*.
+         * \todo A CommandStream is now visible in the CPU parts of the code so we
+         *       can stop passing a void*.
+         * \todo A DeviceContext object is visible in CPU parts of the code so we
+         *       can stop passing a void*.
          *
          *  \param[in] commandStream  GPU stream, nullptr allowed.
-         *  \param[in] gpuContext     GPU context, nullptr allowed.
+         *  \param[in] deviceContext  GPU context, nullptr allowed.
          *  \param[in] transferKind   H2D/D2H transfer call behavior (synchronous or not).
          *  \param[in] paddingSize    Padding size for coordinates buffer.
          */
         StatePropagatorDataGpu(const void        *commandStream,
-                               const void        *gpuContext,
+                               const void        *deviceContext,
                                GpuApiCallBehavior transferKind,
                                int                paddingSize);
         //! Move constructor
index 9a119566494fe10a76c63318c608aa468d949ec9..d66cfc552fefecaa184a2312004bef76b563786a 100644 (file)
@@ -55,7 +55,7 @@ class StatePropagatorDataGpu::Impl
 };
 
 StatePropagatorDataGpu::StatePropagatorDataGpu(const void *       /* commandStream */,
-                                               const void *       /* gpuContext    */,
+                                               const void *       /* deviceContext */,
                                                GpuApiCallBehavior /* transferKind  */,
                                                int                /* paddingSize   */)
     : impl_(nullptr)
index 6ba40d987e93154e06907dfd940969f57f46b4ae..f32d6df9debf731fbf64c6615b285b4451b32677 100644 (file)
@@ -71,22 +71,22 @@ class StatePropagatorDataGpu::Impl
          * PME work on the GPU, and if that rank also does PP work that is the only
          * rank. So all coordinates are always transferred.
          *
-         * \note \p commandStream and \p gpuContext are allowed to be nullptr if
+         * \note \p commandStream and \p deviceContext are allowed to be nullptr if
          *       StatePropagatorDataGpu is not used in the OpenCL run (e.g. if PME
          *       does not run on the GPU).
          *
-         * \todo Make CommandStream visible in the CPU parts of the code so we
-         *       will not have to pass a void*.
-         * \todo Make a Context object visible in CPU parts of the code so we
-         *       will not have to pass a void*.
+         * \todo A CommandStream is now visible in the CPU parts of the code so we
+         *       can stop passing a void*.
+         * \todo A DeviceContext object is visible in CPU parts of the code so we
+         *       can stop passing a void*.
          *
          *  \param[in] commandStream  GPU stream, nullptr allowed.
-         *  \param[in] gpuContext     GPU context, nullptr allowed.
+         *  \param[in] deviceContext  GPU context, nullptr allowed.
          *  \param[in] transferKind   H2D/D2H transfer call behavior (synchronous or not).
          *  \param[in] paddingSize    Padding size for coordinates buffer.
          */
         Impl(const void        *commandStream,
-             const void        *gpuContext,
+             const void        *deviceContext,
              GpuApiCallBehavior transferKind,
              int                paddingSize);
 
@@ -209,7 +209,7 @@ class StatePropagatorDataGpu::Impl
         /*! \brief GPU context (for OpenCL builds)
          * \todo Make a Context class usable in CPU code
          */
-        Context              gpuContext_                 = nullptr;
+        DeviceContext        deviceContext_              = nullptr;
         //! Default GPU calls behavior
         GpuApiCallBehavior   transferKind_               = GpuApiCallBehavior::Async;
         //! Padding size for the coordinates buffer
index 66cdfda9e950e45321d50a54a772178ed9a604b8..89446f247759253f88a37854c1e3a810930bb23b 100644 (file)
@@ -63,7 +63,7 @@ namespace gmx
 {
 
 StatePropagatorDataGpu::Impl::Impl(gmx_unused const void *commandStream,
-                                   gmx_unused const void *gpuContext,
+                                   gmx_unused const void *deviceContext,
                                    GpuApiCallBehavior     transferKind,
                                    int                    paddingSize) :
     transferKind_(transferKind),
@@ -79,9 +79,9 @@ StatePropagatorDataGpu::Impl::Impl(gmx_unused const void *commandStream,
     {
         commandStream_ = *static_cast<const CommandStream*>(commandStream);
     }
-    if (gpuContext != nullptr)
+    if (deviceContext != nullptr)
     {
-        gpuContext_ = *static_cast<const Context*>(gpuContext);
+        deviceContext_ = *static_cast<const DeviceContext*>(deviceContext);
     }
 #endif
 
@@ -94,7 +94,7 @@ StatePropagatorDataGpu::Impl::~Impl()
 void StatePropagatorDataGpu::Impl::reinit(int numAtomsLocal, int numAtomsAll)
 {
 #if GMX_GPU == GMX_GPU_OPENCL
-    GMX_ASSERT(gpuContext_ != nullptr, "GPU context should be set in OpenCL builds.");
+    GMX_ASSERT(deviceContext_ != nullptr, "GPU context should be set in OpenCL builds.");
 #endif
     numAtomsLocal_ = numAtomsLocal;
     numAtomsAll_   = numAtomsAll;
@@ -109,7 +109,7 @@ void StatePropagatorDataGpu::Impl::reinit(int numAtomsLocal, int numAtomsAll)
         numAtomsPadded = numAtomsAll_;
     }
 
-    reallocateDeviceBuffer(&d_x_, DIM*numAtomsPadded, &d_xSize_, &d_xCapacity_, gpuContext_);
+    reallocateDeviceBuffer(&d_x_, DIM*numAtomsPadded, &d_xSize_, &d_xCapacity_, deviceContext_);
 
     const size_t paddingAllocationSize = numAtomsPadded - numAtomsAll_;
     if (paddingAllocationSize > 0)
@@ -117,8 +117,8 @@ void StatePropagatorDataGpu::Impl::reinit(int numAtomsLocal, int numAtomsAll)
         clearDeviceBufferAsync(&d_x_, DIM*numAtomsAll_, DIM*paddingAllocationSize, commandStream_);
     }
 
-    reallocateDeviceBuffer(&d_v_, DIM*numAtomsAll_, &d_vSize_, &d_vCapacity_, gpuContext_);
-    reallocateDeviceBuffer(&d_f_, DIM*numAtomsAll_, &d_fSize_, &d_fCapacity_, gpuContext_);
+    reallocateDeviceBuffer(&d_v_, DIM*numAtomsAll_, &d_vSize_, &d_vCapacity_, deviceContext_);
+    reallocateDeviceBuffer(&d_f_, DIM*numAtomsAll_, &d_fSize_, &d_fCapacity_, deviceContext_);
 
 }
 
@@ -155,7 +155,7 @@ void StatePropagatorDataGpu::Impl::copyToDevice(DeviceBuffer<float>
 {
 
 #if GMX_GPU == GMX_GPU_OPENCL
-    GMX_ASSERT(gpuContext_ != nullptr, "GPU context should be set in OpenCL builds.");
+    GMX_ASSERT(deviceContext_ != nullptr, "GPU context should be set in OpenCL builds.");
 #endif
 
     GMX_UNUSED_VALUE(dataSize);
@@ -187,7 +187,7 @@ void StatePropagatorDataGpu::Impl::copyFromDevice(gmx::ArrayRef<gmx::RVec>  h_da
 {
 
 #if GMX_GPU == GMX_GPU_OPENCL
-    GMX_ASSERT(gpuContext_ != nullptr, "GPU context should be set in OpenCL builds.");
+    GMX_ASSERT(deviceContext_ != nullptr, "GPU context should be set in OpenCL builds.");
 #endif
 
     GMX_UNUSED_VALUE(dataSize);
@@ -284,11 +284,11 @@ int StatePropagatorDataGpu::Impl::numAtomsAll()
 
 
 StatePropagatorDataGpu::StatePropagatorDataGpu(const void        *commandStream,
-                                               const void        *gpuContext,
+                                               const void        *deviceContext,
                                                GpuApiCallBehavior transferKind,
                                                int                paddingSize)
     : impl_(new Impl(commandStream,
-                     gpuContext,
+                     deviceContext,
                      transferKind,
                      paddingSize))
 {
index 3641d5eb5f38d120b22c5eae034b8b61ed784208..71e25d23b110b905aa579168ccde66f0fe3f1056 100644 (file)
@@ -550,7 +550,7 @@ void gpu_init_pairlist(gmx_nbnxn_cuda_t          *nb,
         iTimers.didPairlistH2D = true;
     }
 
-    Context context = nullptr;
+    DeviceContext context = nullptr;
 
     reallocateDeviceBuffer(&d_plist->sci, h_plist->sci.size(),
                            &d_plist->nsci, &d_plist->sci_nalloc, context);
index a26ab41c990e8f6f643860f02baf1dceadac1dc8..4123a65e39f32176e07174cecec52246eb61e44b 100644 (file)
@@ -823,7 +823,7 @@ void gpu_init_pairlist(gmx_nbnxn_ocl_t           *nb,
     }
 
     // TODO most of this function is same in CUDA and OpenCL, move into the header
-    Context context = nb->dev_rundata->context;
+    DeviceContext context = nb->dev_rundata->context;
 
     reallocateDeviceBuffer(&d_plist->sci, h_plist->sci.size(),
                            &d_plist->nsci, &d_plist->sci_nalloc, context);