blob: 713268e3039e27a6ebbc0a218f8d1e73e28c7299 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# Maintainer: Butui Hu <hot123tea123@gmail.com>
_CUDA_ARCH_LIST="60;61;62;70;72;75;80;86;89;90"
pkgname=python-nvidia-dali
_pkgname=dali
pkgver=1.44.0
pkgrel=1
pkgdesc='A library containing both highly optimized building blocks and an execution engine for data pre-processing in deep learning applications'
arch=('x86_64')
url='https://github.com/NVIDIA/DALI'
license=('Apache-2.0')
depends=(
abseil-cpp
cfitsio
cuda
ffmpeg
gcc-libs
glibc
libcudart.so
libsndfile
libtar
libtiff
lmdb
opencv
protobuf
python-astunparse
python-dm-tree
python-gast
python-six
)
makedepends=(
python-build
python-installer
python-wheel
clang
cmake
git
git-lfs
python-setuptools
python-black
)
optdepends=(
python-pytorch
python-tensorflow
)
options=(!emptydirs !lto)
source=("${pkgname}::git+https://github.com/NVIDIA/DALI.git#tag=v${pkgver}"
)
sha512sums=('3394cf5e9aa30755068605672b87927e852f32628786f6f35e431c75159ecc3dcc54549cfe214516f6527af9359a50274d39fc792ea80924cebe3d31508ccc4f')
prepare() {
cd "${srcdir}/${pkgname}"
git lfs install
git submodule update --init --recursive
# quick fix for https://github.com/archlinuxcn/repo/issues/2877
export CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
# fix lib not found error
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${srcdir}/build/dali/python/nvidia/dali:${srcdir}/build/lib"
# fix missing cstdint header
# ref https://github.com/NVIDIA/DALI/issues/5591
sed -i '18i#include <cstdint>' dali/util/uri.h
}
build() {
cmake \
-B "${srcdir}/build" \
-DBUILD_BENCHMARK=OFF \
-DBUILD_CFITSIO=ON \
-DBUILD_CUFILE=ON \
-DBUILD_FFTS=ON \
-DBUILD_LIBSND=ON \
-DBUILD_LIBTAR=ON \
-DBUILD_LIBTIFF=ON \
-DBUILD_LMDB=ON \
-DBUILD_NVDEC=ON \
-DBUILD_NVJPEG2K=OFF \
-DBUILD_NVJPEG=OFF \
-DBUILD_NVML=ON \
-DBUILD_NVOF=ON \
-DBUILD_NVTX=OFF \
-DBUILD_PROTOBUF=ON \
-DBUILD_PYTHON=ON \
-DBUILD_TEST=OFF \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_SKIP_RPATH=ON \
-DCUDA_TARGET_ARCHS=${_CUDA_ARCH_LIST} \
-DProtobuf_USE_STATIC_LIBS=OFF \
-DVERBOSE_LOGS=ON \
-DWITH_DYNAMIC_CUDA_TOOLKIT=ON \
-S "${srcdir}/${pkgname}"
make -C "${srcdir}/build"
cd "${srcdir}/build/dali/python"
python -m build --wheel --no-isolation
# built tf plugin
cmake -B ${srcdir}/build-tf \
-DCUDA_VERSION=12.5.1 \
-S ${srcdir}/${pkgname}/dali_tf_plugin
make -C ${srcdir}/build-tf
}
package() {
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
make -C "${srcdir}/build" DESTDIR="${pkgdir}" install
cd "${srcdir}/build/dali/python"
python -m installer --destdir="${pkgdir}" dist/*.whl
# create softlink to save space
ln -sf "${site_packages}/nvidia/dali/libdali.so" "${pkgdir}/usr/lib/libdali.so"
ln -sf "${site_packages}/nvidia/dali/libdali_core.so" "${pkgdir}/usr/lib/libdali_core.so"
ln -sf "${site_packages}/nvidia/dali/libdali_imgcodec.so" "${pkgdir}/usr/lib/libdali_imgcodec.so"
ln -sf "${site_packages}/nvidia/dali/libdali_kernels.so" "${pkgdir}/usr/lib/libdali_kernels.so"
ln -sf "${site_packages}/nvidia/dali/libdali_operators.so" "${pkgdir}/usr/lib/libdali_operators.so"
# install tf plugin
make -C ${srcdir}/build-tf
python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}
# vim:set ts=2 sw=2 et:
|