Commit df6036ac authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

DOC: update CUDA example

parent bf5f8ba4
......@@ -2,10 +2,12 @@ include ${FSLCONFDIR}/default.mk
PROJNAME = example_cuda_project
# All shared library dependencies required
# for linking CUDA libraries and executables
# must be added as CUDALIBS
CUDALIBS = -lcudart -lcuda
# All shared library dependencies required for
# linking CUDA libraries and executables must be
# added as CUDALIBS. -lcuda and -lcudart are
# automatically added by the common Makefile
# rules in $FSLDIR/config/buildSettings.mk
CUDALIBS = -lcublas
# This makefile is constructed such that:
# - "make" will compile only CPU binaries
......@@ -21,18 +23,21 @@ ifeq ($(cpu), 1)
XFILES += example_non_cuda_exe
endif
# We generate labelled binary files, so that builds
# for different CUDA versions can be installed
# side-by-side.
ifeq ($(gpu), 1)
XFILES += example_cuda_exe
SOFILES += libfsl-example_cuda_lib.so
XFILES += example_cuda_exe_cuda${CUDA_VER}
SOFILES += libfsl-example_cuda_lib_cuda${CUDA_VER}.so
endif
all: ${XFILES} ${SOFILES}
libfsl-example_cuda_lib.so: example_cuda_lib.cu
libfsl-example_cuda_lib_cuda${CUDA_VER}.so: example_cuda_lib.cu
${NVCC} ${NVCCFLAGS} -shared -o $@ $^ ${NVCCLDFLAGS}
example_cuda_exe: example_cuda_exe.cpp libfsl-example_cuda_lib.so
${NVCC} ${NVCCFLAGS} -o $@ $< -lfsl-example_cuda_lib ${NVCCLDFLAGS}
example_cuda_exe_cuda${CUDA_VER}: example_cuda_exe.cpp libfsl-example_cuda_lib_cuda${CUDA_VER}.so
${NVCC} ${NVCCFLAGS} -o $@ $< -lfsl-example_cuda_lib_cuda${CUDA_VER} ${NVCCLDFLAGS}
example_non_cuda_exe: example_non_cuda_exe.cpp
${CXX} ${CXXFLAGS} -o $@ $< ${LDFLAGS}
......@@ -7,10 +7,24 @@
# components are built by the separate
# fsl/conda/fsl-exampl_cuda_project_cpu recipe.
{% set name = 'fsl-example_cuda_project_gpu' %}
{% set version = '0.0.1' %}
{% set repository = 'https://git.fmrib.ox.ac.uk/fsl/example_cuda_project.git' %}
{% set build = '0' %}
# Note that multiple conda packages are built from
# this recipe - one package is built for each
# supported CUDA version, and named
# "fsl-example_cuda_project_gpu_cuda-X.Y", where
# X.Y is the CUDA version that the package was
# compiled against.
# The CUDA_VER environment variable must be set when
# a CUDA project is built. CUDA_VER should contain
# the major.minor CUDA toolkit version. CUDA_VER is
# pre-set in the FSL development CUDA build docker
# images.
{% set cuda_version = os.environ["CUDA_VER"] %}
{% set cuda_label = '-cuda-' + cuda_version %}
{% set name = 'fsl-example_cuda_project_gpu' + cuda_label %}
{% set version = '0.0.1' %}
{% set repository = 'https://git.fmrib.ox.ac.uk/fsl/example_cuda_project.git' %}
{% set build = '0' %}
package:
name: {{ name }}
......@@ -23,17 +37,8 @@ source:
git_url: {{ os.environ.get("FSLCONDA_REPOSITORY", repository) }}
git_rev: {{ os.environ.get("FSLCONDA_REVISION", version) }}
# The CUDA_VER environment variable must be set when
# a CUDA project is built. CUDA_VER should contain
# the major.minor CUDA toolkit version. CUDA_VER is
# pre-set in the conda-forge and FSL development
# CUDA build docker images.
{% set cuda_version = os.environ["CUDA_VER"] %}
build:
number: {{ build }}
string: h{{ PKG_HASH }}_cuda{{ cuda_version }}_{{ PKG_BUILDNUM }}
run_exports:
strong:
- {{ name }}
......@@ -48,16 +53,9 @@ requirements:
- {{ compiler("cxx") }} 7.* # [linux]
{% elif cuda_version in ("10.1", "10.2") %}
- {{ compiler("cxx") }} 8.* # [linux]
{% elif cuda_version in ("11.0", "11.1") %}
{% elif cuda_version in ("11.0") %}
- {{ compiler("cxx") }} 9.* # [linux]
{% else %}
- {{ compiler("cxx") }} # [linux]
{% endif %}
- make
# The nvcc_linux-64 package is a shim
# which will use the system-provided
# nvcc, but in a manner that is
# integrated with conda.
#
# on macOS, nvcc and the CUDA toolkit
# must be installed externally to conda,
# and available in the build environment
- nvcc_linux-64 {{ cuda_version }} # [linux]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment