Reduce duplication in gpu_utils
[alexxy/gromacs.git] / src / gromacs / gpu_utils / gpu_utils_ocl.cpp
index 0e9769e4fec0b1a7497592e113042899481b4f7b..c541eb06e72d5c907858cbb7c59566f100760248 100644 (file)
@@ -100,7 +100,7 @@ runningOnCompatibleOSForAmd()
  * \returns             true if the GPU properties passed indicate a compatible
  *                      GPU, otherwise false.
  */
-static int is_gmx_supported_gpu_id(struct gmx_device_info_t *ocl_gpu_device)
+static int is_gmx_supported_gpu_id(gmx_device_info_t *ocl_gpu_device)
 {
     if ((getenv("GMX_OCL_DISABLE_COMPATIBILITY_CHECK")) != nullptr)
     {
@@ -346,43 +346,6 @@ void findGpus(gmx_gpu_info_t *gpu_info)
     sfree(ocl_platform_ids);
 }
 
-//! This function is documented in the header file
-void free_gpu_info(const gmx_gpu_info_t gmx_unused *gpu_info)
-{
-    if (gpu_info == nullptr)
-    {
-        return;
-    }
-
-    sfree(gpu_info->gpu_dev);
-}
-
-//! This function is documented in the header file
-std::vector<int> getCompatibleGpus(const gmx_gpu_info_t &gpu_info)
-{
-    // Possible minor over-allocation here, but not important for anything
-    std::vector<int> compatibleGpus;
-    compatibleGpus.reserve(gpu_info.n_dev);
-    for (int i = 0; i < gpu_info.n_dev; i++)
-    {
-        assert(gpu_info.gpu_dev);
-        if (gpu_info.gpu_dev[i].stat == egpuCompatible)
-        {
-            compatibleGpus.push_back(i);
-        }
-    }
-    return compatibleGpus;
-}
-
-//! This function is documented in the header file
-const char *getGpuCompatibilityDescription(const gmx_gpu_info_t &gpu_info,
-                                           int                   index)
-{
-    return (index >= gpu_info.n_dev ?
-            gpu_detect_res_str[egpuNonexistent] :
-            gpu_detect_res_str[gpu_info.gpu_dev[index].stat]);
-}
-
 //! This function is documented in the header file
 void get_gpu_device_info_string(char *s, const gmx_gpu_info_t &gpu_info, int index)
 {
@@ -470,3 +433,8 @@ void gpu_set_host_malloc_and_free(bool               bUseGpuKernels,
         *nb_free  = nullptr;
     }
 }
+
+int gpu_info_get_stat(const gmx_gpu_info_t &info, int index)
+{
+    return info.gpu_dev[index].stat;
+}