[arch-commits] Commit in python-pytorch/trunk (2334.patch PKGBUILD)
Sven-Hendrik Haase
svenstaro at archlinux.org
Sat Sep 16 23:09:49 UTC 2017
Date: Saturday, September 16, 2017 @ 23:09:48
Author: svenstaro
Revision: 258579
upgpkg: python-pytorch 0.2.0-1
Pushing
Added:
python-pytorch/trunk/2334.patch
Modified:
python-pytorch/trunk/PKGBUILD
------------+
2334.patch | 21 +++++++++++++++++++
PKGBUILD | 65 +++++++++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 75 insertions(+), 11 deletions(-)
Added: 2334.patch
===================================================================
--- 2334.patch (rev 0)
+++ 2334.patch 2017-09-16 23:09:48 UTC (rev 258579)
@@ -0,0 +1,21 @@
+From 5e2b1b975bf758b67a190444a1d4a6f18c997095 Mon Sep 17 00:00:00 2001
+From: Mo Zhou <cdluminate at gmail.com>
+Date: Tue, 8 Aug 2017 09:58:23 +0000
+Subject: [PATCH] THD: add a missing header to fix build failure
+
+---
+ torch/lib/THD/base/ChannelUtils.hpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/torch/lib/THD/base/ChannelUtils.hpp b/torch/lib/THD/base/ChannelUtils.hpp
+index 563e68297e..e03e8bd132 100644
+--- a/torch/lib/THD/base/ChannelUtils.hpp
++++ b/torch/lib/THD/base/ChannelUtils.hpp
+@@ -5,6 +5,7 @@
+ #include <sys/types.h>
+ #include <cstdlib>
+ #include <cstdint>
++#include <functional>
+ #include <limits>
+ #include <string>
+ #include <system_error>
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-09-16 20:05:18 UTC (rev 258578)
+++ PKGBUILD 2017-09-16 23:09:48 UTC (rev 258579)
@@ -2,11 +2,11 @@
# Contributor: Stephen Zhang <zsrkmyn at gmail dot com>
pkgbase="python-pytorch"
-pkgname=("python-pytorch" "python2-pytorch")
+pkgname=("python-pytorch" "python2-pytorch" "python-pytorch-cuda" "python2-pytorch-cuda")
_pkgname="pytorch"
pkgver=0.2.0
pkgrel=1
-pkgdesc="Tensors and dynamic neural networks in Python with strong GPU acceleration"
+pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration"
arch=('x86_64')
url="http://pytorch.org"
license=('BSD')
@@ -13,26 +13,53 @@
makedepends=('python' 'python-setuptools' 'python2' 'python2-setuptools'
'python-yaml' 'python2-yaml' 'python-numpy' 'python2-numpy'
'gcc5' 'cmake' 'cuda' 'cudnn')
-optdepends=('cuda' 'cudnn')
-source=("https://github.com/pytorch/pytorch/archive/v${pkgver}.tar.gz")
-sha256sums=('b76d61aaa8fc18b928ca3c910c398687be08f5661d6615884c4faba3e8742a26')
+source=("https://github.com/pytorch/pytorch/archive/v${pkgver}.tar.gz"
+ 2334.patch)
+sha256sums=('b76d61aaa8fc18b928ca3c910c398687be08f5661d6615884c4faba3e8742a26'
+ '1933b0e73785cc3d24013815c79f36267380239f2cbf0561b7702e0d5af61daf')
prepare() {
- cd "$srcdir/"
-
cd "${_pkgname}-${pkgver}"
sed -i -e '144icp -r nccl gloo/third-party/' torch/lib/build_all.sh
sed -i -e '470,475d' setup.py
+
+ patch -Np1 < ${srcdir}/2334.patch
+
cd ..
cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-py2"
+ cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-py3"
+ cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-py2-cuda"
+ cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-py3-cuda"
}
build() {
- msg "Building Python 2"
+ msg "Building Python 2 without cuda"
cd "$srcdir/${_pkgname}-${pkgver}-py2"
# Uncomment and modify the following line to enable Intel MKL and magma support
#CMAKE_PREFIX_PATH=/opt/intel/mkl/include:/opt/intel/mkl/lib/intel64:/opt/magma \
+ CFLAGS="${CFLAGS/-fno-plt/}" \
+ CXXFLAGS="${CFLAGS/-fno-plt/}" \
+ NO_CUDA=1 \
+ WITH_CUDA=0 \
+ WITH_CUDNN=0 \
+ python2 setup.py build
+
+ msg "Building Python 3 without cuda"
+ cd "$srcdir/${_pkgname}-${pkgver}-py3"
+ # Uncomment and modify the following line to enable Intel MKL and magma support
+ #CMAKE_PREFIX_PATH=/opt/intel/mkl/include:/opt/intel/mkl/lib/intel64:/opt/magma \
+ CFLAGS="${CFLAGS/-fno-plt/}" \
+ CXXFLAGS="${CFLAGS/-fno-plt/}" \
+ NO_CUDA=1 \
+ WITH_CUDA=0 \
+ WITH_CUDNN=0 \
+ python setup.py build
+
+ msg "Building Python 2 with cuda"
+ cd "$srcdir/${_pkgname}-${pkgver}-py2-cuda"
+ # Uncomment and modify the following line to enable Intel MKL and magma support
+ #CMAKE_PREFIX_PATH=/opt/intel/mkl/include:/opt/intel/mkl/lib/intel64:/opt/magma \
CC=gcc-5 \
CXX=g++-5 \
CFLAGS="${CFLAGS/-fno-plt/}" \
@@ -44,8 +71,8 @@
CUDNN_INCLUDE_DIR=/opt/cuda/include \
python2 setup.py build
- msg "Building Python 3"
- cd "$srcdir/${_pkgname}-${pkgver}"
+ msg "Building Python 3 with cuda"
+ cd "$srcdir/${_pkgname}-${pkgver}-py3-cuda"
# Uncomment and modify the following line to enable Intel MKL and magma support
#CMAKE_PREFIX_PATH=/opt/intel/mkl/include:/opt/intel/mkl/lib/intel64:/opt/magma \
CC=gcc-5 \
@@ -69,9 +96,25 @@
package_python-pytorch() {
depends+=('python' 'python-yaml' 'python-numpy')
- cd "$srcdir/${_pkgname}-${pkgver}"
+ cd "$srcdir/${_pkgname}-${pkgver}-py3"
python setup.py install --root="$pkgdir"/ --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}
+package_python2-pytorch-cuda() {
+ depends+=('python2' 'python2-yaml' 'python2-numpy')
+ optdepends=('cuda' 'cudnn')
+ cd "$srcdir/${_pkgname}-${pkgver}-py2-cuda"
+ python2 setup.py install --root="$pkgdir"/ --optimize=1 --skip-build
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
+}
+
+package_python-pytorch-cuda() {
+ depends+=('python' 'python-yaml' 'python-numpy')
+ optdepends=('cuda' 'cudnn')
+ cd "$srcdir/${_pkgname}-${pkgver}-py3-cuda"
+ python setup.py install --root="$pkgdir"/ --optimize=1 --skip-build
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
+}
+
# vim:set ts=2 sw=2 et:
More information about the arch-commits
mailing list