Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions recipe/run_conda_forge_build_setup_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,23 @@ for %%i in ("%~dp0.") do set "SCRIPT_DIR=%%~fi"
<cuda.version set /p CUDA_VERSION=
del cuda.version
if not "%CUDA_VERSION%" == "None" (
call "%SCRIPT_DIR%\install_cuda.bat" %CUDA_VERSION%
if errorlevel 1 (
echo Could not install CUDA
exit 1
if "%CUDA_VERSION:~0,2%" == "12" (

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw I tried to make this line more robust

Suggested change
if "%CUDA_VERSION:~0,2%" == "12" (
for /f "delims=." %%f in ("%CUDA_VERSION%") do (set /a "CUDA_MAJOR_VERSION=%%f")
if %CUDA_MAJOR_VERSION% geq 12 (

but for some reason the CI just hated the change (it worked fine locally), so I didn't use it here... Like John said, in the future we'll drop most of the complex logic here, so I hope this is OK.

:: Don't call install_cuda, as we'll get CUDA packages from CF
set "CUDA_PATH="
set "CONDA_OVERRIDE_CUDA=%CUDA_VERSION%"
:: Export CONDA_OVERRIDE_CUDA to allow __cuda to be detected on CI systems without GPUs
echo set "CONDA_OVERRIDE_CUDA=%CONDA_OVERRIDE_CUDA%" >> "%CONDA_PREFIX%\etc\conda\activate.d\conda-forge-ci-setup-activate.bat"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this, too, in the 12.x case? It also looks like it doesn't really do anything as it sets the variable to itself.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the comment is self-explanatory? Also, this treatment is copied from existing code (see line 133-134 below), I didn't reinvent any wheel 🙂

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the comment is self-explanatory?

Not fully. Reading the source again, it makes sense. "Bake-in" instead of "Export" would have made it clear to me but probably not to everyone else. Happy to keep it as-is.

@jakirkham jakirkham Nov 6, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically with how CUDA 11 is handled (both on Linux and Windows), most CUDA packages come from the system. There is a bunch of logic here to handle those CUDA 11 cases

With CUDA 12, we now have Conda packages and so don't need to use that logic. Eventually we could drop the CUDA 11 logic from here when we drop CUDA 11. In the interim, we just need to make sure we "do nothing" on CUDA 12

Edit: Though independent of CUDA version, we still have an issue when building on machines that don't have a GPU. Namely we need to convince Conda that it is ok to install CUDA dependent packages there. So we set this variable to tell Conda what CUDA version we support

) else (
call "%SCRIPT_DIR%\install_cuda.bat" %CUDA_VERSION%
if errorlevel 1 (
echo Could not install CUDA
exit 1
)
:: We succeeded! Export paths
set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION%"
set "PATH=%PATH%;%CUDA_PATH%\bin"
set "CONDA_OVERRIDE_CUDA=%CUDA_VERSION%"
)
:: We succeeded! Export paths
set "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION%"
set "PATH=%PATH%;%CUDA_PATH%\bin"
set "CONDA_OVERRIDE_CUDA=%CUDA_VERSION%"
)
:: /CUDA

Expand Down