blob: a8698ba0e81bf0f8494933873369a022ec9620fa (
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# Maintainer: Butui Hu <hot123tea123@gmail.com>
# cuda 11 supports Pascal, Volta,Turing, Ampere
# see also https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards
# adjust this list according to your target device
_CUDA_ARCH_LIST="60;61;62;70;72;75;80;86"
_pkgname=Paddle
pkgname=('python-paddlepaddle-git' 'python-paddlepaddle-cuda-git')
_pkgver=2.2.1
pkgver=2.2.1.r33234.8da9eff4e49
pkgrel=2
pkgdesc='PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice'
arch=('x86_64')
url='http://www.paddlepaddle.org'
license=('Apache')
depends=(
blas
python-astor
python-decorator
python-numpy
python-pillow
python-protobuf
python-requests
python-six
)
makedepends=(
cmake
cuda
cudnn
git
nccl
patchelf
python-pip
python-setuptools
python-wheel
swig
wget
)
source=("${_pkgname}::git+https://github.com/PaddlePaddle/Paddle.git")
sha512sums=('SKIP')
pkgver() {
cd ${_pkgname}
printf "%s.r%s.%s" "${_pkgver}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
# improve the file descriptors limit to avoid "Too many open files" error
ulimit -n 4096
# use the same version of system's protobuf
# always check https://github.com/PaddlePaddle/Paddle/blob/develop/cmake/external/protobuf.cmake
# to make sure which protobuf git commit is used
_protobuf_version=$(protoc --version|cut -f 2 -d ' ')
sed -i "s,9f75c5aa851cd877fb0d93ccc31b8567a6706546,v${_protobuf_version}," "${_pkgname}/cmake/external/protobuf.cmake"
# set CUDA_HOME for dgc building
sed -i 's,BUILD_COMMAND make -j $(nproc),BUILD_COMMAND make CUDA_HOME=/opt/cuda,' "${_pkgname}/cmake/external/dgc.cmake"
# fix std::move error, see also https://github.com/PaddlePaddle/Paddle/issues/26878
find "${_pkgname}" -type f -name CMakeLists.txt -exec sed -i -e '$aset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pessimizing-move")' {} \;
# fix range-loop-construct
find "${_pkgname}" -type f -name CMakeLists.txt -exec sed -i -e '$aset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=range-loop-construct")' {} \;
# fix #include <cstddef>
sed -i 's,#include <cstdint>,#include <cstdint>\n#include <cstddef>,' "${_pkgname}/paddle/fluid/memory/detail/memory_block.h"
}
build() {
cmake_opts=(
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_SKIP_INSTALL_RPATH=ON
-DWITH_AVX=ON
-DWITH_DISTRIBUTE=OFF
-DWITH_MKL=OFF
-DWITH_PYTHON=ON
-DWITH_SYSTEM_BLAS=ON
-DWITH_TESTING=OFF
)
# building with CUDA
cmake -B "${srcdir}/build-cuda" \
-S "${srcdir}/${_pkgname}" \
${cmake_opts[@]} \
-DCUDA_ARCH_BIN=${_CUDA_ARCH_LIST} \
-DCUDA_ARCH_NAME="Manual" \
-DWITH_GPU=ON
make -C "${srcdir}/build-cuda"
# building without CUDA
cmake -B "${srcdir}/build" \
-S "${srcdir}/${_pkgname}" \
${cmake_opts[@]} \
-DWITH_GPU=OFF
make -C "${srcdir}/build"
}
package_python-paddlepaddle-cuda-git() {
pkgdesc="${pkgdesc} (with CUDA)"
depends+=(
cuda
cudnn
nccl
)
provides=(
python-paddlepaddle=${_pkgver}
python-paddlepaddle-cuda=${_pkgver}
)
conflicts=(
python-paddlepaddle
python-paddlepaddle-cuda
)
PIP_CONFIG_FILE=/dev/null find "${srcdir}/build-cuda" -type f -name "*.whl" -exec pip install --isolated --root="${pkgdir}" --ignore-installed --no-deps {} \;
python -O -m compileall "${pkgdir}"
# remove unneeded libs
rm -rfv "${pkgdir}/usr/lib/python$(get_pyver)/site-packages/paddle/libs"
rm -vf ${pkgdir}/usr/lib/python$(get_pyver)/site-packages/_foo.*
# remove rpath
find "${pkgdir}/usr/lib" -type f -name "*.so" -exec patchelf --remove-rpath {} \;
}
package_python-paddlepaddle-git() {
provides=(
python-paddlepaddle=${_pkgver}
)
conflicts=(
python-paddlepaddle
)
PIP_CONFIG_FILE=/dev/null find "${srcdir}/build" -type f -name "*.whl" -exec pip install --isolated --root="${pkgdir}" --ignore-installed --no-deps {} \;
python -O -m compileall "${pkgdir}"
# remove unneeded libs
rm -rfv "${pkgdir}/usr/lib/python$(get_pyver)/site-packages/paddle/libs"
rm -vf ${pkgdir}/usr/lib/python$(get_pyver)/site-packages/_foo.*
# remove rpath
find "${pkgdir}/usr/lib" -type f -name "*.so" -exec patchelf --remove-rpath {} \;
}
# vim:set ts=2 sw=2 et:
|