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

RF: Change CUDA configuration - now, nvcc just needs to be on the $PATH, or

the $NVCC variable needs to be set - CUDA_VER / CUDA_HOME are set
automatically from nvcc
parent b670473e
No related branches found
No related tags found
1 merge request!16Rf/default cuda home
......@@ -114,25 +114,17 @@ endif
#####################################################################
#
# Default compiler commands, flags, and basic external libraries for
# CUDA projects.
# CUDA projects. nvcc must be on the $PATH, or $NVCC must be set.
#
#####################################################################
ifneq ($(shell which nvcc), )
# NVCC, CUDA_HOME, CUDA_VER, GENCODEFLAGS,
# NVCCFLAGS, NVCCLDFLAGS, and CUDA_STATIC
# may be specified/overridden by the
# environment.
# We specifically use variable names "CUDA_VER"
# and "CUDA_HOME" because they will be set in
# the FSL CUDA docker image environments (and
# will take precedence over these definitions
# here when they are set).
NVCC ?= nvcc
CUDA_VER ?= $(shell ${NVCC} --version | grep -Po "release \K[0-9\.]+")
CUDA_HOME ?= /usr/local/cuda-${CUDA_VER}
NVCC ?= $(shell which nvcc)
ifneq (${NVCC}, )
# NVCC, GENCODEFLAGS, NVCCFLAGS, NVCCLDFLAGS,
# and CUDA_STATIC may be specified/overridden
# by the environment.
CUDA_HOME = $(shell dirname ${NVCC})/../
CUDA_VER = $(shell ${NVCC} --version | grep -Po "release \K[0-9\.]+")
GENCODEFLAGS ?= $(shell ${FSLCONFDIR}/supportedGencodes.sh ${CUDA_VER})
# We specify the compiler to use with -ccbin, as
......@@ -151,6 +143,8 @@ ifneq ($(shell which nvcc), )
# Link CUDA libraries statically, if compilation
# was invoked with "make CUDA_STATIC=1".
# Compiler / linker options vary depending on the
# CUDA version
_CUDALIBS = -lcuda
ifdef CUDA_STATIC
# The cuda/cudart/cudadevrt libs are handled by nvcc.
......@@ -176,7 +170,11 @@ ifneq ($(shell which nvcc), )
_CUDALIBS += $(subst -lcublas,${CUBLAS_STATIC}, \
$(subst -lcurand,-lcurand_static,${CUDALIBS}))
else
NVCCFLAGS += --cudart=shared --cudadevrt=static
ifeq ($(patsubst 9.%,,${CUDA_VER}),)
NVCCFLAGS += --cudart=shared
else
NVCCFLAGS += --cudart=shared --cudadevrt=static
endif
_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