Fix compiler warnings with OpenCL + oneAPI 2021.4
[alexxy/gromacs.git] / src / gromacs / gpu_utils / device_context_ocl.cpp
index e8deb7fab23601e6f7f446566673eefce57075d0..7cd75a04db3db9720b7bd13f46578832282ac016 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
  */
 #include "gmxpre.h"
 
-#include "device_context_ocl.h"
-
+#include "gromacs/gpu_utils/device_context.h"
 #include "gromacs/hardware/device_information.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/stringutil.h"
 
+#ifndef DOXYGEN
+
 /*! \brief Copies of values from cl_driver_diagnostics_intel.h,
  * which isn't guaranteed to be available. */
 /**@{*/
-#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4
+#    ifndef CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL
+#        define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
+#    endif
+#    ifndef CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL
+#        define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1
+#    endif
+#    ifndef CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL
+#        define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2
+#    endif
+#    ifndef CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL
+#        define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4
+#    endif
 /**@}*/
 
-#ifndef DOXYGEN
-
 DeviceContext::DeviceContext(const DeviceInformation& deviceInfo) : deviceInfo_(deviceInfo)
 {
     cl_platform_id                     platformId = deviceInfo.oclPlatformId;
@@ -85,7 +92,8 @@ DeviceContext::DeviceContext(const DeviceInformation& deviceInfo) : deviceInfo_(
     {
         GMX_THROW(gmx::InternalError(gmx::formatString(
                 "Failed to create OpenCL context on device %s (OpenCL error ID %d).",
-                deviceInfo.device_name, clError)));
+                deviceInfo.device_name,
+                clError)));
     }
 }