Skip to content
Snippets Groups Projects
Commit 7561ad00 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Merge branch 'rf/cuda-linking' into 'master'

Rf/cuda linking

See merge request !14
parents 5d57079a 177562ac
No related branches found
Tags 2107.1
1 merge request!14Rf/cuda linking
Pipeline #9587 passed
# FSL base project changelog
## 2107.1 (Friday 9th July 2021)
- Fix an issue with CUDA linking.
## 2107.0 (Thursday 8th July 2021)
- Allow CUDA projects to statically link to the CUDA runtime and
......
......@@ -16,3 +16,19 @@ Prior to FSL 6.1.X, the contents of this project were provided by the
The `.ci` directory contains a collection of tests which validate the
behaviour of various aspects of the `base` project. All tests are written
in Python, and are executed with `pytest`.
## CUDA build options
The following options may be used to control compilation of a CUDA project:
- `CUDA_HOME`: Specify the path to the CUDA installation directory
- `CUDA_STATIC`: Statically link against the CUDA runtime and certain;
CUDA Toolkit libraris (default is to use dynamic linking).
- `GENCODEFLAGS`: `-gencode` options specifying the device architectures to
compile device code for (default is to use the
`config/supportedGencodes.sh` script).
For example, to compile a CUDA project with a specific CUDA installation, and
using static linking:
make CUDA_STATIC=1 CUDA_HOME=/usr/local/cuda-10.1
......@@ -151,6 +151,7 @@ ifneq ($(shell which nvcc), )
# Link CUDA libraries statically, if compilation
# was invoked with "make CUDA_STATIC=1".
_CUDALIBS = -lcuda
ifdef CUDA_STATIC
# The cuda/cudart libs are handled by nvcc. Other
# components of the CUDA toolkit are provided as
......@@ -159,11 +160,11 @@ ifneq ($(shell which nvcc), )
# (see vars.mk)
# Other CUDA toolkit components will be added here
# on an as-needed basis.
NVCCFLAGS += --cudart=static
_CUDALIBS = $(subst -lcublas,-lcublas_static -lcublasLt_static -lculibos, \
NVCCFLAGS += --cudart=static --cudadevrt=static
_CUDALIBS += $(subst -lcublas,-lcublas_static -lcublasLt_static -lculibos, \
$(subst -lcurand,-lcurand_static,${CUDALIBS}))
else
NVCCFLAGS += --cudart=shared
_CUDALIBS = ${CUDALIBS}
NVCCFLAGS += --cudart=shared --cudadevrt=static
_CUDALIBS += ${CUDALIBS}
endif
endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment