commit: 1823ef711155df1e529ba5c414238c23695372a6 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> AuthorDate: Wed Jan 12 11:51:23 2022 +0000 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> CommitDate: Wed Jan 12 11:51:23 2022 +0000 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=1823ef71
sci-libs/pytorch: cleanup old we finally have a working version of this again Closes: https://github.com/gentoo/sci/issues/1075 Closes: https://github.com/gentoo/sci/issues/1073 Closes: https://github.com/gentoo/sci/issues/1070 Closes: https://github.com/gentoo/sci/issues/953 Closes: https://bugs.gentoo.org/789807 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org> sci-libs/pytorch/metadata.xml | 5 - sci-libs/pytorch/pytorch-1.6.0-r2.ebuild | 287 --------------------------- sci-libs/pytorch/pytorch-1.7.1-r2.ebuild | 292 ---------------------------- sci-libs/pytorch/pytorch-1.9.0.ebuild | 321 ------------------------------- 4 files changed, 905 deletions(-) diff --git a/sci-libs/pytorch/metadata.xml b/sci-libs/pytorch/metadata.xml index 01e2b2703..df07ea4be 100644 --- a/sci-libs/pytorch/metadata.xml +++ b/sci-libs/pytorch/metadata.xml @@ -11,23 +11,18 @@ </maintainer> <use> <flag name="asan">Build with address sanitizer (ASAN)</flag> - <flag name="atlas">Use ATLAS as BLAS implementation</flag> <flag name="cuda">Enable support for nVidia CUDA</flag> - <flag name="eigen">Use Eigen as BLAS implementation</flag> <flag name="fbgemm">Enable FBGEMM (Facebook GEneral Matrix Multiplication) support</flag> <flag name="gflags">Build with gflags</flag> <flag name="glog">Build with glog support</flag> <flag name="gloo">Build gloo distributed communication backend support</flag> <flag name="leveldb">Enable support for LevelDB</flag> <flag name="lmdb">Enable support for LMDB</flag> - <flag name="mkl">Use Intel MKL as BLAS implementation</flag> <flag name="mkldnn">Build with Intel MKL-DNN support</flag> <flag name="namedtensor">Enable support for named tensors</flag> <flag name="nnpack">Enable NNPACK support</flag> <flag name="numa">Enable support for NUMA</flag> - <flag name="numpy">Enable NumPy support</flag> <flag name="observers">Build observers</flag> - <flag name="openblas">Use OpenBLAS as BLAS implementation</flag> <flag name="opencv">Enable support for OpenCV</flag> <flag name="opencl">Enable support for OpenCL</flag> <flag name="qnnpack">Enable QNNPACK support</flag> diff --git a/sci-libs/pytorch/pytorch-1.6.0-r2.ebuild b/sci-libs/pytorch/pytorch-1.6.0-r2.ebuild deleted file mode 100644 index 280089c6e..000000000 --- a/sci-libs/pytorch/pytorch-1.6.0-r2.ebuild +++ /dev/null @@ -1,287 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{7,8} ) - -inherit distutils-r1 cmake cuda - -MPV=${PV/_p/a} - -DESCRIPTION="Tensors and Dynamic neural networks in Python with strong GPU acceleration" -HOMEPAGE="https://pytorch.org/" -SRC_URI="https://github.com/pytorch/${PN}/archive/v${MPV}.tar.gz -> ${P}.tar.gz -https://github.com/google/benchmark/archive/505be96ab.tar.gz -> benchmark-505be96ab.tar.gz -https://github.com/pytorch/cpuinfo/archive/63b254577.tar.gz -> cpuinfo-63b254577.tar.gz -https://github.com/NVlabs/cub/archive/d106ddb99.tar.gz -> cub-d106ddb99.tar.gz -https://github.com/pytorch/fbgemm/archive/87c378172.tar.gz -> fbgemm-87c378172.tar.gz -https://github.com/fmtlib/fmt/archive/9bdd1596c.tar.gz -> fmt-9bdd1596c.tar.gz -https://github.com/houseroad/foxi/archive/8015abb72.tar.gz -> foxi-8015abb72.tar.gz -https://github.com/Maratyszcza/FP16/archive/4dfe081cf.tar.gz -> FP16-4dfe081cf.tar.gz -https://github.com/Maratyszcza/FXdiv/archive/b408327ac.tar.gz -> FXdiv-b408327ac.tar.gz -https://github.com/google/gemmlowp/archive/3fb5c176c.tar.gz -> gemmlowp-3fb5c176c.tar.gz -https://github.com/facebookincubator/gloo/archive/3d08580f9.tar.gz -> gloo-3d08580f9.tar.gz -https://github.com/google/googletest/archive/2fe3bd994.tar.gz -> googletest-2fe3bd994.tar.gz -https://github.com/intel/ideep/archive/938cc6889.tar.gz -> ideep-938cc6889.tar.gz -cuda? ( https://github.com/NVIDIA/nccl/archive/5949d96f3.tar.gz -> nccl-5949d96f3.tar.gz ) -https://github.com/Maratyszcza/NNPACK/archive/24b55303f.tar.gz -> NNPACK-24b55303f.tar.gz -https://github.com/onnx/onnx/archive/a82c6a701.tar.gz -> onnx-a82c6a701.tar.gz -https://github.com/onnx/onnx-tensorrt/archive/c15321141.tar.gz -> onnx-tensorrt-c15321141.tar.gz -https://github.com/Maratyszcza/psimd/archive/072586a71.tar.gz -> psimd-072586a71.tar.gz -https://github.com/Maratyszcza/pthreadpool/archive/029c88620.tar.gz -> pthreadpool-029c88620.tar.gz -https://github.com/Maratyszcza/PeachPy/archive/07d8fde8a.tar.gz -> PeachPy-07d8fde8a.tar.gz -https://github.com/pytorch/QNNPACK/archive/7d2a4e993.tar.gz -> QNNPACK-7d2a4e993.tar.gz -https://github.com/shibatch/sleef/archive/7f523de65.tar.gz -> sleef-7f523de65.tar.gz -https://github.com/pytorch/tensorpipe/archive/3b8089c9c.tar.gz -> tensorpipe-3b8089c9c.tar.gz -https://github.com/google/XNNPACK/archive/1b354636b.tar.gz -> XNNPACK-1b354636b.tar.gz -https://github.com/asmjit/asmjit/archive/9057aa30.tar.gz -> asmjit-9057aa30.tar.gz - " - -# git clone [email protected]:pytorch/pytorch.git && cd pytorch -# src_uri() { -# join \ -# <(git config --file .gitmodules --get-regexp url | sed -r -e 's/^submodule.(.*).url (.*)/\1 \2/' -e 's,NNPACK_deps/,,' -e 's/third-party/third_party/' | sort) \ -# <(git submodule status | awk '{print $2 " " $1}' | sort) | \ -# while read path url hash; do -# [[ ${path} =~ (eigen|six|ios|neon2sse|protobuf|pybind11|enum34|tbb|zstd|fbjni) ]] && continue -# u=${url%.git} -# h=${hash#-} -# h=${h:0:8} -# echo "${u}/archive/${h}.tar.gz -> $(basename ${u})-${h}.tar.gz" -# done -# } -# src_uri - -# git submodule update --init third_party/fbgemm && cd third_party/fbgemm -# src_uri | grep asmjit -# cd ../.. - -LICENSE="BSD" -SLOT="0" -KEYWORDS="~amd64" - -IUSE="asan atlas cuda eigen +fbgemm ffmpeg gflags glog +gloo leveldb lmdb mkl mkldnn mpi namedtensor +nnpack numa +numpy +observers +openblas opencl opencv +openmp +python +qnnpack redis static test tools zeromq" -RESTRICT="!test? ( test )" - -REQUIRED_USE=" - python? ( ${PYTHON_REQUIRED_USE} ) - numpy? ( python ) - ^^ ( atlas eigen mkl openblas ) -" - -RDEPEND=" - dev-libs/protobuf - dev-python/pyyaml[${PYTHON_USEDEP}] - atlas? ( sci-libs/atlas ) - cuda? ( dev-libs/cudnn - dev-cpp/eigen[cuda] ) - ffmpeg? ( media-video/ffmpeg ) - gflags? ( dev-cpp/gflags ) - glog? ( dev-cpp/glog ) - leveldb? ( dev-libs/leveldb ) - lmdb? ( dev-db/lmdb ) - mkl? ( sci-libs/mkl ) - mpi? ( virtual/mpi ) - numpy? ( dev-python/numpy[${PYTHON_USEDEP}] ) - openblas? ( sci-libs/openblas ) - opencl? ( dev-libs/clhpp virtual/opencl ) - opencv? ( media-libs/opencv ) - python? ( ${PYTHON_DEPS} - dev-python/pybind11[${PYTHON_USEDEP}] - ) - redis? ( dev-db/redis ) - zeromq? ( net-libs/zeromq ) - eigen? ( dev-cpp/eigen ) - dev-libs/libuv -" - -#ATen code generation -BDEPEND="dev-python/pyyaml" - -DEPEND="${RDEPEND} - test? ( dev-python/pytest[${PYTHON_USEDEP}] ) - dev-python/setuptools[${PYTHON_USEDEP}] - dev-cpp/tbb - app-arch/zstd - dev-python/protobuf-python[${PYTHON_USEDEP}] - dev-python/pybind11[${PYTHON_USEDEP}] - sys-fabric/libibverbs - sys-process/numactl -" - -PATCHES=( - "${FILESDIR}"/${PN}-1.6.0-setup.patch - "${FILESDIR}"/${PN}-1.6.0-skip-tests.patch - "${FILESDIR}"/${PN}-1.6.0-global-dlopen.patch - "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.4.0.patch - "${FILESDIR}"/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch - "${FILESDIR}"/0005-Change-library-directory-according-to-CMake-build.patch -) - -src_unpack() { - default - - [[ -d ${P} ]] || mv -v ${PN}-${MPV} ${P} || die -} - -src_prepare() { - cmake_src_prepare - eapply_user - - mv -v third_party/miniz-* ../ || die - rm -r third_party || die - ln -s .. third_party || die - cd .. || die - for d in *; do - case ${d} in - ${PN}* | miniz-*) continue ;; - PeachPy-*) mv -v ${d} python-peachpy || die ;; - *) mv -v ${d} ${d%-*} || die ;; - esac - done - - mv -v FBGEMM fbgemm || die - cd fbgemm || die - rm -r third_party || die - ln -s .. third_party || die - - cd ../onnx || die - rm -r third_party || die - ln -s .. third_party || die - - if use cuda; then - cd ../nccl || die - eapply "${FILESDIR}"/${PN}-1.6.0-nccl-nvccflags.patch - ln -s . nccl || die - - addpredict /dev/nvidiactl - cuda_src_prepare - export CUDAHOSTCXX=$(cuda_gccdir)/g++ - fi - - cd ../tensorpipe || die - eapply "${FILESDIR}"/${PN}-1.6.0-tensorpipe-unbundle-libuv.patch -} - -src_configure() { - local blas="Eigen" - - if use atlas; then - blas="ATLAS" - elif use mkl; then - blas="MKL" - elif use openblas; then - blas="OpenBLAS" - fi - - local mycmakeargs=( - -DTORCH_BUILD_VERSION=${PV} - -DTORCH_INSTALL_LIB_DIR=$(get_libdir) - -DBUILD_BINARY=$(usex tools ON OFF) - -DBUILD_CUSTOM_PROTOBUF=OFF - -DBUILD_PYTHON=$(usex python ON OFF) - -DBUILD_SHARED_LIBS=$(usex static OFF ON) - -DBUILD_TEST=$(usex test ON OFF) - -DUSE_ASAN=$(usex asan ON OFF) - -DUSE_CUDA=$(usex cuda ON OFF) - -DUSE_NCCL=$(usex cuda ON OFF) - -DUSE_SYSTEM_NCCL=OFF - -DUSE_ROCM=OFF - -DUSE_FBGEMM=$(usex fbgemm ON OFF) - -DUSE_FFMPEG=$(usex ffmpeg ON OFF) - -DUSE_GFLAGS=$(usex gflags ON OFF) - -DUSE_GLOG=$(usex glog ON OFF) - -DUSE_LEVELDB=$(usex leveldb ON OFF) - -DUSE_LITE_PROTO=OFF - -DUSE_LMDB=$(usex lmdb ON OFF) - -DCAFFE2_USE_MKL=$(usex mkl ON OFF) - -DUSE_MKLDNN=$(usex mkldnn ON OFF) - -DUSE_MKLDNN_CBLAS=OFF - -DUSE_NNPACK=$(usex nnpack ON OFF) - -DUSE_NUMPY=$(usex numpy ON OFF) - -DUSE_NUMA=$(usex numa ON OFF) - -DUSE_OBSERVERS=$(usex observers ON OFF) - -DUSE_OPENCL=$(usex opencl ON OFF) - -DUSE_OPENCV=$(usex opencv ON OFF) - -DUSE_OPENMP=$(usex openmp ON OFF) - -DUSE_TBB=OFF - -DUSE_PROF=OFF - -DUSE_QNNPACK=$(usex qnnpack ON OFF) - -DUSE_REDIS=$(usex redis ON OFF) - -DUSE_ROCKSDB=OFF - -DUSE_ZMQ=$(usex zeromq ON OFF) - -DUSE_MPI=$(usex mpi ON OFF) - -DUSE_GLOO=$(usex gloo ON OFF) - -DUSE_SYSTEM_EIGEN_INSTALL=ON - -DBUILD_NAMEDTENSOR=$(usex namedtensor ON OFF) - -DBLAS=${blas} - ) - - cmake_src_configure - - if use python; then - CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_configure - fi - - # do not rerun cmake and the build process in src_install - sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die -} - -src_compile() { - cmake_src_compile - - if use python; then - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_compile - fi -} - -src_install() { - cmake_src_install - - local LIB=$(get_libdir) - if [[ ${LIB} != lib ]]; then - mv -fv "${ED}"/usr/lib/*.so "${ED}"/usr/${LIB}/ || die - fi - - rm -rfv "${ED}/torch" - rm -rfv "${ED}/var" - rm -rfv "${ED}/usr/lib" - - rm -fv "${ED}/usr/include/*.{h,hpp}" - rm -rfv "${ED}/usr/include/asmjit" - rm -rfv "${ED}/usr/include/c10d" - rm -rfv "${ED}/usr/include/fbgemm" - rm -rfv "${ED}/usr/include/fp16" - rm -rfv "${ED}/usr/include/gloo" - rm -rfv "${ED}/usr/include/include" - rm -rfv "${ED}/usr/include/var" - - cp -rv "${WORKDIR}/${P}/third_party/pybind11/include/pybind11" "${ED}/usr/include/" - - rm -fv "${ED}/usr/lib64/libtbb.so" - rm -rfv "${ED}/usr/lib64/cmake" - - if use python; then - install_shm_manager() { - TORCH_BIN_DIR="${D}$(python_get_sitedir)/torch/bin" - - mkdir -pv ${TORCH_BIN_DIR} - cp -v "${ED}/usr/bin/torch_shm_manager" "${TORCH_BIN_DIR}" - } - - python_foreach_impl install_shm_manager - - scanelf -r --fix "${BUILD_DIR}/caffe2/python" - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_install - - python_foreach_impl python_optimize - fi - - find "${ED}/usr/${LIB}" -name "*.a" -exec rm -fv {} \; - - use test && rm -rfv "${ED}/usr/test" "${ED}"/usr/bin/test_{api,jit} - - # Remove the empty directories by CMake Python: - find "${ED}" -type d -empty -delete || die -} diff --git a/sci-libs/pytorch/pytorch-1.7.1-r2.ebuild b/sci-libs/pytorch/pytorch-1.7.1-r2.ebuild deleted file mode 100644 index 99cc2e750..000000000 --- a/sci-libs/pytorch/pytorch-1.7.1-r2.ebuild +++ /dev/null @@ -1,292 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{7,8,9} ) - -inherit cmake cuda distutils-r1 prefix - -DESCRIPTION="Tensors and Dynamic neural networks in Python with strong GPU acceleration" -HOMEPAGE="https://pytorch.org/" -SRC_URI="https://github.com/pytorch/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz -https://github.com/google/benchmark/archive/505be96a.tar.gz -> benchmark-505be96a.tar.gz -https://github.com/pytorch/cpuinfo/archive/63b25457.tar.gz -> cpuinfo-63b25457.tar.gz -https://github.com/NVlabs/cub/archive/d106ddb9.tar.gz -> cub-d106ddb9.tar.gz -https://github.com/pytorch/fbgemm/archive/1d710393.tar.gz -> fbgemm-1d710393.tar.gz -https://github.com/asmjit/asmjit/archive/9057aa30.tar.gz -> asmjit-9057aa30.tar.gz -https://github.com/pytorch/cpuinfo/archive/d5e37adf.tar.gz -> cpuinfo-d5e37adf.tar.gz -https://github.com/google/googletest/archive/0fc5466d.tar.gz -> googletest-0fc5466d.tar.gz -https://github.com/fmtlib/fmt/archive/cd4af11e.tar.gz -> fmt-cd4af11e.tar.gz -https://github.com/houseroad/foxi/archive/4aba696e.tar.gz -> foxi-4aba696e.tar.gz -https://github.com/Maratyszcza/FP16/archive/4dfe081c.tar.gz -> FP16-4dfe081c.tar.gz -https://github.com/Maratyszcza/FXdiv/archive/b408327a.tar.gz -> FXdiv-b408327a.tar.gz -https://github.com/google/gemmlowp/archive/3fb5c176.tar.gz -> gemmlowp-3fb5c176.tar.gz -https://github.com/facebookincubator/gloo/archive/3dc0328f.tar.gz -> gloo-3dc0328f.tar.gz -https://github.com/google/googletest/archive/2fe3bd99.tar.gz -> googletest-2fe3bd99.tar.gz -https://github.com/intel/ideep/archive/ba885200.tar.gz -> ideep-ba885200.tar.gz -https://github.com/intel/mkl-dnn/archive/5ef631a0.tar.gz -> mkl-dnn-5ef631a0.tar.gz -cuda? ( https://github.com/NVIDIA/nccl/archive/033d7995.tar.gz -> nccl-033d7995.tar.gz ) -https://github.com/Maratyszcza/NNPACK/archive/24b55303.tar.gz -> NNPACK-24b55303.tar.gz -https://github.com/onnx/onnx/archive/a82c6a70.tar.gz -> onnx-a82c6a70.tar.gz -https://github.com/onnx/onnx-tensorrt/archive/c1532114.tar.gz -> onnx-tensorrt-c1532114.tar.gz -https://github.com/onnx/onnx/archive/765f5ee8.tar.gz -> onnx-765f5ee8.tar.gz -https://github.com/google/benchmark/archive/e776aa02.tar.gz -> benchmark-e776aa02.tar.gz -https://github.com/google/benchmark/archive/5b7683f4.tar.gz -> benchmark-5b7683f4.tar.gz -https://github.com/google/googletest/archive/5ec7f0c4.tar.gz -> googletest-5ec7f0c4.tar.gz -https://github.com/Maratyszcza/psimd/archive/072586a7.tar.gz -> psimd-072586a7.tar.gz -https://github.com/Maratyszcza/pthreadpool/archive/029c8862.tar.gz -> pthreadpool-029c8862.tar.gz -https://github.com/Maratyszcza/PeachPy/archive/07d8fde8.tar.gz -> PeachPy-07d8fde8.tar.gz -https://github.com/pytorch/QNNPACK/archive/7d2a4e99.tar.gz -> QNNPACK-7d2a4e99.tar.gz -https://github.com/shibatch/sleef/archive/7f523de6.tar.gz -> sleef-7f523de6.tar.gz -https://github.com/pytorch/tensorpipe/archive/95ff9319.tar.gz -> tensorpipe-95ff9319.tar.gz -https://github.com/google/googletest/archive/2fe3bd99.tar.gz -> googletest-2fe3bd99.tar.gz -https://github.com/google/libnop/archive/aa95422e.tar.gz -> libnop-aa95422e.tar.gz -https://github.com/libuv/libuv/archive/02a9e1be.tar.gz -> libuv-02a9e1be.tar.gz -https://github.com/google/XNNPACK/archive/1b354636.tar.gz -> XNNPACK-1b354636.tar.gz - " - -# git clone [email protected]:pytorch/pytorch.git && cd pytorch -# git submodules update --init --recursive -# ${FILESDIR}/get_third_paries -# cat SRC_URI src_prepare - -LICENSE="BSD" -SLOT="0" -KEYWORDS="~amd64" - -IUSE="asan blas cuda +fbgemm ffmpeg gflags glog +gloo leveldb lmdb mkldnn mpi namedtensor +nnpack numa +observers opencl opencv +openmp +python +qnnpack redis rocm static test tools zeromq" -RESTRICT="!test? ( test )" -REQUIRED_USE=" - ?? ( cuda rocm ) -" - -RDEPEND=" - dev-python/pyyaml[${PYTHON_USEDEP}] - blas? ( virtual/blas ) - cuda? ( dev-libs/cudnn - dev-cpp/eigen[cuda] ) - rocm? ( >=dev-util/hip-4.0.0-r1 - >=dev-libs/rccl-4 - >=sci-libs/rocThrust-4 - >=sci-libs/hipCUB-4 - >=sci-libs/rocPRIM-4 - >=sci-libs/miopen-4 - >=sci-libs/rocBLAS-4 - >=sci-libs/rocRAND-4 - >=sci-libs/hipSPARSE-4 - >=sci-libs/rocFFT-4 - >=dev-util/roctracer-4 ) - ffmpeg? ( media-video/ffmpeg ) - gflags? ( dev-cpp/gflags ) - glog? ( dev-cpp/glog ) - leveldb? ( dev-libs/leveldb ) - lmdb? ( dev-db/lmdb ) - mpi? ( virtual/mpi ) - opencl? ( dev-libs/clhpp virtual/opencl ) - opencv? ( media-libs/opencv ) - python? ( ${PYTHON_DEPS} - dev-python/pybind11[${PYTHON_USEDEP}] - dev-python/numpy[${PYTHON_USEDEP}] - dev-python/protobuf-python:0/22 - ) - redis? ( dev-db/redis ) - zeromq? ( net-libs/zeromq ) - dev-cpp/eigen - dev-libs/protobuf:0/22 - dev-libs/libuv -" - -#ATen code generation -BDEPEND="dev-python/pyyaml" - -DEPEND="${RDEPEND} - test? ( dev-python/pytest[${PYTHON_USEDEP}] ) - dev-python/setuptools[${PYTHON_USEDEP}] - dev-cpp/tbb - app-arch/zstd - dev-python/pybind11[${PYTHON_USEDEP}] - sys-fabric/libibverbs - sys-process/numactl -" - -PATCHES=( - "${FILESDIR}"/${PN}-1.7.1-setup.patch - "${FILESDIR}"/${PN}-1.6.0-skip-tests.patch - "${FILESDIR}"/${PN}-1.6.0-global-dlopen.patch - "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch - "${FILESDIR}"/0003-Change-path-to-caffe2-build-dir-made-by-libtorch.patch - "${FILESDIR}"/0005-Change-library-directory-according-to-CMake-build.patch - "${FILESDIR}"/${PN}-1.7.1-no-rpath.patch - "${FILESDIR}"/${PN}-1.7.1-tensorpipe-unbundle-libuv.patch - "${FILESDIR}"/${PN}-1.7.1-torch_shm_manager.patch -) - -src_prepare() { - cmake_src_prepare - eprefixify torch/__init__.py - eapply_user - - rmdir third_party/benchmark && ln -sv "${WORKDIR}"/benchmark-505be96ab23056580a3a2315abba048f4428b04e third_party/benchmark - rmdir third_party/cpuinfo && ln -sv "${WORKDIR}"/cpuinfo-63b254577ed77a8004a9be6ac707f3dccc4e1fd9 third_party/cpuinfo - rmdir third_party/cub && ln -sv "${WORKDIR}"/cub-d106ddb991a56c3df1b6d51b2409e36ba8181ce4 third_party/cub - rmdir third_party/fbgemm && ln -sv "${WORKDIR}"/FBGEMM-1d710393d5b7588f5de3b83f51c22bbddf095229 third_party/fbgemm - rmdir third_party/fbgemm/third_party/asmjit && ln -sv "${WORKDIR}"/asmjit-9057aa30b620f0662ff51e2230c126a345063064 third_party/fbgemm/third_party/asmjit - rmdir third_party/fbgemm/third_party/cpuinfo && ln -sv "${WORKDIR}"/cpuinfo-d5e37adf1406cf899d7d9ec1d317c47506ccb970 third_party/fbgemm/third_party/cpuinfo - rmdir third_party/fbgemm/third_party/googletest && ln -sv "${WORKDIR}"/googletest-0fc5466dbb9e623029b1ada539717d10bd45e99e third_party/fbgemm/third_party/googletest - rmdir third_party/fmt && ln -sv "${WORKDIR}"/fmt-cd4af11efc9c622896a3e4cb599fa28668ca3d05 third_party/fmt - rmdir third_party/foxi && ln -sv "${WORKDIR}"/foxi-4aba696ec8f31794fd42880346dc586486205e0a third_party/foxi - rmdir third_party/FP16 && ln -sv "${WORKDIR}"/FP16-4dfe081cf6bcd15db339cf2680b9281b8451eeb3 third_party/FP16 - rmdir third_party/FXdiv && ln -sv "${WORKDIR}"/FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1 third_party/FXdiv - rmdir third_party/gemmlowp/gemmlowp && ln -sv "${WORKDIR}"/gemmlowp-3fb5c176c17c765a3492cd2f0321b0dab712f350 third_party/gemmlowp/gemmlowp - rmdir third_party/gloo && ln -sv "${WORKDIR}"/gloo-3dc0328fe6a9d47bd47c0c6ca145a0d8a21845c6 third_party/gloo - rmdir third_party/googletest && ln -sv "${WORKDIR}"/googletest-2fe3bd994b3189899d93f1d5a881e725e046fdc2 third_party/googletest - rmdir third_party/ideep && ln -sv "${WORKDIR}"/ideep-ba885200dbbc1f144c7b58eba487378eb324f281 third_party/ideep - rmdir third_party/ideep/mkl-dnn && ln -sv "${WORKDIR}"/mkl-dnn-5ef631a030a6f73131c77892041042805a06064f third_party/ideep/mkl-dnn - rmdir third_party/nccl/nccl && ln -sv "${WORKDIR}"/nccl-033d799524fb97629af5ac2f609de367472b2696 third_party/nccl/nccl - rmdir third_party/NNPACK && ln -sv "${WORKDIR}"/NNPACK-24b55303f5cf65d75844714513a0d1b1409809bd third_party/NNPACK - rmdir third_party/onnx && ln -sv "${WORKDIR}"/onnx-a82c6a7010e2e332d8f74ad5b0c726fd47c85376 third_party/onnx - rmdir third_party/onnx-tensorrt && ln -sv "${WORKDIR}"/onnx-tensorrt-c153211418a7c57ce071d9ce2a41f8d1c85a878f third_party/onnx-tensorrt - rmdir third_party/onnx-tensorrt/third_party/onnx && ln -sv "${WORKDIR}"/onnx-765f5ee823a67a866f4bd28a9860e81f3c811ce8 third_party/onnx-tensorrt/third_party/onnx - rmdir third_party/onnx-tensorrt/third_party/onnx/third_party/benchmark && ln -sv "${WORKDIR}"/benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508 third_party/onnx-tensorrt/third_party/onnx/third_party/benchmark - rmdir third_party/onnx/third_party/benchmark && ln -sv "${WORKDIR}"/benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508 third_party/onnx/third_party/benchmark - rmdir third_party/psimd && ln -sv "${WORKDIR}"/psimd-072586a71b55b7f8c584153d223e95687148a900 third_party/psimd - rmdir third_party/pthreadpool && ln -sv "${WORKDIR}"/pthreadpool-029c88620802e1361ccf41d1970bd5b07fd6b7bb third_party/pthreadpool - rmdir third_party/python-peachpy && ln -sv "${WORKDIR}"/PeachPy-07d8fde8ac45d7705129475c0f94ed8925b93473 third_party/python-peachpy - rmdir third_party/QNNPACK && ln -sv "${WORKDIR}"/QNNPACK-7d2a4e9931a82adc3814275b6219a03e24e36b4c third_party/QNNPACK - rmdir third_party/sleef && ln -sv "${WORKDIR}"/sleef-7f523de651585fe25cade462efccca647dcc8d02 third_party/sleef - rmdir third_party/tensorpipe && ln -sv "${WORKDIR}"/tensorpipe-95ff9319161fcdb3c674d2bb63fac3e94095b343 third_party/tensorpipe - rmdir third_party/tensorpipe/third_party/googletest && ln -sv "${WORKDIR}"/googletest-2fe3bd994b3189899d93f1d5a881e725e046fdc2 third_party/tensorpipe/third_party/googletest - rmdir third_party/tensorpipe/third_party/libnop && ln -sv "${WORKDIR}"/libnop-aa95422ea8c409e3f078d2ee7708a5f59a8b9fa2 third_party/tensorpipe/third_party/libnop - rmdir third_party/tensorpipe/third_party/libuv && ln -sv "${WORKDIR}"/libuv-02a9e1be252b623ee032a3137c0b0c94afbe6809 third_party/tensorpipe/third_party/libuv - rmdir third_party/XNNPACK && ln -sv "${WORKDIR}"/XNNPACK-1b354636b5942826547055252f3b359b54acff95 third_party/XNNPACK - - if use cuda; then - cd third_party/nccl/nccl || die - eapply "${FILESDIR}"/${PN}-1.6.0-nccl-nvccflags.patch - - addpredict /dev/nvidiactl - cuda_src_prepare - export CUDAHOSTCXX=$(cuda_gccdir)/g++ - fi - - if use rocm; then - #Allow escaping sandbox - addread /dev/kfd - addread /dev/dri - addwrite /dev/kfd - addwrite /dev/dri - - ebegin "HIPifying cuda sources" - tools/amd_build/build_amd.py - eend $? - - export PYTORCH_ROCM_ARCH=$(rocminfo | egrep -o "gfx[0-9]+" | uniq | awk -vORS=';' "{print $1}" | sed 's/;$/\n/') || die - sed -e "/set(roctracer_INCLUDE_DIRS/s,\${ROCTRACER_PATH}/include,${EPREFIX}/usr/include/roctracer," \ - -i cmake/public/LoadHIP.cmake || die - fi -} - -src_configure() { - local mycmakeargs=( - -DTORCH_BUILD_VERSION=${PV} - -DTORCH_INSTALL_LIB_DIR=$(get_libdir) - -DBUILD_BINARY=$(usex tools ON OFF) - -DBUILD_CUSTOM_PROTOBUF=OFF - -DBUILD_PYTHON=$(usex python ON OFF) - -DBUILD_SHARED_LIBS=$(usex static OFF ON) - -DBUILD_TEST=$(usex test ON OFF) - -DUSE_ASAN=$(usex asan ON OFF) - -DUSE_CUDA=$(usex cuda ON OFF) - -DUSE_NCCL=$(usex cuda ON OFF) - -DUSE_SYSTEM_NCCL=OFF - -DUSE_ROCM=$(usex rocm ON OFF) - -DUSE_FBGEMM=$(usex fbgemm ON OFF) - -DUSE_FFMPEG=$(usex ffmpeg ON OFF) - -DUSE_GFLAGS=$(usex gflags ON OFF) - -DUSE_GLOG=$(usex glog ON OFF) - -DUSE_LEVELDB=$(usex leveldb ON OFF) - -DUSE_LITE_PROTO=OFF - -DUSE_LMDB=$(usex lmdb ON OFF) - -DUSE_MKLDNN=$(usex mkldnn ON OFF) - -DUSE_MKLDNN_CBLAS=OFF - -DUSE_NNPACK=$(usex nnpack ON OFF) - -DUSE_NUMPY=$(usex python ON OFF) - -DUSE_NUMA=$(usex numa ON OFF) - -DUSE_OBSERVERS=$(usex observers ON OFF) - -DUSE_OPENCL=$(usex opencl ON OFF) - -DUSE_OPENCV=$(usex opencv ON OFF) - -DUSE_OPENMP=$(usex openmp ON OFF) - -DUSE_TBB=OFF - -DUSE_PROF=OFF - -DUSE_QNNPACK=$(usex qnnpack ON OFF) - -DUSE_REDIS=$(usex redis ON OFF) - -DUSE_ROCKSDB=OFF - -DUSE_ZMQ=$(usex zeromq ON OFF) - -DUSE_MPI=$(usex mpi ON OFF) - -DUSE_GLOO=$(usex gloo ON OFF) - -DUSE_SYSTEM_EIGEN_INSTALL=ON - -DBUILD_NAMEDTENSOR=$(usex namedtensor ON OFF) - -DBLAS=$(usex blas Generic Eigen) - -DTP_BUILD_LIBUV=OFF - -Wno-dev - ) - - cmake_src_configure - - if use python; then - CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_configure - fi - - # do not rerun cmake and the build process in src_install - sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die -} - -src_compile() { - cmake_src_compile - - if use python; then - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_compile - fi -} - -src_install() { - cmake_src_install - - local LIB=$(get_libdir) - if [[ ${LIB} != lib ]]; then - mv -fv "${ED}"/usr/lib/*.so "${ED}"/usr/${LIB}/ || die - fi - - rm -rfv "${ED}/torch" - rm -rfv "${ED}/var" - rm -rfv "${ED}/usr/lib" - - rm -fv "${ED}/usr/include/*.{h,hpp}" - rm -rfv "${ED}/usr/include/asmjit" - rm -rfv "${ED}/usr/include/c10d" - rm -rfv "${ED}/usr/include/fbgemm" - rm -rfv "${ED}/usr/include/fp16" - rm -rfv "${ED}/usr/include/gloo" - rm -rfv "${ED}/usr/include/include" - rm -rfv "${ED}/usr/include/var" - - cp -rv "${WORKDIR}/${P}/third_party/pybind11/include/pybind11" "${ED}/usr/include/" - - rm -fv "${ED}/usr/${LIB}/libtbb.so" - rm -rfv "${ED}/usr/${LIB}/cmake" - - if use python; then - scanelf -r --fix "${BUILD_DIR}/caffe2/python" - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_install - - python_foreach_impl python_optimize - fi - - find "${ED}/usr/${LIB}" -name "*.a" -exec rm -fv {} \; - - use test && rm -rfv "${ED}/usr/test" "${ED}"/usr/bin/test_{api,jit} - - # Remove the empty directories by CMake Python: - find "${ED}" -type d -empty -delete || die -} diff --git a/sci-libs/pytorch/pytorch-1.9.0.ebuild b/sci-libs/pytorch/pytorch-1.9.0.ebuild deleted file mode 100644 index c997f8da8..000000000 --- a/sci-libs/pytorch/pytorch-1.9.0.ebuild +++ /dev/null @@ -1,321 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{7,8,9} ) - -inherit cmake cuda distutils-r1 prefix - -DESCRIPTION="Tensors and Dynamic neural networks in Python with strong GPU acceleration" -HOMEPAGE="https://pytorch.org/" -SRC_URI="https://github.com/pytorch/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz -https://github.com/google/benchmark/archive/e991355c02b93fe17713efe04cbc2e278e00fdbd.tar.gz -> benchmark-e991355c02b93fe17713efe04cbc2e278e00fdbd.tar.gz -https://github.com/pytorch/cpuinfo/archive/63b25457.tar.gz -> cpuinfo-63b25457.tar.gz -https://github.com/NVlabs/cub/archive/d106ddb991a56c3df1b6d51b2409e36ba8181ce4.tar.gz -> cub-d106ddb991a56c3df1b6d51b2409e36ba8181ce4.tar.gz -https://github.com/pytorch/fbgemm/archive/7495417ad31c38a06b1b13db66b355b6f23cd96d.tar.gz -> fbgemm-7495417ad31c38a06b1b13db66b355b6f23cd96d.tar.gz -https://github.com/asmjit/asmjit/archive/9057aa30.tar.gz -> asmjit-9057aa30.tar.gz -https://github.com/pytorch/cpuinfo/archive/5916273f79a21551890fd3d56fc5375a78d1598d.tar.gz -> cpuinfo-5916273f79a21551890fd3d56fc5375a78d1598d.tar.gz -https://github.com/google/googletest/archive/0fc5466d.tar.gz -> googletest-0fc5466d.tar.gz -https://github.com/fmtlib/fmt/archive/cd4af11efc9c622896a3e4cb599fa28668ca3d05.tar.gz -> fmt-cd4af11efc9c622896a3e4cb599fa28668ca3d05.tar.gz -https://github.com/houseroad/foxi/archive/c278588e34e535f0bb8f00df3880d26928038cad.tar.gz -> foxi-c278588e34e535f0bb8f00df3880d26928038cad.tar.gz -https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.tar.gz -> FP16-4dfe081cf6bcd15db339cf2680b9281b8451eeb3.tar.gz -https://github.com/Maratyszcza/FXdiv/archive/b408327ac2a15ec3e43352421954f5b1967701d1.tar.gz -> FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1.tar.gz -https://github.com/google/gemmlowp/archive/3fb5c176.tar.gz -> gemmlowp-3fb5c176.tar.gz -https://github.com/facebookincubator/gloo/archive/c22a5cfba94edf8ea4f53a174d38aa0c629d070f.tar.gz -> gloo-c22a5cfba94edf8ea4f53a174d38aa0c629d070f.tar.gz -https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.tar.gz -> googletest-e2239ee6043f73722e7aa812a459f54a28552929.tar.gz -https://github.com/intel/ideep/archive/9ca27bbfd88fa1469cbf0467bd6f14cd1738fa40.tar.gz -> ideep-9ca27bbfd88fa1469cbf0467bd6f14cd1738fa40.tar.gz -https://github.com/intel/mkl-dnn/archive/5ef631a0.tar.gz -> mkl-dnn-5ef631a0.tar.gz -cuda? ( https://github.com/NVIDIA/nccl/archive/033d7995.tar.gz -> nccl-033d7995.tar.gz ) -https://github.com/Maratyszcza/NNPACK/archive/c07e3a0400713d546e0dea2d5466dd22ea389c73.tar.gz -> NNPACK-c07e3a0400713d546e0dea2d5466dd22ea389c73.tar.gz -https://github.com/onnx/onnx/archive/a82c6a70.tar.gz -> onnx-a82c6a70.tar.gz -https://github.com/onnx/onnx-tensorrt/archive/c153211418a7c57ce071d9ce2a41f8d1c85a878f.tar.gz -> onnx-tensorrt-c153211418a7c57ce071d9ce2a41f8d1c85a878f.tar.gz -https://github.com/onnx/onnx/archive/29e7aa7048809784465d06e897f043a4600642b2.tar.gz -> onnx-29e7aa7048809784465d06e897f043a4600642b2.tar.gz -https://github.com/google/benchmark/archive/e776aa02.tar.gz -> benchmark-e776aa02.tar.gz -https://github.com/google/benchmark/archive/5b7683f4.tar.gz -> benchmark-5b7683f4.tar.gz -https://github.com/google/googletest/archive/5ec7f0c4.tar.gz -> googletest-5ec7f0c4.tar.gz -https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a90.tar.gz -> psimd-072586a71b55b7f8c584153d223e95687148a90.tar.gz -https://github.com/Maratyszcza/pthreadpool/archive/a134dd5d4cee80cce15db81a72e7f929d71dd413.tar.gz -> pthreadpool-a134dd5d4cee80cce15db81a72e7f929d71dd413.tar.gz -https://github.com/Maratyszcza/PeachPy/archive/07d8fde8ac45d7705129475c0f94ed8925b93473.tar.gz -> PeachPy-07d8fde8ac45d7705129475c0f94ed8925b93473.tar.gz -https://github.com/pytorch/QNNPACK/archive/7d2a4e9931a82adc3814275b6219a03e24e36b4c.tar.gz -> QNNPACK-7d2a4e9931a82adc3814275b6219a03e24e36b4c.tar.gz -https://github.com/shibatch/sleef/archive/e0a003ee838b75d11763aa9c3ef17bf71a725bff.tar.gz -> sleef-e0a003ee838b75d11763aa9c3ef17bf71a725bff.tar.gz -https://github.com/pytorch/tensorpipe/archive/c0e7623adb05f36311c7cde6dac8fc4c290419d9.tar.gz -> tensorpipe-c0e7623adb05f36311c7cde6dac8fc4c290419d9.tar.gz -https://github.com/google/googletest/archive/2fe3bd99.tar.gz -> googletest-2fe3bd99.tar.gz -https://github.com/google/libnop/archive/aa95422e.tar.gz -> libnop-aa95422e.tar.gz -https://github.com/libuv/libuv/archive/02a9e1be.tar.gz -> libuv-02a9e1be.tar.gz -https://github.com/google/XNNPACK/archive/79cd5f9e18ad0925ac9a050b00ea5a36230072db.tar.gz -> XNNPACK-79cd5f9e18ad0925ac9a050b00ea5a36230072db.tar.gz -https://github.com/pytorch/kineto/archive/dbfa0ead96612f7ca265c63a35fdf0488395179b.tar.gz -> kineto-dbfa0ead96612f7ca265c63a35fdf0488395179b.tar.gz -" - -# git clone [email protected]:pytorch/pytorch.git && cd pytorch -# git submodules update --init --recursive -# ${FILESDIR}/get_third_paries -# cat SRC_URI src_prepare - -LICENSE="BSD" -SLOT="0" -KEYWORDS="" - -IUSE="asan blas cuda +fbgemm ffmpeg gflags glog +gloo leveldb lmdb mkldnn mpi namedtensor +nnpack numa +observers opencl opencv +openmp +python +qnnpack redis rocm static test tools zeromq" -RESTRICT="!test? ( test )" -REQUIRED_USE=" - ?? ( cuda rocm ) -" - -RDEPEND=" - dev-python/pyyaml[${PYTHON_USEDEP}] - blas? ( virtual/blas ) - cuda? ( dev-libs/cudnn - dev-cpp/eigen[cuda] ) - rocm? ( >=dev-util/hip-4.0.0-r1 - >=dev-libs/rccl-4 - >=sci-libs/rocThrust-4 - >=sci-libs/hipCUB-4 - >=sci-libs/rocPRIM-4 - >=sci-libs/miopen-4 - >=sci-libs/rocBLAS-4 - >=sci-libs/rocRAND-4 - >=sci-libs/hipSPARSE-4 - >=sci-libs/rocFFT-4 - >=dev-util/roctracer-4 ) - ffmpeg? ( media-video/ffmpeg ) - gflags? ( dev-cpp/gflags ) - glog? ( dev-cpp/glog ) - leveldb? ( dev-libs/leveldb ) - lmdb? ( dev-db/lmdb ) - mpi? ( virtual/mpi ) - opencl? ( dev-libs/clhpp virtual/opencl ) - opencv? ( media-libs/opencv ) - python? ( ${PYTHON_DEPS} - dev-python/pybind11[${PYTHON_USEDEP}] - dev-python/numpy[${PYTHON_USEDEP}] - dev-python/protobuf-python:0/22 - ) - redis? ( dev-db/redis ) - zeromq? ( net-libs/zeromq ) - dev-cpp/eigen - dev-libs/protobuf:0/22 - dev-libs/libuv -" - -#ATen code generation -BDEPEND="dev-python/pyyaml" - -DEPEND="${RDEPEND} - test? ( dev-python/pytest[${PYTHON_USEDEP}] ) - dev-cpp/tbb - app-arch/zstd - dev-python/pybind11[${PYTHON_USEDEP}] - dev-python/typing-extensions[${PYTHON_USEDEP}] - sys-fabric/libibverbs - sys-process/numactl -" - -PATCHES=( - "${FILESDIR}"/${PN}-1.6.0-skip-tests.patch - "${FILESDIR}"/${PN}-1.6.0-global-dlopen.patch - "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch - "${FILESDIR}"/${PN}-1.7.1-no-rpath.patch - "${FILESDIR}"/${PN}-1.7.1-torch_shm_manager.patch -) - -src_prepare() { - cmake_src_prepare - eprefixify torch/__init__.py - - rmdir third_party/benchmark || die - ln -sv "${WORKDIR}"/benchmark-e991355c02b93fe17713efe04cbc2e278e00fdbd third_party/benchmark || die - rmdir third_party/cpuinfo || die - ln -sv "${WORKDIR}"/cpuinfo-5916273f79a21551890fd3d56fc5375a78d1598d third_party/cpuinfo || die - rmdir third_party/cub || die - ln -sv "${WORKDIR}"/cub-d106ddb991a56c3df1b6d51b2409e36ba8181ce4 third_party/cub || die - rmdir third_party/fbgemm || die - ln -sv "${WORKDIR}"/FBGEMM-7495417ad31c38a06b1b13db66b355b6f23cd96d third_party/fbgemm || die - rmdir third_party/fbgemm/third_party/asmjit || die - ln -sv "${WORKDIR}"/asmjit-9057aa30b620f0662ff51e2230c126a345063064 third_party/fbgemm/third_party/asmjit || die - rmdir third_party/fbgemm/third_party/cpuinfo || die - ln -sv "${WORKDIR}"/cpuinfo-d5e37adf1406cf899d7d9ec1d317c47506ccb970 third_party/fbgemm/third_party/cpuinfo || die - rmdir third_party/fbgemm/third_party/googletest || die - ln -sv "${WORKDIR}"/googletest-0fc5466dbb9e623029b1ada539717d10bd45e99e third_party/fbgemm/third_party/googletest || die - rmdir third_party/fmt || die - ln -sv "${WORKDIR}"/fmt-cd4af11efc9c622896a3e4cb599fa28668ca3d05 third_party/fmt || die - rmdir third_party/foxi || die - ln -sv "${WORKDIR}"/foxi-c278588e34e535f0bb8f00df3880d26928038cad third_party/foxi || die - rmdir third_party/FP16 || die - ln -sv "${WORKDIR}"/FP16-4dfe081cf6bcd15db339cf2680b9281b8451eeb3 third_party/FP16 || die - rmdir third_party/FXdiv - ln -sv "${WORKDIR}"/FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1 third_party/FXdiv || die - rmdir third_party/gemmlowp/gemmlowp || die - ln -sv "${WORKDIR}"/gemmlowp-3fb5c176c17c765a3492cd2f0321b0dab712f350 third_party/gemmlowp/gemmlowp || die - rmdir third_party/gloo || die - ln -sv "${WORKDIR}"/gloo-c22a5cfba94edf8ea4f53a174d38aa0c629d070f third_party/gloo || die - rmdir third_party/googletest || die - ln -sv "${WORKDIR}"/googletest-e2239ee6043f73722e7aa812a459f54a28552929 third_party/googletest || die - rmdir third_party/ideep || die - ln -sv "${WORKDIR}"/ideep-9ca27bbfd88fa1469cbf0467bd6f14cd1738fa40 third_party/ideep || die - rmdir third_party/ideep/mkl-dnn || die - ln -sv "${WORKDIR}"/mkl-dnn-5ef631a030a6f73131c77892041042805a06064f third_party/ideep/mkl-dnn || die - rmdir third_party/nccl/nccl || die - ln -sv "${WORKDIR}"/nccl-033d799524fb97629af5ac2f609de367472b2696 third_party/nccl/nccl || die - rmdir third_party/NNPACK || die - ln -sv "${WORKDIR}"/NNPACK-c07e3a0400713d546e0dea2d5466dd22ea389c73 third_party/NNPACK || die - rmdir third_party/onnx || die - ln -sv "${WORKDIR}"/onnx-29e7aa7048809784465d06e897f043a4600642b2 third_party/onnx || die - rmdir third_party/onnx-tensorrt || die - ln -sv "${WORKDIR}"/onnx-tensorrt-c153211418a7c57ce071d9ce2a41f8d1c85a878f third_party/onnx-tensorrt || die - rmdir third_party/onnx-tensorrt/third_party/onnx || die - ln -sv "${WORKDIR}"/onnx-765f5ee823a67a866f4bd28a9860e81f3c811ce8 third_party/onnx-tensorrt/third_party/onnx || die - rmdir third_party/onnx/third_party/benchmark || die - ln -sv "${WORKDIR}"/benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508 third_party/onnx/third_party/benchmark || die - rmdir third_party/psimd || die - ln -sv "${WORKDIR}"/psimd-072586a71b55b7f8c584153d223e95687148a900 third_party/psimd || die - rmdir third_party/pthreadpool || die - ln -sv "${WORKDIR}"/pthreadpool-a134dd5d4cee80cce15db81a72e7f929d71dd413 third_party/pthreadpool || die - rmdir third_party/python-peachpy || die - ln -sv "${WORKDIR}"/PeachPy-07d8fde8ac45d7705129475c0f94ed8925b93473 third_party/python-peachpy || die - rmdir third_party/QNNPACK || die - ln -sv "${WORKDIR}"/QNNPACK-7d2a4e9931a82adc3814275b6219a03e24e36b4c third_party/QNNPACK || die - rmdir third_party/sleef || die - ln -sv "${WORKDIR}"/sleef-e0a003ee838b75d11763aa9c3ef17bf71a725bff third_party/sleef || die - rmdir third_party/tensorpipe || die - ln -sv "${WORKDIR}"/tensorpipe-c0e7623adb05f36311c7cde6dac8fc4c290419d9 third_party/tensorpipe || die - rmdir third_party/tensorpipe/third_party/googletest || die - ln -sv "${WORKDIR}"/googletest-2fe3bd994b3189899d93f1d5a881e725e046fdc2 third_party/tensorpipe/third_party/googletest || die - rmdir third_party/tensorpipe/third_party/libnop || die - ln -sv "${WORKDIR}"/libnop-aa95422ea8c409e3f078d2ee7708a5f59a8b9fa2 third_party/tensorpipe/third_party/libnop || die - rmdir third_party/tensorpipe/third_party/libuv || die - ln -sv "${WORKDIR}"/libuv-02a9e1be252b623ee032a3137c0b0c94afbe6809 third_party/tensorpipe/third_party/libuv || die - rmdir third_party/XNNPACK || die - ln -sv "${WORKDIR}"/XNNPACK-79cd5f9e18ad0925ac9a050b00ea5a36230072db third_party/XNNPACK || die - rmdir third_party/kineto || die - ln -sv "${WORKDIR}"/kineto-dbfa0ead96612f7ca265c63a35fdf0488395179b third_party/kineto || die - - if use cuda; then - cd third_party/nccl/nccl || die - eapply "${FILESDIR}"/${PN}-1.6.0-nccl-nvccflags.patch - -# addpredict /dev/nvidiactl - cuda_src_prepare - export CUDAHOSTCXX=$(cuda_gccdir)/g++ - fi - - if use rocm; then - #Allow escaping sandbox - addread /dev/kfd - addread /dev/dri - addwrite /dev/kfd - addwrite /dev/dri - - ebegin "HIPifying cuda sources" - tools/amd_build/build_amd.py - eend $? - - export PYTORCH_ROCM_ARCH=$(rocminfo | egrep -o "gfx[0-9]+" | uniq | awk -vORS=';' "{print $1}" | sed 's/;$/\n/') || die - sed -e "/set(roctracer_INCLUDE_DIRS/s,\${ROCTRACER_PATH}/include,${EPREFIX}/usr/include/roctracer," \ - -i cmake/public/LoadHIP.cmake || die - fi -} - -src_configure() { - local mycmakeargs=( - -DTORCH_BUILD_VERSION=${PV} - -DTORCH_INSTALL_LIB_DIR=$(get_libdir) - -DBUILD_BINARY=$(usex tools ON OFF) - -DBUILD_CUSTOM_PROTOBUF=OFF - -DBUILD_PYTHON=$(usex python ON OFF) - -DBUILD_SHARED_LIBS=$(usex static OFF ON) - -DBUILD_TEST=$(usex test ON OFF) - -DUSE_ASAN=$(usex asan ON OFF) - -DUSE_CUDA=$(usex cuda ON OFF) - -DUSE_NCCL=$(usex cuda ON OFF) - -DUSE_SYSTEM_NCCL=OFF - -DUSE_ROCM=$(usex rocm ON OFF) - -DUSE_FBGEMM=$(usex fbgemm ON OFF) - -DUSE_FFMPEG=$(usex ffmpeg ON OFF) - -DUSE_GFLAGS=$(usex gflags ON OFF) - -DUSE_GLOG=$(usex glog ON OFF) - -DUSE_LEVELDB=$(usex leveldb ON OFF) - -DUSE_LITE_PROTO=OFF - -DUSE_LMDB=$(usex lmdb ON OFF) - -DUSE_MKLDNN=$(usex mkldnn ON OFF) - -DUSE_MKLDNN_CBLAS=OFF - -DUSE_NNPACK=$(usex nnpack ON OFF) - -DUSE_NUMPY=$(usex python ON OFF) - -DUSE_NUMA=$(usex numa ON OFF) - -DUSE_OBSERVERS=$(usex observers ON OFF) - -DUSE_OPENCL=$(usex opencl ON OFF) - -DUSE_OPENCV=$(usex opencv ON OFF) - -DUSE_OPENMP=$(usex openmp ON OFF) - -DUSE_TBB=OFF - -DUSE_PROF=OFF - -DUSE_QNNPACK=$(usex qnnpack ON OFF) - -DUSE_REDIS=$(usex redis ON OFF) - -DUSE_ROCKSDB=OFF - -DUSE_ZMQ=$(usex zeromq ON OFF) - -DUSE_MPI=$(usex mpi ON OFF) - -DUSE_GLOO=$(usex gloo ON OFF) - -DUSE_SYSTEM_EIGEN_INSTALL=ON - -DBUILD_NAMEDTENSOR=$(usex namedtensor ON OFF) - -DBLAS=$(usex blas Generic Eigen) - -DTP_BUILD_LIBUV=OFF - -Wno-dev - ) - - cmake_src_configure - - if use python; then - CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_configure - fi - - # do not rerun cmake and the build process in src_install - sed '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die -} - -src_compile() { - cmake_src_compile - - if use python; then - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_compile - fi -} - -src_install() { - cmake_src_install - - local LIB=$(get_libdir) - if [[ ${LIB} != lib ]]; then - mv -fv "${ED}"/usr/lib/*.so "${ED}"/usr/${LIB}/ || die - fi - - rm -rfv "${ED}/torch" - rm -rfv "${ED}/var" - rm -rfv "${ED}/usr/lib" - - rm -fv "${ED}/usr/include/*.{h,hpp}" - rm -rfv "${ED}/usr/include/asmjit" - rm -rfv "${ED}/usr/include/c10d" - rm -rfv "${ED}/usr/include/fbgemm" - rm -rfv "${ED}/usr/include/fp16" - rm -rfv "${ED}/usr/include/gloo" - rm -rfv "${ED}/usr/include/include" - rm -rfv "${ED}/usr/include/var" - - cp -rv "${WORKDIR}/${P}/third_party/pybind11/include/pybind11" "${ED}/usr/include/" - - rm -fv "${ED}/usr/${LIB}/libtbb.so" - rm -rfv "${ED}/usr/${LIB}/cmake" - - if use python; then - scanelf -r --fix "${BUILD_DIR}/caffe2/python" - CMAKE_BUILD_DIR=${BUILD_DIR} distutils-r1_src_install - - python_foreach_impl python_optimize - fi - - find "${ED}/usr/${LIB}" -name "*.a" -exec rm -fv {} \; - - use test && rm -rfv "${ED}/usr/test" "${ED}"/usr/bin/test_{api,jit} - - # Remove the empty directories by CMake Python: - find "${ED}" -type d -empty -delete || die -}
