From 88bb71e92416a736afac9f619ef9fd99070167c9 Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Mon, 11 Apr 2022 15:44:05 -0700 Subject: [PATCH] Disable building GPU extension if IMPLICIT_DISABLE_CUDA environment variable is set Add an option to build implicit without the GPU extension, if the IMPLICIT_DISABLE_CUDA is set. Closes https://github.com/benfred/implicit/issues/446 --- implicit/gpu/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/implicit/gpu/CMakeLists.txt b/implicit/gpu/CMakeLists.txt index 4a339cc7..3f82c4b4 100644 --- a/implicit/gpu/CMakeLists.txt +++ b/implicit/gpu/CMakeLists.txt @@ -4,6 +4,11 @@ find_package(CUDAToolkit) if(CUDAToolkit_FOUND) if (${CUDAToolkit_VERSION} VERSION_LESS "11.0.0") message("implicit requires CUDA 11.0 or greater for GPU acceleration - found CUDA ${CUDAToolkit_VERSION}") + +elseif(DEFINED ENV{IMPLICIT_DISABLE_CUDA}) + # disable building the CUDA extension if the IMPLICIT_DISABLE_CUDA environment variable is set + message("Disabling building the GPU extension since IMPLICIT_DISABLE_CUDA env var is set") + else() enable_language(CUDA) add_cython_target(_cuda CXX)