Move pmalloc(..)/pfree(...) to separate source files in CUDA/OpenCL/SYCL
[alexxy/gromacs.git] / src / gromacs / gpu_utils / pmalloc.cu
similarity index 78%
rename from src/gromacs/gpu_utils/pmalloc_cuda.cu
rename to src/gromacs/gpu_utils/pmalloc.cu
index 2d5e1220529a245011656c69e6c66d40b9ab3b5c..3a8f1058fe992c19a1822f90df4c6ae9461688cc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2014,2015,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2018,2019,2020,2021, 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,7 +40,7 @@
 
 #include "gmxpre.h"
 
-#include "pmalloc_cuda.h"
+#include "pmalloc.h"
 
 #include <stdlib.h>
 
@@ -70,29 +70,6 @@ void pmalloc(void** h_ptr, size_t nbytes)
     CU_RET_ERR(stat, strbuf);
 }
 
-/*! Allocates nbytes of page-locked memory with write-combining.
- *  This memory should always be freed using pfree (or with the page-locked
- *  free functions provied by the CUDA library).
- */
-void pmalloc_wc(void** h_ptr, size_t nbytes)
-{
-    cudaError_t stat;
-    char        strbuf[STRLEN];
-    int         flag = cudaHostAllocDefault | cudaHostAllocWriteCombined;
-
-    if (nbytes == 0)
-    {
-        *h_ptr = nullptr;
-        return;
-    }
-
-    gmx::ensureNoPendingDeviceError("Could not allocate page-locked memory with write-combining.");
-
-    stat = cudaMallocHost(h_ptr, nbytes, flag);
-    sprintf(strbuf, "cudaMallocHost of size %d bytes failed", (int)nbytes);
-    CU_RET_ERR(stat, strbuf);
-}
-
 /*! Frees page locked memory allocated with pmalloc.
  *  This function can safely be called also with a pointer to a page-locked
  *  memory allocated directly with CUDA API calls.