summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 91f0e0cb625446950b6acf3e35bdb7331cfc7b1e (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
54
55
56
57
58
59
60
61
62
63
# Maintainer: Zhirui Dai <daizhirui at hotmail dot com>

_pkgname=libtorch
pkgbase=libtorch-cxx11abi
pkgname=(
    libtorch-cxx11abi-cuda
    libtorch-cxx11abi-rocm
    libtorch-cxx11abi-cpu
)

pkgver="2.5.1"
_cuda_version="cu124"
_rocm_version="rocm6.2"
pkgrel=1
_pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration (with CXX11 ABI)"
pkgdesc="${_pkgdesc}"
arch=('x86_64')
url="https://pytorch.org"
license=('BSD')
depends=(pybind11)
makedepends=()
source=()
sha256sums=()
options=('!strip' '!debug' 'libtool' 'staticlibs')

package_libtorch-cxx11abi-cuda() {
    pkgdesc="${_pkgdesc} (with CUDA support)"
    provides=("libtorch-cxx11abi-cuda")
    depends=(pybind11)
    cd ${srcdir}
    wget https://download.pytorch.org/libtorch/${_cuda_version}/libtorch-cxx11-abi-shared-with-deps-${pkgver}%2B${_cuda_version}.zip -O ${_pkgname}-${pkgver}-cuda.zip
    install -vdm755 "${pkgdir}/opt"
    cd ${pkgdir}/opt
    bsdtar -xv -f "${srcdir}/${_pkgname}-${pkgver}-cuda.zip"
    rm -rf ${_pkgname}/include/pybind11
    mv ${_pkgname} ${_pkgname}-cuda
}

package_libtorch-cxx11abi-rocm() {
    pkgdesc="${_pkgdesc} (with ROCM support)"
    provides=("libtorch-cxx11abi-rocm")
    depends=(pybind11)
    cd ${srcdir}
    wget https://download.pytorch.org/libtorch/${_rocm_version}/libtorch-cxx11-abi-shared-with-deps-${pkgver}%2B${_rocm_version}.zip -O ${_pkgname}-${pkgver}-rocm.zip
    install -vdm755 "${pkgdir}/opt"
    cd ${pkgdir}/opt
    bsdtar -xv -f "${srcdir}/${_pkgname}-${pkgver}-rocm.zip"
    rm -rf ${_pkgname}/include/pybind11
    mv ${_pkgname} ${_pkgname}-rocm
}

package_libtorch-cxx11abi-cpu() {
    pkgdesc="${_pkgdesc} (CPU only)"
    provides=("libtorch-cxx11abi-cpu")
    depends=(pybind11)
    cd ${srcdir}
    wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${pkgver}%2Bcpu.zip -O ${_pkgname}-${pkgver}-cpu.zip
    install -vdm755 "${pkgdir}/opt"
    cd ${pkgdir}/opt
    bsdtar -xv -f "${srcdir}/${_pkgname}-${pkgver}-cpu.zip"
    rm -rf ${_pkgname}/include/pybind11
    mv ${_pkgname} ${_pkgname}-cpu
}