diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index b0b6759d8..fd3769af9 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -227,7 +227,7 @@ jobs: for tarball in "-manylinux_2_28" "-manylinux2014"; do rm -rf ITKPythonPackage export TARBALL_SPECIALIZATION=${tarball} - ./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 }} + ./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 }} done @@ -361,7 +361,7 @@ jobs: set PATH=C:\P\grep;%PATH% set CC=cl.exe set CXX=cl.exe - 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" + 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" - name: Publish Python package as GitHub Artifact uses: actions/upload-artifact@v1 diff --git a/INSTALLATION.md b/INSTALLATION.md index 2b6f95b0e..a695bac4f 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -9,6 +9,7 @@ RTK is a module of [ITK](https://www.itk.org), the Insight Toolkit. Follow the i * `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. * `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). * `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. +* `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. * `RTK_CUDA_PROJECTIONS_SLAB_SIZE`: Set the number of projections processed at once in CUDA processing. Default is 16. * `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`. diff --git a/itk-module-init.cmake b/itk-module-init.cmake index 9a7e0785d..ee9172caa 100644 --- a/itk-module-init.cmake +++ b/itk-module-init.cmake @@ -32,14 +32,21 @@ endif() option(RTK_USE_CUDA "Use CUDA for RTK" ${RTK_USE_CUDA_DEFAULT}) # Configure CUDA compilation options +option(RTK_CUDA_VERSION "Specify the exact CUDA version that must be used for RTK") if(RTK_USE_CUDA) enable_language(CUDA) set(CMAKE_CUDA_RUNTIME_LIBRARY Static) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) - find_package(CUDAToolkit REQUIRED 8.0) + if(RTK_CUDA_VERSION) + find_package(CUDAToolkit EXACT ${RTK_CUDA_VERSION}) + else() + find_package(CUDAToolkit REQUIRED 8.0) + endif() set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-declarations") set(RTK_CUDA_PROJECTIONS_SLAB_SIZE "16" CACHE STRING "Number of projections processed simultaneously in CUDA forward and back projections") +elseif(RTK_CUDA_VERSION) + message(FATAL_ERROR "RTK_CUDA_VERSION is set but the CUDA toolkit has not been found.") endif() diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index f435017e6..3f9ff60ac --- a/setup.py +++ b/setup.py @@ -12,10 +12,11 @@ # Configure wheel name if CUDA is used wheel_name='itk-rtk' -# Extract cuda version from the last folder name in CUDAToolkit_ROOT path. +# Extract cuda version from the RTK_CUDA_VERSION cmake option for arg in sys.argv: - if "CUDAToolkit_ROOT" in str(arg): - wheel_name += ('-' + arg.rsplit('/', 1)[-1]) + if "RTK_CUDA_VERSION" in str(arg): + cuda_version = arg.rsplit('RTK_CUDA_VERSION=', 1)[-1] + wheel_name += '-cuda' + cuda_version.replace('.', '') setup( name=wheel_name,