1 # Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
2 # Maintainer: Torsten Keßler <tpkessler@archlinux.org>
3 # Contributor: bartus <arch-user-repoᘓbartus.33mail.com>
4 # Contributor: pingplug <pingplug@foxmail.com>
5 # Contributor: cornholio <vigo.the.unholy.carpathian@gmail.com>
9 pkgname=(magma-cuda magma-hip)
12 _pkgdesc="Matrix Algebra on GPU and Multicore Architectures"
14 url="https://icl.utk.edu/magma/"
16 depends=('blas' 'lapack')
17 makedepends=('gcc-fortran' 'cmake' 'ninja' 'cuda' 'hip-runtime-amd' 'hipblas' 'hipsparse')
18 optdepends=('python: for examples and tests'
19 'gcc-fortran: Fortran interface')
20 source=("${_pkgname}-${pkgver}.tar.gz::https://icl.utk.edu/projectsfiles/${_pkgname}/downloads/${_pkgname}-${pkgver}.tar.gz"
21 'add_cuda_archs.patch')
22 sha256sums=('d9c8711c047a38cae16efde74bee2eb3333217fd2711e1e9b8606cbbb4ae1a50'
23 '1ed3706a65a124ecef71012273687307aac70bfc80bc99a978002dfb0ee000cc')
27 cp -r "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-cuda"
28 cp -r "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-hip"
30 cd "${_pkgname}-${pkgver}-cuda"
31 patch -Np1 -i "${srcdir}/add_cuda_archs.patch"
35 echo "Build with cuda backend"
36 cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
40 -DCMAKE_BUILD_TYPE=Release \
41 -DCMAKE_INSTALL_PREFIX=/usr \
42 -DBUILD_SHARED_LIBS=ON \
43 -DGPU_TARGET="sm_52 sm_53 sm_60 sm_61 sm_62 sm_70 sm_72 sm_75 sm_80 sm_86 sm_87 sm_89 sm_90"
46 echo "Build with rocm/hip backend"
47 cd "${srcdir}/${_pkgname}-${pkgver}-hip"
48 # -fcf-protection is not supported by HIP, see
49 # https://docs.amd.com/bundle/ROCm-Compiler-Reference-Guide-v5.4/page/Appendix_A.html
50 CXXFLAGS="${CXXFLAGS} -fcf-protection=none" \
54 -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \
55 -DCMAKE_BUILD_TYPE=Release \
56 -DCMAKE_INSTALL_PREFIX=/usr \
57 -DBUILD_SHARED_LIBS=ON \
58 -DMAGMA_ENABLE_HIP=ON \
59 -DGPU_TARGS="gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack+ gfx90a:xnack- gfx1010 gfx1012 gfx1030 gfx1100 gfx1101 gfx1102"
60 #List of GPU targets from rocBLAS
65 DESTDIR="${pkgdir}" ninja -Cbuild install
67 install -d "${pkgdir}"/usr/share/magma/example
68 cp -r "${srcdir}"/magma-${pkgver}/example/* "${pkgdir}"/usr/share/magma/example/
69 install -d "${pkgdir}"/usr/share/magma/testing
70 cp -r "${srcdir}"/magma-${pkgver}/testing/* "${pkgdir}"/usr/share/magma/testing/
71 install -Dm644 "${srcdir}"/magma-${pkgver}/COPYRIGHT "${pkgdir}"/usr/share/licenses/magma/LICENSE
74 package_magma-cuda() {
75 pkgdesc="${_pkgdesc} (with CUDA)"
77 conflicts=(magma magma-hip)
81 cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
86 pkgdesc="${_pkgdesc} (with ROCm/HIP)"
87 depends+=(hip-runtime-amd hipblas hipsparse)
88 conflicts=(hipmagma magma magma-cuda)
92 cd "${srcdir}/${_pkgname}-${pkgver}-hip"
96 # vim:set ts=2 sw=2 et: