Skip to content

Commit

Permalink
ENH: Define RTK_CUDA_VERSION for wheel names and verify it in RTK
Browse files Browse the repository at this point in the history
Follow-up to 1540c58. The wheel name is
now based on RTK_CUDA_VERSION which, if set, is verified in RTK.
  • Loading branch information
Simon Rit committed Oct 29, 2022
1 parent 4e68af8 commit 21dd15e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
9 changes: 8 additions & 1 deletion itk-module-init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 4 additions & 3 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 21dd15e

Please sign in to comment.