Skip to content

Commit 21dd15e

Browse files
author
Simon Rit
committed
ENH: Define RTK_CUDA_VERSION for wheel names and verify it in RTK
Follow-up to 1540c58. The wheel name is now based on RTK_CUDA_VERSION which, if set, is verified in RTK.
1 parent 4e68af8 commit 21dd15e

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.github/workflows/build-test-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ jobs:
227227
for tarball in "-manylinux_2_28" "-manylinux2014"; do
228228
rm -rf ITKPythonPackage
229229
export TARBALL_SPECIALIZATION=${tarball}
230-
./dockcross-manylinux-download-cache-and-build-module-wheels.sh -c "-DCUDAToolkit_ROOT=/usr/lib64/cuda116 -DCMAKE_CUDA_COMPILER=/usr/lib64/cuda116/bin/nvcc" -x "libcuda.so;libcuda.so.1;libcudart.so;libcudart.so.11.0;libcublas.so;libcublas.so.11;libcublasLt.so;libcublasLt.so.11;libcufft.so;libcufft.so.10" cp${{ matrix.python-version }}
230+
./dockcross-manylinux-download-cache-and-build-module-wheels.sh -c "-DCUDAToolkit_ROOT=/usr/lib64/cuda116 -DCMAKE_CUDA_COMPILER=/usr/lib64/cuda116/bin/nvcc -DRTK_CUDA_VERSION=11.6" -x "libcuda.so;libcuda.so.1;libcudart.so;libcudart.so.11.0;libcublas.so;libcublas.so.11;libcublasLt.so;libcublasLt.so.11;libcufft.so;libcufft.so.10" cp${{ matrix.python-version }}
231231
done
232232
233233
@@ -361,7 +361,7 @@ jobs:
361361
set PATH=C:\P\grep;%PATH%
362362
set CC=cl.exe
363363
set CXX=cl.exe
364-
C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" --no-cleanup --lib-paths "C:/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.6/bin" --exclude-libs "nvcuda.dll;concrt140.dll;cublas64_11.dll;cublasLt64_11.dll;cudart64_110.dll;cufft64_10.dll"
364+
C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" --no-cleanup --lib-paths "C:/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.6/bin" --exclude-libs "nvcuda.dll;concrt140.dll;cublas64_11.dll;cublasLt64_11.dll;cudart64_110.dll;cufft64_10.dll" -- "-DRTK_CUDA_VERSION=11.6"
365365
366366
- name: Publish Python package as GitHub Artifact
367367
uses: actions/upload-artifact@v1

INSTALLATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RTK is a module of [ITK](https://www.itk.org), the Insight Toolkit. Follow the i
99
* `Module_RTK_GIT_TAG`: Git tag for the RTK download. By default, the RTK version which is downloaded and compiled is the one given in the [RTK.remote.cmake](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Remote/RTK.remote.cmake). Change this option to build another version. For example, you can change it to `master` to build the latest RTK version. RTK is only maintained to be backward compatible with the latest ITK release and ITK master branch.
1010
* `RTK_BUILD_APPLICATIONS`: Activates the compilation of RTK's command line tools. Although RTK is mainly a toolkit, we also provide several command line tools for doing most of the available processing. These command line tools use [gengetopt](https://www.gnu.org/software/gengetopt/gengetopt.html). Several examples are available on the [Applications](https://wiki.openrtk.org/index.php/RTK_wiki_help#Applications) section of the [wiki](http://wikiopenrtk.org).
1111
* `RTK_USE_CUDA`: Activates CUDA computation. Default is `ON` if CMake has automatically found the CUDA package and a CUDA-compatible GPU, and `OFF` otherwise.
12+
* `RTK_CUDA_VERSION`: Specifies an exact version of the CUDA toolkit which must be used. If unspecified, RTK only checks if the found version is recent enough.
1213
* `RTK_CUDA_PROJECTIONS_SLAB_SIZE`: Set the number of projections processed at once in CUDA processing. Default is 16.
1314
* `RTK_PROBE_EACH_FILTER`: Activates the timing, CPU and CUDA memory consumption of each filter. Defaults is `OFF`. When activated, each filter processing is probed and a summary can be displayed. All command line applications display the result with `--verbose`.
1415

itk-module-init.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,21 @@ endif()
3232
option(RTK_USE_CUDA "Use CUDA for RTK" ${RTK_USE_CUDA_DEFAULT})
3333

3434
# Configure CUDA compilation options
35+
option(RTK_CUDA_VERSION "Specify the exact CUDA version that must be used for RTK")
3536
if(RTK_USE_CUDA)
3637
enable_language(CUDA)
3738
set(CMAKE_CUDA_RUNTIME_LIBRARY Static)
3839

3940
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
40-
find_package(CUDAToolkit REQUIRED 8.0)
41+
if(RTK_CUDA_VERSION)
42+
find_package(CUDAToolkit EXACT ${RTK_CUDA_VERSION})
43+
else()
44+
find_package(CUDAToolkit REQUIRED 8.0)
45+
endif()
4146

4247
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
4348
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-declarations")
4449
set(RTK_CUDA_PROJECTIONS_SLAB_SIZE "16" CACHE STRING "Number of projections processed simultaneously in CUDA forward and back projections")
50+
elseif(RTK_CUDA_VERSION)
51+
message(FATAL_ERROR "RTK_CUDA_VERSION is set but the CUDA toolkit has not been found.")
4552
endif()

setup.py

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212

1313
# Configure wheel name if CUDA is used
1414
wheel_name='itk-rtk'
15-
# Extract cuda version from the last folder name in CUDAToolkit_ROOT path.
15+
# Extract cuda version from the RTK_CUDA_VERSION cmake option
1616
for arg in sys.argv:
17-
if "CUDAToolkit_ROOT" in str(arg):
18-
wheel_name += ('-' + arg.rsplit('/', 1)[-1])
17+
if "RTK_CUDA_VERSION" in str(arg):
18+
cuda_version = arg.rsplit('RTK_CUDA_VERSION=', 1)[-1]
19+
wheel_name += '-cuda' + cuda_version.replace('.', '')
1920

2021
setup(
2122
name=wheel_name,

0 commit comments

Comments
 (0)