summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPi-Yueh Chuang2020-09-30 11:21:33 -0400
committerPi-Yueh Chuang2020-09-30 11:21:33 -0400
commitf9b824f6e2f42e5d5dbade1840c24aaebd9d4f8e (patch)
tree62f998db265bb5277edff683d6361f59fef951e5
downloadaur-python-pytorch-cuda-kepler.tar.gz
Initial upload: python-pytorch-cuda-kepler 1.6.0-1
init python-pytorch-cuda-kepler
-rw-r--r--.SRCINFO53
-rw-r--r--PKGBUILD122
2 files changed, 175 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..edfc29fdae6
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,53 @@
+pkgbase = python-pytorch-cuda-kepler
+ pkgdesc = PyTorch with Kepler GPU (e.g., K20, K40, K80, etc.) support (only).
+ pkgver = 1.6.0
+ pkgrel = 1
+ url = https://pytorch.org
+ arch = x86_64
+ license = BSD
+ makedepends = python
+ makedepends = python-setuptools
+ makedepends = python-yaml
+ makedepends = python-numpy
+ makedepends = cmake
+ makedepends = cuda
+ makedepends = cudnn
+ makedepends = git
+ makedepends = magma
+ makedepends = ninja
+ makedepends = pkgconfig
+ makedepends = doxygen
+ depends = google-glog
+ depends = gflags
+ depends = opencv
+ depends = openmp
+ depends = nccl
+ depends = pybind11
+ depends = python
+ depends = python-yaml
+ depends = libuv
+ depends = python-numpy
+ depends = protobuf
+ depends = ffmpeg
+ depends = python-future
+ depends = qt5-base
+ depends = onednn
+ depends = intel-mkl
+ provides = python-pytorch
+ provides = python-pytorch-cuda
+ conflicts = python-pytorch
+ source = pytorch-1.6.0::git+https://github.com/pytorch/pytorch.git#tag=v1.6.0
+ source = https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/fix_include_system.patch
+ source = https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/use-system-libuv.patch
+ source = https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/use-system-libuv2.patch
+ source = https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/nccl_version.patch
+ source = https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/disable_non_x86_64.patch
+ sha256sums = SKIP
+ sha256sums = 147bdaeac8ec46ea46382e6146878bd8f8d51e05d5bd6f930dfd8e2b520859b9
+ sha256sums = 6f3b7a87172011de810bf1ab581245b4463ef86e5cd09bec63aeffa372e26646
+ sha256sums = 7b65c3b209fc39f92ba58a58be6d3da40799f1922910b1171ccd9209eda1f9eb
+ sha256sums = 1a276bd827a0c76dab908cbc6605fa4c9fc2cc2b9431b6578a41133ae27dba2b
+ sha256sums = d3ef8491718ed7e814fe63e81df2f49862fffbea891d2babbcb464796a1bd680
+
+pkgname = python-pytorch-cuda-kepler
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..8fb911c65e8
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,122 @@
+# Maintainer: Pi-Yueh Chuang <pychuang@pm.me>
+
+pkgname=python-pytorch-cuda-kepler
+_pkgname="pytorch"
+pkgver=1.6.0
+_pkgver=1.6.0
+pkgrel=1
+pkgdesc="PyTorch with Kepler GPU (e.g., K20, K40, K80, etc.) support (only)."
+arch=('x86_64')
+url="https://pytorch.org"
+license=('BSD')
+depends=(
+ 'google-glog' 'gflags' 'opencv' 'openmp' 'nccl' 'pybind11' 'python'
+ 'python-yaml' 'libuv' 'python-numpy' 'protobuf' 'ffmpeg' 'python-future'
+ 'qt5-base' 'onednn' 'intel-mkl'
+)
+makedepends=(
+ 'python' 'python-setuptools' 'python-yaml' 'python-numpy' 'cmake' 'cuda'
+ 'cudnn' 'git' 'magma' 'ninja' 'pkgconfig' 'doxygen'
+)
+source=(
+ "${_pkgname}-${pkgver}::git+https://github.com/pytorch/pytorch.git#tag=v$_pkgver"
+ "https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/fix_include_system.patch"
+ "https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/use-system-libuv.patch"
+ "https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/use-system-libuv2.patch"
+ "https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/nccl_version.patch"
+ "https://github.com/archlinux/svntogit-community/raw/packages/python-pytorch/trunk/disable_non_x86_64.patch"
+)
+sha256sums=(
+ 'SKIP'
+ '147bdaeac8ec46ea46382e6146878bd8f8d51e05d5bd6f930dfd8e2b520859b9'
+ '6f3b7a87172011de810bf1ab581245b4463ef86e5cd09bec63aeffa372e26646'
+ '7b65c3b209fc39f92ba58a58be6d3da40799f1922910b1171ccd9209eda1f9eb'
+ '1a276bd827a0c76dab908cbc6605fa4c9fc2cc2b9431b6578a41133ae27dba2b'
+ 'd3ef8491718ed7e814fe63e81df2f49862fffbea891d2babbcb464796a1bd680'
+)
+conflicts=(python-pytorch)
+provides=(python-pytorch python-pytorch-cuda)
+
+prepare() {
+ cd "${_pkgname}-${pkgver}"
+ git submodule update --init --recursive
+
+ # https://bugs.archlinux.org/task/64981
+ patch -N torch/utils/cpp_extension.py "${srcdir}"/fix_include_system.patch
+
+ # Use system libuv
+ patch -Np1 -i "${srcdir}"/use-system-libuv.patch
+ patch -Np1 -i "${srcdir}"/use-system-libuv2.patch -d third_party/tensorpipe
+
+ # FindNCCL patch to export correct nccl version
+ patch -Np1 -i "${srcdir}"/nccl_version.patch
+
+ # remove local nccl
+ rm -rf third_party/nccl/nccl
+ cd ..
+
+ export VERBOSE=1
+ export PYTORCH_BUILD_VERSION="${pkgver}"
+ export PYTORCH_BUILD_NUMBER=1
+ export USE_MKLDNN=ON
+ export BUILD_CUSTOM_PROTOBUF=OFF
+ export USE_FFMPEG=ON
+ export USE_GFLAGS=ON
+ export USE_GLOG=ON
+ export BUILD_BINARY=ON
+ export USE_OPENCV=ON
+ export USE_SYSTEM_NCCL=ON
+ export NCCL_VERSION=$(pkg-config nccl --modversion)
+ export NCCL_VER_CODE=$(sed -n 's/^#define NCCL_VERSION_CODE\s*\(.*\).*/\1/p' /usr/include/nccl.h)
+ export CUDAHOSTCXX=g++-9
+ export CUDA_HOME=/opt/cuda
+ export USE_CUDA=1
+ export USE_CUDNN=1
+ export CUDNN_LIB_DIR=/usr/lib
+ export CUDNN_INCLUDE_DIR=/usr/include
+ export TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
+ export TORCH_CUDA_ARCH_LIST="3.5;3.7;"
+}
+
+build() {
+ cd "${srcdir}/${_pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/disable_non_x86_64.patch"
+ echo "add_definitions(-march=x86-64)" >> cmake/MiscCheck.cmake
+ python setup.py build
+}
+
+package() {
+
+ cd "${srcdir}/${_pkgname}-${pkgver}"
+
+ # Prevent setup.py from re-running CMake and rebuilding
+ sed -e 's/RUN_BUILD_DEPS = True/RUN_BUILD_DEPS = False/g' -i setup.py
+
+ python setup.py install --root="${pkgdir}"/ --optimize=1 --skip-build
+
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ pytorchpath="usr/lib/python3.8/site-packages/torch"
+ install -d "${pkgdir}/usr/lib"
+
+ # put CMake files in correct place
+ mv "${pkgdir}/${pytorchpath}/share/cmake" "${pkgdir}/usr/lib/cmake"
+
+ # put C++ API in correct place
+ mv "${pkgdir}/${pytorchpath}/include" "${pkgdir}/usr/include"
+ mv "${pkgdir}/${pytorchpath}/lib"/*.so* "${pkgdir}/usr/lib/"
+
+ # clean up duplicates
+ # TODO: move towards direct shared library dependecy of:
+ # c10, caffe2, libcpuinfo, CUDA RT, gloo, GTest, Intel MKL,
+ # NVRTC, ONNX, protobuf, libthreadpool, QNNPACK
+ rm -rf "${pkgdir}/usr/include/pybind11"
+
+ # python module is hardcoded to look there at runtime
+ ln -s /usr/include "${pkgdir}/${pytorchpath}/include"
+ find "${pkgdir}"/usr/lib -type f -name "*.so*" -print0 | while read -rd $'\0' _lib; do
+ ln -s ${_lib#"$pkgdir"} "${pkgdir}/${pytorchpath}/lib/"
+ done
+}
+
+# vim:set ts=2 sw=2 et: