summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 488ade8bcd9f240ae7e90a87f349c336ee4f5702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Maintainer: Anton Kudelin <kudelin at proton dot me>

pkgname=spfft
_pkgname=SpFFT
pkgver=1.0.6
pkgrel=2
pkgdesc="Sparse 3D FFT library with MPI, OpenMP, CUDA and ROCm support"
arch=(x86_64 aarch64)
url="https://github.com/eth-cscs/SpFFT"
license=(BSD)
depends=(fftw)
makedepends=(cmake gcc-fortran)
optdepends=('cuda: GPU support')
provides=(spfft)
conflicts=(spfft-cuda-git)
source=($pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz)
sha256sums=('d179ccdce65890587d0cbf72dc2e5ec0b200ffc56e723ed01a2f5063de6a8630')

prepare() {
  mkdir -p "$srcdir/build"

  # Checking if nvcc is in PATH
  if command -v nvcc &> /dev/null
  then
    export _ACC=CUDA
    export LDFLAGS="$LDFLAGS -L/opt/cuda/lib64"
    echo "GPU is enabled"
  else
    export _ACC=OFF
    echo "GPU is disabled"
  fi
}

build() {
  cd "$srcdir/build"
  cmake ../$_pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DMKLSequential_FFTW_INCLUDE_DIRS='' \
    -DMKLSequential_INCLUDE_DIRS='' \
    -DSPFFT_FORTRAN=ON \
    -DSPFFT_MPI=ON \
    -DSPFFT_OMP=ON \
    -DSPFFT_GPU_BACKEND=$_ACC \
    -DMKLSequential_FOUND=OFF
  make CUDA_FLAGS="-O3 -Xcompiler=-fPIC"
}

package() {
  cd "$srcdir/build"
  make DESTDIR="$pkgdir" install
  install -Dm755 ../$_pkgname-$pkgver/LICENSE \
    -t "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}