From 8c46ed4a7f635733faf57f0f7de4697edcaa875f Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 6 Dec 2024 14:33:04 -0800 Subject: [PATCH] Allow CUDA override only during package build --- recipe/build.sh | 2 ++ recipe/patches/0010-Allow-overriding-CUDA-related-paths.patch | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/recipe/build.sh b/recipe/build.sh index 477ba3f2..d5174793 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -2,6 +2,8 @@ set -ex +export IN_PYTORCH_BUILD + # https://github.com/conda-forge/pytorch-cpu-feedstock/issues/243 # https://github.com/pytorch/pytorch/blob/v2.3.1/setup.py#L341 export PACKAGE_TYPE=conda diff --git a/recipe/patches/0010-Allow-overriding-CUDA-related-paths.patch b/recipe/patches/0010-Allow-overriding-CUDA-related-paths.patch index 4e7808a8..95da09a2 100644 --- a/recipe/patches/0010-Allow-overriding-CUDA-related-paths.patch +++ b/recipe/patches/0010-Allow-overriding-CUDA-related-paths.patch @@ -17,7 +17,7 @@ index ec9ae530..76d1fb9a 100644 # We compute the rest based on those here to avoid re-searching and to avoid finding a possibly # different installation. -if(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT) -+if(FALSE) ++if(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT AND NOT ENV{IN_PYTORCH_BUILD}) set(CUDAToolkit_ROOT_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}") set(CUDAToolkit_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}") set(CUDAToolkit_VERSION "${CMAKE_CUDA_COMPILER_TOOLKIT_VERSION}")