Skip to content

Commit e335dfc

Browse files
committed
GPU: stop considering OpenCL on macOS
macOS ships OpenCL 1.2, below the 2.x the OpenCL backend requires, so find_package(OpenCL) there could never produce a usable backend: the version check dropped it again a few lines later. Skip the lookup on Apple instead. With that, CUDA_ENABLED, OPENCL_ENABLED and HIP_ENABLED are all necessarily off on macOS, which makes the Darwin arm of the backend dispatch dead code. Drop it along with its warning and unindent the rest.
1 parent d7aa492 commit e335dfc

2 files changed

Lines changed: 35 additions & 36 deletions

File tree

GPU/GPUTracking/CMakeLists.txt

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -464,40 +464,36 @@ endif()
464464

465465
# Add CMake recipes for GPU Tracking librararies
466466
if(CUDA_ENABLED OR OPENCL_ENABLED OR HIP_ENABLED)
467-
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
468-
message(WARNING "GPU Tracking disabled on MacOS")
469-
else()
470-
make_directory(${CMAKE_CURRENT_BINARY_DIR}/genGPUArch)
471-
set(GPU_CONST_PARAM_FILES)
472-
foreach(GPU_ARCH ${GPU_CONST_PARAM_ARCHITECTUES})
473-
set(PARAMFILE ${CMAKE_CURRENT_BINARY_DIR}/genGPUArch/gpu_const_param_${GPU_ARCH}.par)
474-
add_custom_command(
475-
OUTPUT ${PARAMFILE}
476-
COMMAND bash -c
477-
"echo -e '#define GPUCA_GPUTYPE_${GPU_ARCH}\\n#define PARAMETER_FILE \"GPUDefParametersDefaults.h\"\\ngInterpreter->AddIncludePath(\"${CMAKE_CURRENT_SOURCE_DIR}/Definitions\");\\ngInterpreter->AddIncludePath(\"${ON_THE_FLY_DIR}\");\\n.x ${CMAKE_CURRENT_SOURCE_DIR}/Standalone/tools/dumpGPUDefParam.C(\"${PARAMFILE}\")\\n.q\\n'"
478-
| root -l -b > /dev/null
479-
VERBATIM
480-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/genGPUArch
481-
MAIN_DEPENDENCY Standalone/tools/dumpGPUDefParam.C
482-
DEPENDS ${GPU_DEFAULT_PARAMS_HEADER}
483-
${GPU_DEFAULT_PARAMS_HEADER_DEVICE}
484-
${ON_THE_FLY_DIR}/GPUDefParametersLoadPrepare.h
485-
${ON_THE_FLY_DIR}/GPUDefParametersLoad.inc
486-
COMMENT "Generating GPU parameter set for architecture ${GPU_ARCH}")
487-
LIST(APPEND GPU_CONST_PARAM_FILES ${PARAMFILE})
488-
endforeach()
489-
add_custom_target(${MODULE}_GPU_CONST_PARAM_ARCHS ALL DEPENDS ${GPU_CONST_PARAM_FILES})
490-
install(FILES ${GPU_CONST_PARAM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/GPU/arch_param)
491-
492-
if(CUDA_ENABLED)
493-
add_subdirectory(Base/cuda)
494-
endif()
495-
if(OPENCL_ENABLED)
496-
add_subdirectory(Base/opencl)
497-
endif()
498-
if(HIP_ENABLED)
499-
add_subdirectory(Base/hip)
500-
endif()
467+
make_directory(${CMAKE_CURRENT_BINARY_DIR}/genGPUArch)
468+
set(GPU_CONST_PARAM_FILES)
469+
foreach(GPU_ARCH ${GPU_CONST_PARAM_ARCHITECTUES})
470+
set(PARAMFILE ${CMAKE_CURRENT_BINARY_DIR}/genGPUArch/gpu_const_param_${GPU_ARCH}.par)
471+
add_custom_command(
472+
OUTPUT ${PARAMFILE}
473+
COMMAND bash -c
474+
"echo -e '#define GPUCA_GPUTYPE_${GPU_ARCH}\\n#define PARAMETER_FILE \"GPUDefParametersDefaults.h\"\\ngInterpreter->AddIncludePath(\"${CMAKE_CURRENT_SOURCE_DIR}/Definitions\");\\ngInterpreter->AddIncludePath(\"${ON_THE_FLY_DIR}\");\\n.x ${CMAKE_CURRENT_SOURCE_DIR}/Standalone/tools/dumpGPUDefParam.C(\"${PARAMFILE}\")\\n.q\\n'"
475+
| root -l -b > /dev/null
476+
VERBATIM
477+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/genGPUArch
478+
MAIN_DEPENDENCY Standalone/tools/dumpGPUDefParam.C
479+
DEPENDS ${GPU_DEFAULT_PARAMS_HEADER}
480+
${GPU_DEFAULT_PARAMS_HEADER_DEVICE}
481+
${ON_THE_FLY_DIR}/GPUDefParametersLoadPrepare.h
482+
${ON_THE_FLY_DIR}/GPUDefParametersLoad.inc
483+
COMMENT "Generating GPU parameter set for architecture ${GPU_ARCH}")
484+
LIST(APPEND GPU_CONST_PARAM_FILES ${PARAMFILE})
485+
endforeach()
486+
add_custom_target(${MODULE}_GPU_CONST_PARAM_ARCHS ALL DEPENDS ${GPU_CONST_PARAM_FILES})
487+
install(FILES ${GPU_CONST_PARAM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/GPU/arch_param)
488+
489+
if(CUDA_ENABLED)
490+
add_subdirectory(Base/cuda)
491+
endif()
492+
if(OPENCL_ENABLED)
493+
add_subdirectory(Base/opencl)
494+
endif()
495+
if(HIP_ENABLED)
496+
add_subdirectory(Base/hip)
501497
endif()
502498
endif()
503499

dependencies/FindO2GPU.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ set(HIP_AMDGPUTARGET_DEFAULT_MINIMAL gfx906)
2020
if(NOT DEFINED ENABLE_CUDA)
2121
set(ENABLE_CUDA "AUTO")
2222
endif()
23-
if(NOT DEFINED ENABLE_OPENCL)
24-
set(ENABLE_OPENCL "AUTO")
23+
if(NOT APPLE)
24+
# macOS ships OpenCL 1.2 only, below the 2.x that the OpenCL backend needs.
25+
if(NOT DEFINED ENABLE_OPENCL)
26+
set(ENABLE_OPENCL "AUTO")
27+
endif()
2528
endif()
2629
if(NOT DEFINED ENABLE_HIP)
2730
set(ENABLE_HIP "AUTO")

0 commit comments

Comments
 (0)