Merge pull request #5793 from kjetilly/opencl_optional

Make OpenCL optional
This commit is contained in:
Arne Morten Kvarving
2024-12-11 13:52:56 +01:00
committed by GitHub

View File

@@ -37,6 +37,7 @@ option(USE_TRACY_PROFILER "Enable tracy profiling" OFF)
option(CONVERT_CUDA_TO_HIP "Convert CUDA code to HIP (to run on AMD cards)" OFF)
option(USE_HYPRE "Use the Hypre library for linear solvers?" OFF)
set(OPM_COMPILE_COMPONENTS "2;3;4;5;6;7" CACHE STRING "The components to compile support for")
option(USE_OPENCL "Enable OpenCL support?" ON)
# Ensure OPM_COMPILE_COMPONENTS is a list of at least one element
if(OPM_COMPILE_COMPONENTS STREQUAL "")
@@ -222,9 +223,10 @@ if(CUDA_FOUND)
endif()
endif()
find_package(OpenCL)
if (USE_OPENCL)
find_package(OpenCL)
if(OpenCL_FOUND)
if(OpenCL_FOUND)
# the current OpenCL implementation relies on cl2.hpp, not cl.hpp
# make sure it is available, otherwise disable OpenCL
find_file(CL2_HPP CL/cl2.hpp HINTS ${OpenCL_INCLUDE_DIRS})
@@ -254,10 +256,11 @@ if(OpenCL_FOUND)
add_compile_options(-DCHOW_PATEL_GPU_PARALLEL=0)
endif()
endif()
else()
else()
if(USE_CHOW_PATEL_ILU)
message(FATAL_ERROR " CHOW_PATEL_ILU only works for openclSolver, but OpenCL was not found")
endif()
endif()
endif()
find_package(amgcl)