archrelease: copy trunk to community-any
[ArchLinux/community.git] / magma / trunk / PKGBUILD
blobd7117ecbb593f7341af0b767b520d7d4eb68a02e
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>
7 _pkgname=magma
8 pkgbase=$_pkgname
9 pkgname=(magma-cuda magma-hip)
10 pkgver=2.7.1
11 pkgrel=6
12 _pkgdesc="Matrix Algebra on GPU and Multicore Architectures"
13 arch=('x86_64')
14 url="https://icl.utk.edu/magma/"
15 license=('custom')
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')
24 options=(!lto)
26 prepare() {
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"
34 build() {
35   echo "Build with cuda backend"
36   cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
37   cmake \
38     -Bbuild \
39     -GNinja \
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"
44   ninja -C build
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" \
51   cmake \
52     -Bbuild \
53     -GNinja \
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
61   ninja -C build
64 _package() {
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)"
76   depends+=(cuda)
77   conflicts=(magma magma-hip)
78   provides=(magma)
79   replaces=(magma)
81   cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
82   _package
85 package_magma-hip() {
86   pkgdesc="${_pkgdesc} (with ROCm/HIP)"
87   depends+=(hip-runtime-amd hipblas hipsparse)
88   conflicts=(hipmagma magma magma-cuda)
89   provides=(hipmagma)
90   replaces=(hipmagma)
92   cd "${srcdir}/${_pkgname}-${pkgver}-hip"
93   _package
96 # vim:set ts=2 sw=2 et: