Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CUDA support #2

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
cdt_name:
- cos7
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cuda_compiler:
- nvcc
cuda_compiler_version:
- '11.2'
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
docker_image:
- quay.io/condaforge/linux-anvil-cuda:11.2
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
libblas:
- 3.9 *netlib
libcblas:
- 3.9 *netlib
liblapack:
- 3.9 *netlib
target_platform:
- linux-64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
- cuda_compiler
- cuda_compiler_version
- cdt_name
- docker_image
zlib:
- '1.2'
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cuda_compiler:
- None
cuda_compiler_version:
- None
cxx_compiler:
- gxx
cxx_compiler_version:
Expand All @@ -30,5 +34,9 @@ zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
- cuda_compiler
- cuda_compiler_version
- cdt_name
- docker_image
zlib:
- '1.2'
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
BUILD:
- aarch64-conda_cos7-linux-gnu
c_compiler:
- gcc
c_compiler_version:
- '10'
cdt_arch:
- aarch64
cdt_name:
- cos7
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cuda_compiler:
- nvcc
cuda_compiler_version:
- '11.2'
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
docker_image:
- quay.io/condaforge/linux-anvil-aarch64-cuda:11.2
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
libblas:
- 3.9 *netlib
libcblas:
- 3.9 *netlib
liblapack:
- 3.9 *netlib
target_platform:
- linux-aarch64
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
- cuda_compiler
- cuda_compiler_version
- cdt_name
- docker_image
zlib:
- '1.2'
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cuda_compiler:
- None
cuda_compiler_version:
- None
cxx_compiler:
- gxx
cxx_compiler_version:
Expand All @@ -34,5 +38,9 @@ zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
- cuda_compiler
- cuda_compiler_version
- cdt_name
- docker_image
zlib:
- '1.2'
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
cdt_name:
- cos7
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cuda_compiler:
- nvcc
cuda_compiler_version:
- '11.2'
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
docker_image:
- quay.io/condaforge/linux-anvil-ppc64le-cuda:11.2
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
libblas:
- 3.9 *netlib
libcblas:
- 3.9 *netlib
liblapack:
- 3.9 *netlib
target_platform:
- linux-ppc64le
zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
- cuda_compiler
- cuda_compiler_version
- cdt_name
- docker_image
zlib:
- '1.2'
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cuda_compiler:
- None
cuda_compiler_version:
- None
cxx_compiler:
- gxx
cxx_compiler_version:
Expand All @@ -30,5 +34,9 @@ zip_keys:
- - c_compiler_version
- cxx_compiler_version
- fortran_compiler_version
- cuda_compiler
- cuda_compiler_version
- cdt_name
- docker_image
zlib:
- '1.2'
14 changes: 12 additions & 2 deletions .travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 33 additions & 6 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,33 @@
export OMP_CANCELLATION=TRUE
export OMP_PROC_BIND=TRUE

if [[ ! -z "${cuda_compiler_version+x}" && "${cuda_compiler_version}" == "11.*" ]]
if [[ -z "${CUDA_HOME+x}" ]]
then
echo "==> cuda_compiler_version=${cuda_compiler_version}, extract manually CUDA_HOME variable"
CUDA_GDB_EXECUTABLE=$(which cuda-gdb || exit 0)
if [[ -n "$CUDA_GDB_EXECUTABLE" ]]
then
CUDA_HOME=$(dirname $(dirname $CUDA_GDB_EXECUTABLE))
else
echo "Cannot determine CUDA_HOME: cuda-gdb not in PATH"
return 1
fi
fi
export NVCCFLAGS="${NVCCFLAGS} -shared -Xcompiler -fPIC"
export CUDAOPTIONS="--enable-gpu"
then
export CUDAOPTIONS="--disable-gpu"
fi

export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib -lcblas"
export CFLAGS="$CFLAGS -fPIC"
export CPPFLAGS="$CPPFLAGS -fPIC"
export FCFLAGS="$FCFLAGS -fPIC"
./autogen.sh
mkdir build
cd build
../configure --with-metis="-lmetis" --prefix=$PREFIX
../configure $CUDAOPTIONS --with-metis="-lmetis" --prefix=$PREFIX
make

if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "" ]]; then
Expand Down
32 changes: 32 additions & 0 deletions recipe/cuda12_arch_all.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 9d85bc2294e81803ce915c657b86aebb86aef310 Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Fri, 18 Aug 2023 10:50:12 +0200
Subject: [PATCH] On CUDA 12, pass -arch=all to compile for all supported
architectures

---
Makefile.am | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2237a7fb..874349d8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,15 +15,7 @@ AM_NVCC_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -Xptxas="${PTX_FLAGS
else
AM_NVCC_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -Xptxas="${PTX_FLAGS}"
endif
-AM_NVCC_FLAGS += -gencode arch=compute_52,code=sm_52
-AM_NVCC_FLAGS += -gencode arch=compute_60,code=sm_60
-AM_NVCC_FLAGS += -gencode arch=compute_61,code=sm_61
-AM_NVCC_FLAGS += -gencode arch=compute_70,code=sm_70
-AM_NVCC_FLAGS += -gencode arch=compute_75,code=sm_75
-AM_NVCC_FLAGS += -gencode arch=compute_80,code=sm_80
-AM_NVCC_FLAGS += -gencode arch=compute_86,code=sm_86
-AM_NVCC_FLAGS += -gencode arch=compute_87,code=sm_87
-AM_NVCC_FLAGS += -gencode arch=compute_86,code=compute_86
+AM_NVCC_FLAGS += -arch=all
AM_LD_FLAGS = -lcuda
NVCCLINK = \
$(NVCC) $(NVCCFLAGS) $(AM_NVCC_FLAGS) $(AM_LD_FLAGS) $(LDFLAGS) $(OPENMP_LIB) -o $@

Loading