diff options
author | Butui Hu | 2019-11-09 21:35:33 +0800 |
---|---|---|
committer | Butui Hu | 2019-11-09 21:35:33 +0800 |
commit | ed84d99258dfd9d6ceb5fea364137a0adc2b9c16 (patch) | |
tree | 7e688b504fcce69193a6bc44bc00e3fe7d37c48b | |
download | aur-ed84d99258dfd9d6ceb5fea364137a0adc2b9c16.tar.gz |
add mxnet-git
-rw-r--r-- | .SRCINFO | 107 | ||||
-rw-r--r-- | PKGBUILD | 205 |
2 files changed, 312 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..6fa25339ddd2 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,107 @@ +pkgbase = mxnet-git + pkgdesc = A flexible and efficient library for deep learning + pkgver = 1.5.1.r10323.a37dcd46cb + pkgrel = 1 + url = http://mxnet.io/ + arch = x86_64 + license = Apache + makedepends = cmake + makedepends = cuda + makedepends = cudnn + makedepends = cython + makedepends = git + makedepends = gtk3 + makedepends = nccl + makedepends = opencv + makedepends = patchelf + makedepends = qt5-base + depends = curl + depends = cblas + depends = double-conversion + depends = hdf5 + depends = intel-tbb + depends = lapack + depends = openblas + depends = protobuf + depends = python-graphviz + depends = python-numpy + depends = python-requests + depends = zeromq + provides = mxnet=1.5.1.r10323.a37dcd46cb + conflicts = mxnet + source = mxnet::git+https://github.com/apache/incubator-mxnet.git + sha512sums = SKIP + +pkgname = mxnet-git + depends = curl + depends = cblas + depends = double-conversion + depends = hdf5 + depends = intel-tbb + depends = lapack + depends = openblas + depends = protobuf + depends = python-graphviz + depends = python-numpy + depends = python-requests + depends = zeromq + depends = opencv + +pkgname = mxnet-mkl-git + pkgdesc = A flexible and efficient library for deep learning (with MKL-DNN) + depends = curl + depends = cblas + depends = double-conversion + depends = hdf5 + depends = intel-tbb + depends = lapack + depends = openblas + depends = protobuf + depends = python-graphviz + depends = python-numpy + depends = python-requests + depends = zeromq + depends = opencv + provides = mxnet + conflicts = mxnet + +pkgname = mxnet-cuda-git + pkgdesc = A flexible and efficient library for deep learning (with CUDA) + depends = curl + depends = cblas + depends = double-conversion + depends = hdf5 + depends = intel-tbb + depends = lapack + depends = openblas + depends = protobuf + depends = python-graphviz + depends = python-numpy + depends = python-requests + depends = zeromq + depends = cuda + depends = cudnn + depends = nccl + provides = mxnet + conflicts = mxnet + +pkgname = mxnet-cuda-mkl-git + pkgdesc = A flexible and efficient library for deep learning (with CUDA and MKL-DNN) + depends = curl + depends = cblas + depends = double-conversion + depends = hdf5 + depends = intel-tbb + depends = lapack + depends = openblas + depends = protobuf + depends = python-graphviz + depends = python-numpy + depends = python-requests + depends = zeromq + depends = cuda + depends = cudnn + depends = nccl + provides = mxnet + conflicts = mxnet + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..87e413c91401 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,205 @@ +# Maintainer: Butui Hu <hot123tea123@gmail.com> + +cudaarch=All +_pkgname=mxnet +pkgname=('mxnet-git' 'mxnet-mkl-git' 'mxnet-cuda-git' 'mxnet-cuda-mkl-git') +_pkgver=1.5.1 +pkgver=1.5.1.r10323.a37dcd46cb +pkgrel=1 +pkgdesc="A flexible and efficient library for deep learning" +arch=('x86_64') +url="http://mxnet.io/" +license=('Apache') +depends=( + 'curl' + 'cblas' + 'double-conversion' + 'hdf5' + 'intel-tbb' + 'lapack' + 'openblas' + 'protobuf' + 'python-graphviz' + 'python-numpy' + 'python-requests' + 'zeromq' +) +makedepends=( + 'cmake' + 'cuda' + 'cudnn' + 'cython' + 'git' + 'gtk3' + 'nccl' + 'opencv' + 'patchelf' + 'qt5-base' +) +provides=(mxnet=${pkgver}) +conflicts=(mxnet) +source=("${_pkgname}::git+https://github.com/apache/incubator-mxnet.git") +sha512sums=('SKIP') + +pkgver() { + cd "${srcdir}/${_pkgname}" + ver=$(printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)") + echo "${_pkgver}.${ver}" +} + +prepare() { + cd "${srcdir}/${_pkgname}" + git submodule update --init --recursive + # do not use 3rd party openmp + rm -rfv "${srcdir}/${_pkgname}/3rdparty/openmp" + # the latest cmake set OpenMP_FOUND instead of OPENMP_FOUND + sed -i 's/OPENMP_FOUND/OpenMP_FOUND/g' "${srcdir}/${_pkgname}/CMakeLists.txt" + rm -rf "${srcdir}/${_pkgname}/build" + mkdir "${srcdir}/${_pkgname}/build" + cp -r "${srcdir}/${_pkgname}" "${srcdir}/mxnet-cuda-git" + cp -r "${srcdir}/${_pkgname}" "${srcdir}/mxnet-cuda-mkl-git" + cp -r "${srcdir}/${_pkgname}" "${srcdir}/mxnet-git" + cp -r "${srcdir}/${_pkgname}" "${srcdir}/mxnet-mkl-git" +} + +build() { + cmake_opts=( + -DBUILD_CPP_EXAMPLES:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF + -DCMAKE_BUILD_TYPE:String=Release + -DCMAKE_EXE_LINKER_FLAGS="$(pkg-config --libs cblas)" + -DCMAKE_INSTALL_LIBDIR:PATH=lib + -DCMAKE_INSTALL_PREFIX:PATH=/usr + -DCMAKE_SHARED_LINKER_FLAGS="$(pkg-config --libs cblas)" + -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON + -DINSTALL_DOCUMENTATION:BOOL=OFF + -DUSE_BLAS=open + -DUSE_CPP_PACKAGE:BOOL=ON + -DUSE_DIST_KVSTORE:BOOL=ON + -DUSE_GPERFTOOLS:BOOL=OFF + -DUSE_JEMALLOC:BOOL=OFF + -DUSE_LAPACK:BOOL=ON + -DUSE_MKL_IF_AVAILABLE:BOOL=OFF + -DUSE_OPENMP:BOOL=ON + -DUSE_S3:BOOL=ON +) + + # building without MKL-DNN and without CUDA + cd "${srcdir}/mxnet-git/build" + cmake \ + ${cmake_opts[@]} \ + -DUSE_CUDA:BOOL=OFF \ + -DUSE_CUDNN:BOOL=OFF \ + -DUSE_MKLDNN:BOOL=OFF \ + -DUSE_NCCL:BOOL=OFF \ + -DUSE_OPENCV:BOOL=ON \ + .. + make + cd ../python + python setup.py build --with-cython + + # building with MKL-DNN and without CUDA + cd "${srcdir}/mxnet-mkl-git/build" + cmake \ + ${cmake_opts[@]} \ + -DUSE_CUDA:BOOL=OFF \ + -DUSE_CUDNN:BOOL=OFF \ + -DUSE_MKLDNN:BOOL=ON \ + -DUSE_NCCL:BOOL=OFF \ + -DUSE_OPENCV:BOOL=ON \ + .. + make + cd ../python + python setup.py build --with-cython + + # use gcc version compatible with CUDA + export CC=/opt/cuda/bin/gcc + export CXX=/opt/cuda/bin/g++ + # building with CUDA and without MKL-DNN + cd "${srcdir}/mxnet-cuda-git/build" + cmake \ + ${cmake_opts[@]} \ + -DCUDA_ARCH_LIST=${cudaarch} \ + -DUSE_CUDA:BOOL=ON \ + -DUSE_CUDNN:BOOL=ON \ + -DUSE_MKLDNN:BOOL=OFF \ + -DUSE_NCCL:BOOL=ON \ + -DUSE_OPENCV:BOOL=OFF \ + .. + make + cd ../python + python setup.py build --with-cython + + # building with CUDA and with MKL-DNN + cd "${srcdir}/mxnet-cuda-mkl-git/build" + cmake \ + ${cmake_opts[@]} \ + -DCUDA_ARCH_LIST=${cudaarch} \ + -DUSE_CUDA:BOOL=ON \ + -DUSE_CUDNN:BOOL=ON \ + -DUSE_MKLDNN:BOOL=ON \ + -DUSE_NCCL:BOOL=ON \ + -DUSE_OPENCV:BOOL=OFF \ + .. + make + cd ../python + python setup.py build --with-cython +} + +_package() { + cd "${srcdir}/${pkgname}/build" + # install mxnet core component + make DESTDIR="${pkgdir}" install + + if [ -f "${srcdir}/${pkgname}/build/im2rec" ]; then + install -Dm755 "${srcdir}/${pkgname}/build/im2rec" "${pkgdir}/usr/bin/im2rec" + fi + + # install python binding + cd "${srcdir}/${pkgname}/python" + python setup.py install --root="${pkgdir}" --optimize=1 --with-cython --skip-build + install -Dm644 "${srcdir}/${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + + rm -rfv "${pkgdir}/usr/mxnet" + ln -sf '/usr/lib/libmxnet.so' "${pkgdir}/usr/lib/python3.7/site-packages/mxnet/libmxnet.so" + ln -s "/usr/include" "${pkgdir}/usr/lib/python3.7/site-packages/mxnet/include" + install -d "${pkgdir}/usr/lib/mxnet/mkldnn" + find "${pkgdir}/usr/lib" -name 'libmkldnn*' -exec mv {} "${pkgdir}/usr/lib/mxnet/mkldnn" \; + # patch rpath + find "${pkgdir}" -type f -perm 755 -exec patchelf --set-rpath '/usr/lib/mxnet/mkldnn' {} \; + # remove unwantted files + rm -rfv "${pkgdir}/usr/lib/cmake" "${pkgdir}/usr/share/doc" + find "${pkgdir}/usr/include" -type f -name 'mkldnn*' -delete + find "${pkgdir}" -type d -empty -delete +} + +package_mxnet-git() { + depends+=(opencv) + _package +} + +package_mxnet-cuda-git() { + pkgdesc="${pkgdesc} (with CUDA)" + depends+=(cuda cudnn nccl) + conflicts=(mxnet) + provides=(mxnet) + _package +} + +package_mxnet-mkl-git() { + pkgdesc="${pkgdesc} (with MKL-DNN)" + depends+=(opencv) + conflicts=(mxnet) + provides=(mxnet) + _package +} + +package_mxnet-cuda-mkl-git() { + pkgdesc="${pkgdesc} (with CUDA and MKL-DNN)" + depends+=(cuda cudnn nccl) + conflicts=(mxnet) + provides=(mxnet) + _package +} +# vim:set ts=2 sw=2 et: + |