summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD347
1 files changed, 150 insertions, 197 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 2c7e175eacf5..cd4a8173bd16 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,104 +1,52 @@
-# Maintainer : Daniel Bermond < gmail-com: danielbermond >
+# Maintainer : Daniel Bermond <dbermond@archlinux.org>
-_pybind11_commit='5c8746ff135abb390bf95944be593e895a586a50'
-_cub_commit='285aeebaa34b0e8a7670867a2e66c1a52d998d6a'
-_eigen_commit='f59336cee358f92b959de6a0daf07c4ab2318022'
-_googletest_commit='2fe3bd994b3189899d93f1d5a881e725e046fdc2'
-_benchmark_commit='505be96ab23056580a3a2315abba048f4428b04e'
-_protobuf_commit='2761122b810fe8861004ae785cc3ab39f384d342'
-_ios_cmake_commit='8abaed637d56f1337d6e1d2c4026e25c1eade724'
-_nnpack_commit='1e005b0c2777f39972a4ac15bea03e0e315a3d92'
-_gloo_commit='670b4d4aa46886cc66874e2a4dc846f5cfc2a285'
-_pthreadpool_commit='13da0b4c21d17f94150713366420baaf1b5a46f4'
-_fxdiv_commit='b742d1143724d646cd0f914646f1240eacf5bd73'
-_fp16_commit='34d4bf01bbf7376f2baa71b8fa148b18524d45cf'
-_psimd_commit='90a938f30ba414ada2f4b00674ee9631d7d85e19'
-_zstd_commit='aec56a52fbab207fc639a1937d1e708a282edca8'
-_cpuinfo_commit='89fe1695edf9ee14c22f815f24bac45577a4f135'
-_python_enum_commit='4cfedc426c4e2fc52e3f5c2b4297e15ed8d6b8c7'
-_python_peachpy_commit='07d8fde8ac45d7705129475c0f94ed8925b93473'
-_python_six_commit='15e31431af97e5e64b80af0a3f598d382bcdd49a'
-_computelibrary_commit='292227986edb37b01061afcad6df18ba9d6ccbeb'
-_onnx_commit='42804705bdbf179d1a98394008417e1392013547'
-_onnx_tensorrt_commit='fa0964e8477fc004ee2f49ee77ffce0bf7f711a9'
-_sleef_commit='6ff7a135a1e31979d1e1844a2e7171dfbd34f54f'
-_ideep_commit='7b8f9d025a675522305a1c5d1328d83f11f205e8'
-_nccl_commit='3c6e25210bb1b544748937e5db74db0b9679b95e'
-_gemmlowp_commit='8416bab644641a5c0a81ecf91a5cda804af0aee1'
-_qnnpack_commit='ef05e87cef6b8e719989ce875b5e1c9fdb304c05'
-_arm_neon_commit='97a126f08ce318023be604d03f88bf0820a9464a'
-_fbgemm_commit='79333308f5e2fc242727879dcd3de3536b6ffc39'
-_asmjit_commit='1e550aa568da993acb742ac19f2ab691a2806ad5'
-
-_pytorchver=1.0.1 # pytorch stable release version
-
-pkgname=caffe2
-pkgver="0.8.2.pytorch.${_pytorchver}"
+pkgbase=caffe2
+pkgname=('caffe2' 'caffe2-cuda')
+_pytorchver=1.1.0 # pytorch stable release version
+pkgver="0.8.2_${_pytorchver}"
pkgrel=1
pkgdesc='A new lightweight, modular, and scalable deep learning framework'
-arch=('i686' 'x86_64')
+arch=('x86_64')
url='https://caffe2.ai/'
license=('BSD')
-depends=(
- # official repositories:
- # required:
- 'google-glog' 'protobuf' 'lapack' 'python' 'python-numpy' 'python-protobuf'
- # not required but enabled in build:
- 'gflags' 'gtest' 'openmp' 'leveldb' 'lmdb' 'numactl' 'openmpi' 'snappy'
- 'zeromq' 'hiredis' 'gtk3' 'ffmpeg'
- # python:
- 'python-flask' 'python-future' 'graphviz' 'python-hypothesis'
- 'python-jupyter_core' 'python-matplotlib' 'python-pydot' 'python-yaml'
- 'python-requests' 'python-scipy' 'python-setuptools' 'python-six'
- 'python-tornado' 'python-gflags' 'python-pyzmq'
- # AUR:
- # not required but enabled in build:
- 'rdma-core'
- # python:
- 'python-nvd3' 'python-scikit-image' 'python-glog' 'python-leveldb'
- 'python-lmdb'
-)
-makedepends=('git' 'cmake')
-provides=('caffe2-cpu')
-conflicts=('caffe2-cpu' 'python-pytorch')
-replaces=('caffe2-cpu')
+depends=('google-glog' 'protobuf' 'python' 'python-numpy' 'python-protobuf'
+ 'python-yaml' 'blas' 'lapack' 'gflags')
+optdepends=('python-flask' 'graphviz' 'python-hypothesis' 'python-matplotlib'
+ 'python-pydot' 'python-nvd3' 'python-yaml' 'python-requests'
+ 'python-scikit-image' 'python-scipy' 'python-setuptools'
+ 'python-future' 'python-tornado' 'python-six' 'python-lmdb')
+makedepends=('git' 'cmake' 'gtest' 'snappy' 'cuda' 'cudnn' 'nccl')
options=('!emptydirs')
-source=(
- # main source:
- "pytorch-${_pytorchver}.tar.gz"::"https://github.com/pytorch/pytorch/archive/v${_pytorchver}.tar.gz"
- "git+https://github.com/pybind/pybind11.git#commit=${_pybind11_commit}"
- "git+https://github.com/NVlabs/cub.git#commit=${_cub_commit}"
- "git+https://github.com/eigenteam/eigen-git-mirror.git#commit=${_eigen_commit}"
- "git+https://github.com/google/googletest.git#commit=${_googletest_commit}"
- "git+https://github.com/google/benchmark.git#commit=${_benchmark_commit}"
- "git+https://github.com/google/protobuf.git#commit=${_protobuf_commit}"
- "git+https://github.com/Yangqing/ios-cmake.git#commit=${_ios_cmake_commit}"
- "git+https://github.com/Maratyszcza/NNPACK.git#commit=${_nnpack_commit}"
- "git+https://github.com/facebookincubator/gloo.git#commit=${_gloo_commit}"
- "git+https://github.com/Maratyszcza/pthreadpool.git#commit=${_pthreadpool_commit}"
- "git+https://github.com/Maratyszcza/FXdiv.git#commit=${_fxdiv_commit}"
- "git+https://github.com/Maratyszcza/FP16.git#commit=${_fp16_commit}"
- "git+https://github.com/Maratyszcza/psimd.git#commit=${_psimd_commit}"
- "git+https://github.com/facebook/zstd.git#commit=${_zstd_commit}"
- "git+https://github.com/Maratyszcza/cpuinfo.git#commit=${_cpuinfo_commit}"
- "git+https://github.com/PeachPy/enum34.git#commit=${_python_enum_commit}"
- "git+https://github.com/Maratyszcza/PeachPy.git#commit=${_python_peachpy_commit}"
- "git+https://github.com/benjaminp/six.git#commit=${_python_six_commit}"
- "git+https://github.com/ARM-software/ComputeLibrary.git#commit=${_computelibrary_commit}"
- "git+https://github.com/onnx/onnx.git#commit=${_onnx_commit}"
- "git+https://github.com/bddppq/onnx-tensorrt.git#commit=${_onnx_tensorrt_commit}"
- "git+https://github.com/zdevito/sleef.git#commit=${_sleef_commit}"
- "git+https://github.com/intel/ideep.git#commit=${_ideep_commit}"
- "git+https://github.com/NVIDIA/nccl.git#commit=${_nccl_commit}"
- "git+https://github.com/google/gemmlowp.git#commit=${_gemmlowp_commit}"
- "git+https://github.com/pytorch/QNNPACK.git#commit=${_qnnpack_commit}"
- "git+https://github.com/intel/ARM_NEON_2_x86_SSE.git#commit=${_arm_neon_commit}"
- "git+https://github.com/pytorch/fbgemm.git#commit=${_fbgemm_commit}"
- # others:
- "git+https://github.com/asmjit/asmjit.git#commit=${_asmjit_commit}"
-)
-sha256sums=('210561583378132d07287518710251bcf861f9b7d625eb67258ed2e9d567cea1'
- 'SKIP'
+source=("git+https://github.com/pytorch/pytorch.git#tag=v${_pytorchver}"
+ 'git+https://github.com/pybind/pybind11'
+ 'git+https://github.com/NVlabs/cub'
+ 'git+https://github.com/eigenteam/eigen-git-mirror'
+ 'git+https://github.com/google/googletest'
+ 'git+https://github.com/google/benchmark'
+ 'git+https://github.com/google/protobuf'
+ 'git+https://github.com/Yangqing/ios-cmake'
+ 'git+https://github.com/Maratyszcza/NNPACK'
+ 'git+https://github.com/facebookincubator/gloo'
+ 'git+https://github.com/Maratyszcza/pthreadpool'
+ 'git+https://github.com/Maratyszcza/FXdiv'
+ 'git+https://github.com/Maratyszcza/FP16'
+ 'git+https://github.com/Maratyszcza/psimd'
+ 'git+https://github.com/facebook/zstd'
+ 'git+https://github.com/Maratyszcza/cpuinfo'
+ 'git+https://github.com/PeachPy/enum34'
+ 'git+https://github.com/Maratyszcza/PeachPy'
+ 'git+https://github.com/benjaminp/six'
+ 'git+https://github.com/onnx/onnx'
+ 'git+https://github.com/onnx/onnx-tensorrt'
+ 'sleef-zdevito'::'git+https://github.com/zdevito/sleef'
+ 'git+https://github.com/intel/ideep'
+ 'git+https://github.com/NVIDIA/nccl.git'
+ 'git+https://github.com/google/gemmlowp'
+ 'git+https://github.com/pytorch/QNNPACK'
+ 'git+https://github.com/intel/ARM_NEON_2_x86_SSE'
+ 'git+https://github.com/pytorch/fbgemm'
+ 'git+https://github.com/houseroad/foxi')
+sha256sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
@@ -129,133 +77,138 @@ sha256sums=('210561583378132d07287518710251bcf861f9b7d625eb67258ed2e9d567cea1'
'SKIP')
prepare() {
- cd "pytorch-${_pytorchver}/third_party"
+ mkdir -p pytorch/{build-cpu-only,build-cuda}
- local _component
- local _thirdparty_list="pybind11 cub googletest benchmark protobuf ios-cmake \
- NNPACK pthreadpool FXdiv FP16 psimd gloo zstd cpuinfo \
- ComputeLibrary onnx onnx-tensorrt sleef ideep QNNPACK \
- fbgemm"
-
- # third_party which clone dir does not coincide with the third_party name
- rm -r eigen python-enum python-peachpy python-six nccl/nccl gemmlowp/gemmlowp neon2sse
- ln -s "${srcdir}/eigen-git-mirror" eigen
- ln -s "${srcdir}/enum34" python-enum
- ln -s "${srcdir}/PeachPy" python-peachpy
- ln -s "${srcdir}/six" python-six
- ln -s "${srcdir}/nccl" nccl/nccl
- ln -s "${srcdir}/gemmlowp" gemmlowp/gemmlowp
- ln -s "${srcdir}/ARM_NEON_2_x86_SSE" neon2sse
+ cd pytorch
- # third_party which clone dir coincide with the third_party name
- for _component in $_thirdparty_list
+ # submodules which clone dir coincide with the submodule name
+ local _submodule_list=('pybind11'
+ 'cub'
+ 'googletest'
+ 'benchmark'
+ 'protobuf'
+ 'ios-cmake'
+ 'NNPACK'
+ 'gloo'
+ 'zstd'
+ 'onnx'
+ 'onnx-tensorrt'
+ 'sleef'
+ 'ideep'
+ 'QNNPACK'
+ 'fbgemm'
+ 'foxi')
+ local _submodule
+ for _submodule in "${_submodule_list[@]}"
do
- rm -rf "$_component"
- ln -sf "${srcdir}/${_component}" "${_component}"
+ git config --local "submodule.third_party/${_submodule}.url" "${srcdir}/${_submodule}"
done
+
+ # submodules which clone dir does not coincide with the submodule name
+ git config --local "submodule.third_party/eigen.url" "${srcdir}/eigen-git-mirror"
+ git config --local "submodule.third_party/NNPACK_deps/pthreadpool.url" "${srcdir}/pthreadpool"
+ git config --local "submodule.third_party/NNPACK_deps/FXdiv.url" "${srcdir}/FXdiv"
+ git config --local "submodule.third_party/NNPACK_deps/FP16.url" "${srcdir}/FP16"
+ git config --local "submodule.third_party/NNPACK_deps/psimd.url" "${srcdir}/psimd"
+ git config --local "submodule.third_party/python-enum.url" "${srcdir}/enum34"
+ git config --local "submodule.third_party/python-peachpy.url" "${srcdir}/PeachPy"
+ git config --local "submodule.third_party/python-six.url" "${srcdir}/six"
+ git config --local "submodule.third_party/sleef.url" "${srcdir}/sleef-zdevito"
+ git config --local "submodule.third_party/neon2sse.url" "${srcdir}/ARM_NEON_2_x86_SSE"
+ git config --local "submodule.third_party/nccl/nccl.url" "${srcdir}/nccl"
+ git config --local "submodule.third_party/gemmlowp/gemmlowp.url" "${srcdir}/gemmlowp"
+
+ # special case (upstream uses third.party instead of third_party)
+ git config --local 'submodule.third-party/cpuinfo.url' "${srcdir}/cpuinfo"
+
+ git submodule update
}
build() {
- cd "pytorch-${_pytorchver}"
-
- local _pythonver
- _pythonver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
-
- mkdir -p build
- cd build
+ local _common_opts=('..'
+ '-DBLAS:STRING=Eigen'
+ '-DBUILD_BINARY:BOOL=ON'
+ '-DBUILD_CUSTOM_PROTOBUF:BOOL=OFF'
+ '-DBUILD_SHARED_LIBS:BOOL=ON'
+ '-DCMAKE_BUILD_TYPE:STRING=None'
+ '-DCMAKE_INSTALL_LIBDIR:PATH=lib'
+ '-DCMAKE_INSTALL_PREFIX:PATH=/usr'
+ '-DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES'
+ '-DCXX_AVX2_FOUND:BOOL=FALSE'
+ '-DCXX_AVX_FOUND:BOOL=FALSE'
+ '-DC_AVX2_FOUND:BOOL=FALSE'
+ '-DC_AVX_FOUND:BOOL=FALSE'
+ '-DUSE_GFLAGS:BOOL=ON'
+ '-DUSE_GLOG:BOOL=ON'
+ '-DUSE_MPI:BOOL=OFF'
+ '-DUSE_NUMA:BOOL=OFF'
+ '-DUSE_OPENCV:BOOL=OFF'
+ '-Wno-dev')
+ # caffe2-cuda
+ cd pytorch/build-cuda
cmake \
- -DBLAS:STRING='Eigen' \
- \
- -DBUILD_BINARY:BOOL='ON' \
- -DBUILD_DOCS:BOOL='OFF' \
- -DBUILD_PYTHON:BOOL='ON' \
- -DBUILD_SHARED_LIBS:BOOL='ON' \
- \
- -DCMAKE_INSTALL_LIBDIR:PATH='lib' \
- -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
- \
- -DGLOO_STATIC_OR_SHARED:STRING='STATIC' \
- \
- -DOpenCV_DIR:PATH='/usr/share/OpenCV' \
- -DASMJIT_SRC_DIR:STRING="${srcdir}/asmjit" \
- \
- -DPYTHON_EXECUTABLE:FILEPATH="/usr/bin/python${_pythonver}" \
- -DPYTHON_INCLUDE_DIR:PATH="/usr/include/python${_pythonver}m" \
- -DPYTHON_LIBRARY:FILEPATH="/usr/lib/libpython${_pythonver}m.so" \
- \
- -DUSE_ACL:BOOL='OFF' \
- -DUSE_ASAN:BOOL='OFF' \
- -DUSE_CUDA:BOOL='OFF' \
- -DUSE_CUDNN:BOOL='OFF' \
- -DUSE_DISTRIBUTED:BOOL='ON' \
- -DUSE_FBGEMM:BOOL='ON' \
- -DUSE_FFMPEG:BOOL='ON' \
- -DUSE_GFLAGS:BOOL='ON' \
- -DUSE_GLOG:BOOL='ON' \
- -DUSE_GLOO:BOOL='ON' \
- -DUSE_GLOO_IBVERBS:BOOL='ON' \
- -DUSE_IBVERBS:BOOL='ON' \
- -DUSE_LEVELDB:BOOL='ON' \
- -DUSE_LITE_PROTO:BOOL='OFF' \
- -DUSE_LMDB:BOOL='ON' \
+ "${_common_opts[@]}" \
+ -DCMAKE_CXX_COMPILER:FILEPATH='/usr/bin/g++' \
+ -DCMAKE_C_COMPILER:FILEPATH='/usr/bin/gcc' \
+ -DCUDA_HOST_COMPILER:FILEPATH='/usr/bin/gcc' \
+ -DCUDA_NVCC_FLAGS:STRING='-Xfatbin -compress-all' \
+ -DTORCH_CUDA_ARCH_LIST='3.0;3.2;3.5;3.7;5.0;5.2;5.3;6.0;6.1;6.2;7.0;7.2;7.5' \
+ -DUSE_CUDA:BOOL='ON' \
+ -DUSE_CUDNN:BOOL='ON' \
-DUSE_METAL:BOOL='OFF' \
- -DUSE_MKLDNN:BOOL='OFF' \
- -DUSE_MPI:BOOL='ON' \
- -DUSE_NCCL:BOOL='OFF' \
- -DUSE_NNAPI:BOOL='ON' \
- -DUSE_NNPACK:BOOL='ON' \
- -DUSE_NUMA:BOOL='ON' \
- -DUSE_NUMPY:BOOL='ON' \
- -DUSE_NVRTC:BOOL='OFF' \
- -DUSE_OBSERVERS:BOOL='ON' \
- -DUSE_OPENCL:BOOL='OFF' \
- -DUSE_OPENCV:BOOL='OFF' \
- -DUSE_OPENMP:BOOL='ON' \
- -DUSE_PROF:BOOL='OFF' \
- -DUSE_QNNPACK:BOOL='ON' \
- -DUSE_REDIS:BOOL='ON' \
- -DUSE_ROCKSDB:BOOL='OFF' \
- -DUSE_ROCM:BOOL='OFF' \
- -DUSE_SNPE:BOOL='OFF' \
- -DUSE_SYSTEM_EIGEN_INSTALL:BOOL='OFF' \
- -DUSE_SYSTEM_NCCL:BOOL='OFF' \
- -DUSE_TENSORRT:BOOL='OFF' \
- -DUSE_ZMQ:BOOL='ON' \
- -DUSE_ZSTD:BOOL='ON' \
- -DWITH_OPENMP:BOOL='ON' \
- \
- -Wno-dev \
- ..
-
+ -DUSE_NCCL:BOOL='ON' \
+ -DUSE_SYSTEM_NCCL:BOOL='ON'
+ ## fix: avoid a second compilation in package()
+ sed -i 's/^preinstall:[[:space:]]all/preinstall:/' Makefile
+ make
+
+ # caffe2 (cpu only, without cuda support)
+ cd "${srcdir}/pytorch/build-cpu-only"
+ cmake "${_common_opts[@]}" -DUSE_CUDA:BOOL='OFF' -DUSE_NCCL:BOOL='OFF'
make
}
-package() {
- cd "pytorch-${_pytorchver}/build"
-
+_package_common() {
make DESTDIR="$pkgdir" install
# remove unneeded files
local _entry
local _exclude_dirs
- mapfile -t -d '' _exclude_dirs < <(find "${pkgdir}/usr/include" -mindepth 1 -maxdepth 1 -type d ! -name 'caffe*' -print0)
- rm "$pkgdir"/usr/bin/{protoc,unzstd,zstd{cat,mt,}}
- rm "$pkgdir"/usr/include/{*.h,*.py}
- rm "$pkgdir"/usr/lib/*.a
- rm "$pkgdir"/usr/lib/lib{onnxifi,zstd}*
- rm -r "$pkgdir"/usr/lib/cmake/protobuf
- rm "$pkgdir"/usr/lib/pkgconfig/{protobuf-lite,protobuf}.pc
- rm "$pkgdir"/usr/share/pkgconfig/libzstd.pc
+ rm "$pkgdir"/usr/include/*.h
+ rm "$pkgdir"/usr/lib/{*.a,lib{foxi*,onnxifi*}.so*}
rm -r "$pkgdir"/usr/share/{ATen,cmake/{ATen,Gloo,ONNX}}
- rm "$pkgdir"/usr/share/man/man1/{unzstd,zstd{cat,}}.1
+ rm -r "$pkgdir"/torch
+ mapfile -t -d '' _exclude_dirs < <(find "${pkgdir}/usr/include" -mindepth 1 -maxdepth 1 -type d ! -name 'caffe*' ! -name 'c10' -print0)
for _entry in "${_exclude_dirs[@]}"
do
rm -rf "$_entry"
done
# license
- cd "${srcdir}/pytorch-${_pytorchver}"
+ cd "${srcdir}/pytorch"
install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
install -D -m644 NOTICE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
+
+package_caffe2-cuda() {
+ pkgdesc+=' (with cuda support)'
+ depends+=('cuda' 'cudnn' 'nccl')
+ provides=('caffe2')
+ conflicts=('caffe2')
+
+ cd pytorch/build-cuda
+
+ _package_common
+}
+
+package_caffe2() {
+ pkgdesc+=' (cpu only)'
+ provides=('caffe2-cpu')
+ conflicts=('caffe2-cpu')
+ replaces=('caffe2-cpu')
+
+ cd pytorch/build-cpu-only
+
+ _package_common
+}