Rename OpenCL host memory routines to match the CUDA ones
authorAleksei Iupinov <a.yupinov@gmail.com>
Wed, 2 May 2018 15:37:35 +0000 (17:37 +0200)
committerAleksei Iupinov <a.yupinov@gmail.com>
Wed, 2 May 2018 16:24:40 +0000 (18:24 +0200)
Change-Id: I59a72b2533e6fe88ba9602a11fea051aef0315c7

src/gromacs/gpu_utils/gpu_utils_ocl.cpp
src/gromacs/gpu_utils/oclutils.cpp
src/gromacs/gpu_utils/oclutils.h
src/gromacs/gpu_utils/pmalloc_cuda.h
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_data_mgmt.cpp

index 6fc73a4f0220e6448a649fb8e570aefca886105d..e19bec37e714b4869ba02ce233538dcff7dcb5eb 100644 (file)
@@ -461,8 +461,8 @@ void gpu_set_host_malloc_and_free(bool               bUseGpuKernels,
 {
     if (bUseGpuKernels)
     {
-        *nb_alloc = &ocl_pmalloc;
-        *nb_free  = &ocl_pfree;
+        *nb_alloc = &pmalloc;
+        *nb_free  = &pfree;
     }
     else
     {
index eb270c0d1d547ddfef4fb839b21a6f5c05cf0e9a..cfbe2720a81032f0be90d61fe0e4a519c73dce01 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018, 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.
@@ -166,7 +166,7 @@ int ocl_copy_D2H_async(void * h_dest, cl_mem d_src,
  * \param[in,out]    h_ptr   Pointer where to store the address of the newly allocated buffer.
  * \param[in]        nbytes  Size in bytes of the buffer to be allocated.
  */
-void ocl_pmalloc(void **h_ptr, size_t nbytes)
+void pmalloc(void **h_ptr, size_t nbytes)
 {
     /* Need a temporary type whose size is 1 byte, so that the
      * implementation of snew_aligned can cope without issuing
@@ -181,11 +181,11 @@ void ocl_pmalloc(void **h_ptr, size_t nbytes)
     snew_aligned(*temporary, nbytes, 16);
 }
 
-/*! \brief Frees memory allocated with ocl_pmalloc.
+/*! \brief Frees memory allocated with pmalloc.
  *
- * \param[in]    h_ptr   Buffer allocated with ocl_pmalloc that needs to be freed.
+ * \param[in]    h_ptr   Buffer allocated with pmalloc that needs to be freed.
  */
-void ocl_pfree(void *h_ptr)
+void pfree(void *h_ptr)
 {
 
     if (h_ptr)
index cc71d888f4e17d672d4a84e475b9ddea4e4ad7ae..afe32388754d342c7b096dba517dc77cc58aba3f 100644 (file)
@@ -146,10 +146,10 @@ int ocl_copy_H2D_sync(cl_mem d_dest, void * h_src,
                       cl_command_queue command_queue);
 
 /*! \brief Allocate host memory in malloc style */
-void ocl_pmalloc(void **h_ptr, size_t nbytes);
+void pmalloc(void **h_ptr, size_t nbytes);
 
 /*! \brief Free host memory in malloc style */
-void ocl_pfree(void *h_ptr);
+void pfree(void *h_ptr);
 
 /*! \brief Convert error code to diagnostic string */
 std::string ocl_get_error_string(cl_int error);
index 4d80f8eb46cfa56bb876c055e9ef341e3223260c..9297fb9ddc6fd785fb13041eb78b1fe74293703e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2018, 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.
@@ -45,6 +45,8 @@
 
 #include "gromacs/utility/basedefinitions.h"
 
+///@cond INTERNAL
+
 /*! \brief Allocates nbytes of page-locked memory. */
 void pmalloc(void **h_ptr, size_t nbytes);
 
@@ -54,4 +56,6 @@ void pmalloc_wc(void **h_ptr, size_t nbytes);
 /*! \brief Frees page locked memory allocated with pmalloc. */
 void pfree(void *h_ptr);
 
+///@endcond
+
 #endif
index 32ebc57a4e1bebc369fda1e84d47ca9daf1ad9d7..348456c1240481df95ae4c668760328f2d474101 100644 (file)
@@ -651,9 +651,9 @@ void nbnxn_gpu_init(gmx_nbnxn_ocl_t          **p_nb,
     snew(nb->dev_rundata, 1);
 
     /* init nbst */
-    ocl_pmalloc((void**)&nb->nbst.e_lj, sizeof(*nb->nbst.e_lj));
-    ocl_pmalloc((void**)&nb->nbst.e_el, sizeof(*nb->nbst.e_el));
-    ocl_pmalloc((void**)&nb->nbst.fshift, SHIFTS * sizeof(*nb->nbst.fshift));
+    pmalloc((void**)&nb->nbst.e_lj, sizeof(*nb->nbst.e_lj));
+    pmalloc((void**)&nb->nbst.e_el, sizeof(*nb->nbst.e_el));
+    pmalloc((void**)&nb->nbst.fshift, SHIFTS * sizeof(*nb->nbst.fshift));
 
     init_plist(nb->plist[eintLocal]);
 
@@ -1089,13 +1089,13 @@ void nbnxn_gpu_free(gmx_nbnxn_ocl_t *nb)
     }
 
     /* Free nbst */
-    ocl_pfree(nb->nbst.e_lj);
+    pfree(nb->nbst.e_lj);
     nb->nbst.e_lj = NULL;
 
-    ocl_pfree(nb->nbst.e_el);
+    pfree(nb->nbst.e_el);
     nb->nbst.e_el = NULL;
 
-    ocl_pfree(nb->nbst.fshift);
+    pfree(nb->nbst.fshift);
     nb->nbst.fshift = NULL;
 
     /* Free command queues */