Last active
August 7, 2017 13:55
-
-
Save brokenpylons/475179c73ca63d63778976a29c46f7f7 to your computer and use it in GitHub Desktop.
Updated PyTorch PKGBUILD file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Maintainer: Stephen Zhang <stephen at gmail dot com> | |
| pkgbase="python-pytorch" | |
| pkgname=("python-pytorch" "python2-pytorch") | |
| _pkgname="pytorch" | |
| pkgver=0.2.0 | |
| pkgrel=1 | |
| pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration" | |
| arch=('x86_64') | |
| url="http://pytorch.org" | |
| license=('BSD') | |
| makedepends=('python' 'python-setuptools' 'python2' 'python2-setuptools' | |
| 'python-yaml' 'python2-yaml' 'python-numpy' 'python2-numpy' | |
| 'gcc5' 'cmake') | |
| depends=('cuda' 'cudnn') | |
| source=("https://github.com/pytorch/pytorch/archive/v${pkgver}.tar.gz") | |
| sha256sums=('22b30638536d20d387e1adff62aa4b9ddebd8ac7ab812a36c699d72df9f7f570') | |
| prepare() { | |
| cd "$srcdir/" | |
| cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-py2" | |
| cd "${_pkgname}-${pkgver}" | |
| sed -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \ | |
| -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \ | |
| -e "s|#![ ]*/bin/env python$|#!/usr/bin/env python2|" \ | |
| -i $(find . -name '*.py') | |
| } | |
| build() { | |
| msg "Building Python 2" | |
| cd "$srcdir/${_pkgname}-${pkgver}-py2" | |
| CC=gcc-5 \ | |
| CXX=g++-5 \ | |
| CFLAGS="${CFLAGS/-fno-plt/}" \ | |
| CXXFLAGS="${CXXFLAGS/-fno-plt/}" \ | |
| WITH_CUDA=1 \ | |
| CUDA_HOME=/opt/cuda \ | |
| WITH_CUDNN=1 \ | |
| CUDNN_LIB_DIR=/opt/cuda/lib64 \ | |
| CUDNN_INCLUDE_DIR=/opt/cuda/include \ | |
| python2 setup.py build | |
| msg "Building Python 3" | |
| cd "$srcdir/${_pkgname}-${pkgver}" | |
| CC=gcc-5 \ | |
| CXX=g++-5 \ | |
| CFLAGS="${CFLAGS/-fno-plt/}" \ | |
| CXXFLAGS="${CXXFLAGS/-fno-plt/}" \ | |
| WITH_CUDA=1 \ | |
| CUDA_HOME=/opt/cuda \ | |
| WITH_CUDNN=1 \ | |
| CUDNN_LIB_DIR=/opt/cuda/lib64 \ | |
| CUDNN_INCLUDE_DIR=/opt/cuda/include \ | |
| python setup.py build | |
| } | |
| package_python2-pytorch() { | |
| depends+=('python2' 'python2-yaml' 'python2-numpy') | |
| cd "$srcdir/${_pkgname}-${pkgver}-py2" | |
| python2 setup.py install --root="$pkgdir"/ --optimize=1 --skip-build | |
| install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt" | |
| } | |
| package_python-pytorch() { | |
| depends+=('python' 'python-yaml' 'python-numpy') | |
| cd "$srcdir/${_pkgname}-${pkgver}" | |
| 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: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment