Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Windows + CUDA #1585

Open
wants to merge 23 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/dependencies/windows_install_cuda.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env pwsh
#
# Copyright 2024 The AMReX Community
#
# License: BSD-3-Clause-LBNL
# Authors: Axel Huebl

# fail on first error
$ErrorActionPreference = "Stop"

# skip if already installed
if (Test-Path "C:\Program Files\NVIDIA GPU Computing Toolkit\") { exit }

# configure
$cuda_version_long = '12.4.0'
$cuda_version_short = '12.4'

# download
New-item -ItemType directory -Name cuda
Set-Location -Path cuda -PassThru
Invoke-WebRequest -Uri "https://developer.download.nvidia.com/compute/cuda/${cuda_version_long}/network_installers/cuda_${cuda_version_long}_windows_network.exe" -OutFile "cuda_install.exe"

# install
$CudaFeatures = " nvcc_${cuda_version_short} " + `
" cublas_${cuda_version_short} " + `
" cublas_dev_${cuda_version_short} " + `
" cuda_profiler_api_${cuda_version_short} " + `
" cudart_${cuda_version_short} " + `
" cufft_${cuda_version_short} " + `
" cufft_dev_${cuda_version_short} " + `
" cuobjdump_${cuda_version_short} " + `
" cupti_${cuda_version_short} " + `
" curand_${cuda_version_short} " + `
" curand_dev_${cuda_version_short} " + `
" cusolver_${cuda_version_short} " + `
" cusolver_dev_${cuda_version_short} " + `
" cusparse_${cuda_version_short} " + `
" cusparse_dev_${cuda_version_short} " + `
" cuxxfilt_${cuda_version_short} " + `
" npp_${cuda_version_short} " + `
" npp_dev_${cuda_version_short} " + `
" nvdisasm_${cuda_version_short} " + `
" nvjitlink_${cuda_version_short} " + `
" nvjpeg_${cuda_version_short} " + `
" nvjpeg_dev_${cuda_version_short} " + `
" nvml_dev_${cuda_version_short} " + `
" nvprof_${cuda_version_short} " + `
" nvprune_${cuda_version_short} " + `
" nvrtc_${cuda_version_short} " + `
" nvrtc_dev_${cuda_version_short} " + `
" nvtx_${cuda_version_short} " + `
" sanitizer_${cuda_version_short} " + `
" thrust_${cuda_version_short} " + `
" visual_studio_integration_${cuda_version_short} "

$SilentFlag = '-s '
Start-Process -FilePath '.\cuda_install.exe' -ArgumentList @($SilentFlag + $CudaFeatures) -Wait -NoNewWindow

# cleanup
Remove-Item cuda_install.exe
ax3l marked this conversation as resolved.
Show resolved Hide resolved

# GitHub actions env updates
if (Test-Path "env:GITHUB_ACTIONS") {
echo "Adding CUDA to CUDA_PATH and PATH"
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${cuda_version_short}"
echo "CUDA_PATH=$env:CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:CUDA_PATH/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
39 changes: 39 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,42 @@ jobs:
# name: pr_number
# path: pr_number.txt
# retention-days: 1

# Build libamrex and all tutorials with CUDA
tutorials-cuda:
name: MSVC C++17 w/ CUDA@12.4 w/o Fortran w/o MPI
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Install CUDA
shell: powershell
run: .github\workflows\dependencies\windows_install_cuda.ps1
- name: Build & Install
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\vc\Auxiliary\build\vcvarsall.bat" x64
SET "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
ax3l marked this conversation as resolved.
Show resolved Hide resolved
SET "CUDA_HOME=%CUDA_PATH%"
SET "CUDA_TOOLKIT_ROOT_DIR=%CUDA_PATH%"
SET "CMAKE_PREFIX_PATH=%CUDA_PATH%;%CMAKE_PREFIX_PATH%"
SET "PATH=%CUDA_PATH%\bin\;%PATH%"
SET "PATH=%CUDA_PATH%\libnvvp\;%PATH%"
ax3l marked this conversation as resolved.
Show resolved Hide resolved
SET "CUDACXX=%CUDA_PATH%\bin\nvcc.exe"

cmake -S . -B build ^
-A x64 ^
-DCMAKE_GENERATOR_TOOLSET="cuda=12.4" ^
-DCUDA_TOOLKIT_ROOT_DIR="%CUDA_PATH%" ^
-DCUDAToolkit_ROOT="%CUDA_PATH%" ^
ax3l marked this conversation as resolved.
Show resolved Hide resolved
-DCMAKE_BUILD_TYPE=Release ^
-DAMReX_CUDA_ARCH=8.0 ^
-DAMReX_FORTRAN=OFF ^
-DAMReX_GPU_BACKEND=CUDA ^
-DAMReX_MPI=OFF ^
-DAMReX_PARTICLES=ON

cmake --build build --config Release -j 4

cmake --build build --config Release --target install

# use "cmd", see https://gitlab.kitware.com/cmake/cmake/-/issues/20281