summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorJakub Klinkovský2024-04-14 14:11:18 +0200
committerJakub Klinkovský2024-04-14 14:11:18 +0200
commit1da21992317b7c993f71df91c4c8e6ffbadbcd87 (patch)
treed852cca1e1e1ba1f455a853c6507404d551345fa /PKGBUILD
parent9cbbb5706581c884349e1aeebbb3c74c97eec1e0 (diff)
downloadaur-1da21992317b7c993f71df91c4c8e6ffbadbcd87.tar.gz
sync with ginkgo-hpc in extra and adjust for modernized HIP config
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD200
1 files changed, 163 insertions, 37 deletions
diff --git a/PKGBUILD b/PKGBUILD
index d94764205e40..5a681893d19b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,68 +1,194 @@
-# Maintainer: Jakub Klinkovský <lahwaacz@archlinux.org>
+# Maintainer: Jakub Klinkovský <lahwaacz at archlinux dot org>
-pkgname=ginkgo-hpc-git
_pkgname=ginkgo
-pkgver=r7339.6176550f4f
+pkgbase=ginkgo-hpc-git
+pkgname=(ginkgo-hpc{,-docs,-cuda,-hip}-git)
+pkgver=r7464.577caef4ca
pkgrel=1
pkgdesc="Numerical linear algebra software package"
-arch=('x86_64')
+arch=(x86_64)
url=https://ginkgo-project.github.io/
-license=('BSD')
-# TODO system 'rapidjson' does not work due to some C++ issues
+license=(BSD-3-Clause)
+depends=(
+ gcc-libs
+ glibc
+ hwloc
+ openmpi
+)
+# FIXME: system 'rapidjson' does not work due to some C++ issues
# (see the 'declared protected here' error in https://github.com/Tencent/rapidjson/issues/1338#issuecomment-449849215 )
-depends=('cuda' 'gflags' 'hwloc' 'numactl' 'openmpi')
-makedepends=('git' 'cmake' 'ninja' 'nlohmann-json' 'doxygen' 'graphviz' 'texlive-bin' 'texlive-latexextra' 'gtest')
-checkdepends=('openssh') # openssh is needed for mpirun to run some tests
-source=("git+https://github.com/ginkgo-project/$_pkgname.git")
-md5sums=('SKIP')
-
-# LTO does not work with nvcc
-options+=(!lto)
+makedepends=(
+ git
+ cmake
+ ninja
+ nlohmann-json
+ gflags # for benchmarks (not installed yet)
+ gtest
+ numactl
+ doxygen
+ graphviz
+ texlive-bin
+ texlive-latexextra
+ # -cuda
+ cuda
+ # -hip
+ hip-runtime-amd
+ hipblas
+ hipfft
+ hiprand
+ hipsparse
+ rocthrust
+ roctracer
+)
+source=("git+https://github.com/ginkgo-project/$_pkgname.git"
+ disable-pkgconfig-file-install.patch)
+sha256sums=('SKIP'
+ '9aeae9a09de7efda77aa15dc4d57d859b58ea69ce473a549e065e5e2b01b13b7')
pkgver() {
- cd "$_pkgname"
+ cd $_pkgname
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
+prepare() {
+ # FIXME: installing pkg-config file is broken https://github.com/ginkgo-project/ginkgo/issues/1595
+ cd $_pkgname
+ patch -Np1 -i ../disable-pkgconfig-file-install.patch
+}
+
build() {
- cmake -B build -S "$_pkgname" -G Ninja \
- -DCMAKE_BUILD_TYPE=None \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DGINKGO_CUDA_ARCHITECTURES="All" \
- -DGINKGO_BUILD_REFERENCE=ON \
- -DGINKGO_BUILD_OMP=ON \
- -DGINKGO_BUILD_MPI=ON \
- -DGINKGO_HAVE_GPU_AWARE_MPI=ON \
- -DGINKGO_BUILD_CUDA=ON \
- -DGINKGO_BUILD_BENCHMARKS=ON \
- -DGINKGO_BUILD_EXAMPLES=ON \
- -DGINKGO_BUILD_DOC=ON \
+ local common_cmake_flags=(
+ -S $_pkgname -G Ninja
+ -DCMAKE_BUILD_TYPE=None
+ -DCMAKE_INSTALL_PREFIX=/usr
+ -DGINKGO_BUILD_REFERENCE=ON
+ -DGINKGO_BUILD_OMP=ON
+ -DGINKGO_BUILD_MPI=ON
+ -DGINKGO_HAVE_GPU_AWARE_MPI=ON
+ -DGINKGO_BUILD_BENCHMARKS=ON
+ -DGINKGO_BUILD_EXAMPLES=ON
+ -DGINKGO_BUILD_DOC=ON
-DGINKGO_BUILD_TESTS=ON
+ )
+ local _cuda_archs="All"
+ # archs gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102 are not supported: https://github.com/ginkgo-project/ginkgo/issues/1429
+ local _amdgpu_archs="gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942"
+
+ # base package
+ cmake -B build "${common_cmake_flags[@]}" \
+ -DGINKGO_BUILD_CUDA=OFF \
+ -DGINKGO_BUILD_HIP=OFF \
+ -DGINKGO_BUILD_SYCL=OFF
cmake --build build
+
+ # -cuda package
+ cmake -B build-cuda "${common_cmake_flags[@]}" \
+ -DGINKGO_CUDA_ARCHITECTURES="$_cuda_archs" \
+ -DGINKGO_BUILD_CUDA=ON \
+ -DGINKGO_BUILD_HIP=OFF \
+ -DGINKGO_BUILD_SYCL=OFF
+ cmake --build build-cuda
+
+ # -hip package
+ # ginkgo has insufficient auto-detection for HIP_PATH https://github.com/ginkgo-project/ginkgo/issues/1529#issuecomment-2053598746
+ export ROCM_PATH=/opt/rocm
+ export HIP_PATH="$ROCM_PATH"
+ # LTO does not work with HIP
+ local _hip_flags="${CXXFLAGS/-flto=auto/}"
+ local _cxx_flags="${CXXFLAGS/-flto=auto/}"
+ # HIP does not support -fcf-protection
+ _hip_flags="${_hip_flags/-fcf-protection/}"
+ # Ginkgo does not support _GLIBCXX_ASSERTIONS for device builds https://github.com/ginkgo-project/ginkgo/issues/1143#issuecomment-2036957897
+ _hip_flags="${_hip_flags/-Wp,-D_GLIBCXX_ASSERTIONS/}"
+ cmake -B build-hip "${common_cmake_flags[@]}" \
+ -DCMAKE_CXX_FLAGS="$_cxx_flags" \
+ -DCMAKE_HIP_FLAGS="$_hip_flags" \
+ -DCMAKE_HIP_ARCHITECTURES="$_amdgpu_archs" \
+ -DGINKGO_BUILD_CUDA=OFF \
+ -DGINKGO_BUILD_HIP=ON \
+ -DGINKGO_BUILD_SYCL=OFF
+ cmake --build build-hip
+ unset ROCM_PATH
+ unset HIP_PATH
}
check() {
- # limit parallel execution of tests to 4 threads and 4 processes
+ # some tests fail due to capturing stderr and getting different number of mpirun warnings
+ # see https://github.com/ginkgo-project/ginkgo/issues/1567
+ local excluded_tests="benchmark_.*_distributed"
+
+ # limit parallel execution of tests to 4 threads and 8 processes
+ # note that without a GPU we cannot run tests for -cuda and -hip
(
export OMP_NUM_THREADS=4
- export CTEST_PARALLEL_LEVEL=4
+ export CTEST_PARALLEL_LEVEL=8
export CTEST_OUTPUT_ON_FAILURE=1
- # FIXME: some tests fail: https://github.com/ginkgo-project/ginkgo/issues/1143
- cmake --build build --target test || true
+ ctest --test-dir build --exclude-regex "$excluded_tests"
)
}
-package() {
- DESTDIR="$pkgdir" cmake --install build
+_package() {
+ DESTDIR="$pkgdir" cmake --install build"$1"
# install the license
- install -Dm644 "$_pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ install -vDm 644 $_pkgname/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
+
+ # TODO: install the benchmarks and examples: https://github.com/ginkgo-project/ginkgo/issues/1144
+}
+
+package_ginkgo-hpc-git() {
+ optdepends=(
+ 'ginkgo-hpc-docs: for documentation'
+ )
+ conflicts=(ginkgo-hpc)
+ provides=(ginkgo-hpc)
+
+ _package ""
+}
+
+package_ginkgo-hpc-docs-git() {
+ pkgdesc+=" - documentation"
+ depends=()
+ conflicts=(ginkgo-hpc-docs)
+ provides=(ginkgo-hpc-docs)
# install the documentation
- install -dm755 "$pkgdir/usr/share/doc/$pkgname"
- cp -r "build/doc/usr" "$pkgdir/usr/share/doc/$pkgname/html"
+ install -vdm755 "$pkgdir/usr/share/doc/$pkgbase"
+ cp -r build/doc/usr "$pkgdir/usr/share/doc/$pkgbase/html"
- # TODO: install the benchmarks and examples: https://github.com/ginkgo-project/ginkgo/issues/1144
+ # install the license
+ install -vDm 644 $_pkgname/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
+}
+
+package_ginkgo-hpc-cuda-git() {
+ pkgdesc+=" (with CUDA)"
+ depends+=(cuda)
+ optdepends=(
+ 'ginkgo-hpc-docs: for documentation'
+ )
+ conflicts=(ginkgo-hpc)
+ provides=(ginkgo-hpc)
+
+ _package -cuda
+}
+
+package_ginkgo-hpc-hip-git() {
+ pkgdesc+=" (with ROCm/HIP)"
+ depends+=(
+ hip-runtime-amd
+ hipblas
+ hipfft
+ hiprand
+ hipsparse
+ roctracer
+ )
+ optdepends=(
+ 'ginkgo-hpc-docs: for documentation'
+ )
+ conflicts=(ginkgo-hpc)
+ provides=(ginkgo-hpc)
+
+ _package -hip
}
# vim:set ts=2 sw=2 et: