From e70e81583a99852728b5013ff096682a47a3054c Mon Sep 17 00:00:00 2001 From: "John L. Jolly" Date: Wed, 1 Feb 2023 12:05:32 -0700 Subject: [PATCH] Only check OpenCL if CUDA enabled During the initial CMake configuration for this project, the OpenCL header would be detected, but the proper configuration would not be set for the build. This caused a failed attempt to build /stencils/3axis_cl.cpp because CL/opencl.hpp could not be found. This is resolved when CUDA is installed. When CMake detects the CUDA compiler and headers, the correct environment is set for OpenCL as well. A change was made to only attempt detection of OpenCL when CUDA was found. This is likely a problem with the OpenCL detection within CMake and optimally would be fixed in that package. Combined with the fact that bricklib OpenCL currently only works with CUDA, the best place to make this fix was within this library. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58dcbd4..2ed3119 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,9 @@ endif() find_package(OpenMP REQUIRED) find_package(MPI) -find_package(OpenCL 2.0) +if (CMAKE_CUDA_COMPILER) + find_package(OpenCL 2.0) +endif () option(BRICK_USE_MEMFD "Using memfd instead of shm_open, supported on Linux >= 3.17 with \"CONFIG_MEMFD_CREATE\"" OFF) if (BRICK_USE_MEMFD)