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

ENH: example recipes for hybrid CPU/GPU project

parent 11a1a559
#!/usr/bin/env bash
export FSLDIR=$PREFIX
export FSLDEVDIR=$PREFIX
mkdir -p $PREFIX/src/
cp -r $(pwd) $PREFIX/src/$PKG_NAME
. $FSLDIR/etc/fslconf/fsl-devel.sh
make cpu=1
make cpu=1 install
# This is a FSL conda recipe for: fsl-example_cuda_project_cpu
# The project git repository is: https://git.fmrib.ox.ac.uk/fsl/example_cuda_project.git
# The git repository for this conda recipe is: https://git.fmrib.ox.ac.uk/fsl/conda/fsl-example_cuda_project_cpu.git
# Note that this recipe only builds the CPU components
# of the example_cuda_project project - the GPU/CUDA
# components are built by the separate
# fsl/conda/fsl-exampl_cuda_project_gpu recipe.
{% set name = 'fsl-example_cuda_project_cpu' %}
{% set version = '0.0.1' %}
{% set repository = 'https://git.fmrib.ox.ac.uk/fsl/example_cuda_project.git' %}
{% set build = '0' %}
package:
name: {{ name }}
version: {{ version }}
source:
# the FSLCONDA_REPOSITORY and FSLCONDA_REVISION
# environment variables can be used to override
# the repository/revision for development purposes.
git_url: {{ os.environ.get("FSLCONDA_REPOSITORY", repository) }}
git_rev: {{ os.environ.get("FSLCONDA_REVISION", version) }}
build:
number: {{ build }}
run_exports:
strong:
- {{ name }}
requirements:
host:
- fsl-base >=2101.5
build:
- {{ compiler("cxx") }}
- make
if [ -e ${FSLDIR}/share/fsl/sbin/createFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/createFSLWrapper example_non_cuda_exe
fi
if [ -e ${FSLDIR}/share/fsl/sbin/removeFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/removeFSLWrapper example_non_cuda_exe
fi
#!/usr/bin/env bash
export FSLDIR=$PREFIX
export FSLDEVDIR=$PREFIX
mkdir -p $PREFIX/src/
cp -r $(pwd) $PREFIX/src/$PKG_NAME
. $FSLDIR/etc/fslconf/fsl-devel.sh
make cpu=0 gpu=1
make cpu=0 gpu=1 install
# This is a FSL conda recipe for: fsl-example_cuda_project_gpu
# The project git repository is: https://git.fmrib.ox.ac.uk/fsl/example_cuda_project.git
# The git repository for this conda recipe is: https://git.fmrib.ox.ac.uk/fsl/conda/fsl-example_cuda_project_gpu.git
# Note that this recipe only builds the GPU components
# of the example_cuda_project project - the CPU
# 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' %}
package:
name: {{ name }}
version: {{ version }}
source:
# the FSLCONDA_REPOSITORY and FSLCONDA_REVISION
# environment variables can be used to override
# the repository/revision for development purposes.
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 }}
requirements:
host:
- fsl-base >=2101.5
build:
# Different versions of nvcc need
# different versions of gcc
{% if cuda_version in ("9.2", "10.0") %}
- {{ compiler("cxx") }} 7.* # [linux]
{% elif cuda_version in ("10.1", "10.2") %}
- {{ compiler("cxx") }} 8.* # [linux]
{% elif cuda_version in ("11.0", "11.1") %}
- {{ compiler("cxx") }} 9.* # [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]
if [ -e ${FSLDIR}/share/fsl/sbin/createFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/createFSLWrapper example_cuda_exe
fi
if [ -e ${FSLDIR}/share/fsl/sbin/removeFSLWrapper ]; then
${FSLDIR}/share/fsl/sbin/removeFSLWrapper example_cuda_exe
fi
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