diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-11-15 03:02:36 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-11-15 03:02:36 +0000 |
commit | 57d1fe5ae0c56e604db5d29bf7b62d685c42e043 (patch) | |
tree | bc1bdf3c531b7b4cef73b051dbb3cd439dee4a39 /sci-libs | |
parent | d3c7d3e5f9607edef1a795ccc502ab3eb3121165 (diff) |
gentoo auto-resync : 15:11:2024 - 03:02:36
Diffstat (limited to 'sci-libs')
-rw-r--r-- | sci-libs/Manifest.gz | bin | 43143 -> 43138 bytes | |||
-rw-r--r-- | sci-libs/caffe2/Manifest | 10 | ||||
-rw-r--r-- | sci-libs/caffe2/caffe2-2.5.1-r1.ebuild | 321 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-cudnn_include_fix.patch | 11 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-exclude-aotriton.patch | 22 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-fix-functorch-install.patch | 8 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-gentoo.patch | 127 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-glog-0.6.0.patch | 29 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-install-dirs.patch | 11 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-unbundle_fmt.patch | 10 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.5.1-unbundle_kineto.patch | 22 | ||||
-rw-r--r-- | sci-libs/pytorch/Manifest | 5 | ||||
-rw-r--r-- | sci-libs/pytorch/files/pytorch-2.5.1-dontbuildagain.patch | 17 | ||||
-rw-r--r-- | sci-libs/pytorch/files/pytorch-2.5.1-setup.patch | 10 | ||||
-rw-r--r-- | sci-libs/pytorch/files/pytorch-2.5.1-torch_shm_manager.patch | 11 | ||||
-rw-r--r-- | sci-libs/pytorch/pytorch-2.5.1.ebuild | 62 |
16 files changed, 676 insertions, 0 deletions
diff --git a/sci-libs/Manifest.gz b/sci-libs/Manifest.gz Binary files differindex 6701e310efd9..db9ccca28e10 100644 --- a/sci-libs/Manifest.gz +++ b/sci-libs/Manifest.gz diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest index 083a9c2432fd..a9c94f5d4f83 100644 --- a/sci-libs/caffe2/Manifest +++ b/sci-libs/caffe2/Manifest @@ -1,9 +1,19 @@ AUX caffe2-2.4.0-cpp-httplib.patch 414 BLAKE2B fabe646c86f4c6736600fa44733ab6ea246a7a007a01b1a558a42b32f42ccd9ce63a14ac5a949a07258c8ba06d464ea5bd1de3ab1fe265792e527365f9dbb546 SHA512 c206df54f285bbd7fe5a216f906e6c545e145a21322bd817bf5cee1190d7c3381f626991889cac8b8f586f277e80bf26f393abd01a0e3b5ded97f8c355c46bac AUX caffe2-2.4.0-cstdint.patch 263 BLAKE2B 52705466cc1f170f7c6f6ef2474fd92b294e8a07e6ab640804efa38e7e0526a72e7ff51c3b214662cc586eac7118b768b1a40df62a133834d617d5c8f7a712db SHA512 22f3c024ca11fe4483263956825f8190245c61eb6f200d1466a734a927729a0e3bc244d77050c85403b469ea647046941b5ba42e59c4f6410f8c8fa192de4268 AUX caffe2-2.4.0-libfmt-11.patch 1560 BLAKE2B 816201b6abc3ad4c4924c649905068306f3a0c674eab36fb6a6772b84d2bf0806dd55d586d6873952b0eac56afae00513966071a380b9e60eff3c668e6aec737 SHA512 acdc879f2ed8ae546a6ce4db1b63faba3b6672374c61940d58e0c2b747c4b0d8d38fb34a2e66f3805f9f328fd4e0115dd705b541871b2fd99a2782756ca583e5 +AUX caffe2-2.5.1-cudnn_include_fix.patch 587 BLAKE2B 8ffeb9080ee77b953e7a77c9bea9af8c078adf147c314e07cf40d6f9ce1c988ac201e282ffd67a29703ced5885329d44be013c54cf3ba870c009aed40e65fefc SHA512 b37427e35d8147e603331eb344a3542ed31d0b133df3c7ce10ebecec93b1d09d040f77c33f23f70e9835db10fa209c0318b89b70b3b91263655d160ed737d6f3 +AUX caffe2-2.5.1-exclude-aotriton.patch 1107 BLAKE2B d1e0289c6e937b9f6611b1ffd5eb8398594839f8c7edd8be99be4b29d33b0466dbf9cc16c6eaaf6d71e3defd217651516272d7791a318c0afd7c15b162a4b5e9 SHA512 24079cc24361d07170276ea7e9771ec8e00ab849d42344a33d1eb3885bc963b21a9a5bc0f56a5a22b3896253010f0d6c14aa4dbeff3f9adb4bd3d20769eafb81 +AUX caffe2-2.5.1-fix-functorch-install.patch 448 BLAKE2B f8b0ebfe0cdb8318bc376d8afb2ece66ac6ef23e7f57f9f0371aa99c55fd6663f34392c5c696333144e6523f5ceada4fe4978b0db68db5e8ab5d761e42cbdfe9 SHA512 3cc38769df9f5d96b108c0235bd7a5346f591bd826d8156fb0bdf3735e147fa541f7df4baeb72af6f3509cf3bcbd640889c6f4ed2c98c5be12e28c3a88042287 +AUX caffe2-2.5.1-gentoo.patch 5181 BLAKE2B 146e49ea90dbdd3bfb12a8f1b135b9ac8ed849c408a81081a5308c8dd761e1b3a8e714b905c2b88a785f436123347899b7a72eccacc2fbc54d9efad2d1dc3550 SHA512 885e79edc67d7eff1e895bdd3589704220714b6024635444dac1452e41a947c2b2a4a33866acbfc19af66d42f340038395aeb53d1477294712578e4bdbe06673 +AUX caffe2-2.5.1-glog-0.6.0.patch 959 BLAKE2B eb0c18a34a2c5a1b68a420b9001eac5c8ff65ef9ca9ea1e5ad93ecef3cbaa595808105bbf6c8d3dcb9047559d23bc0398cda5922fb41e29a7588644c90c90fd8 SHA512 5873f11930ae5947c7dfbb19d0377d5535e395fcc1ab213e3c65c77b2e3bd911efc11cde2ca3e7134e9e7798ca7a483910113f331c0a23b73a5546aaaded40c5 +AUX caffe2-2.5.1-install-dirs.patch 542 BLAKE2B 7a96287f826a44c7a1eee3f44516c5e4e3011a5ddf864aeb7c4ae9a363d89d393fec4c2c86677c2cd3cc38c345323eba3d6b4c9d6686ee13e16a1c4acbdc1f18 SHA512 79de43b4bdcf1cb609bf953f3d698a38231a76f299296b1cc131639f6b0e1d29f634ac9c6858d52742e988c94d39cb5a3daa1bf36d6dc1bf6a1354ca055e5edf +AUX caffe2-2.5.1-unbundle_fmt.patch 499 BLAKE2B 06550f8e7ae3a932a585f8abe7653ac0b574d9ce1160c190a39f96b7d76e3a9e7a4e62b9e5e967e5884d0e38668f60af7737ea3c715d718deb7a634de98ccebd SHA512 afcb5f1123cbe5eeebdb2c5e312e37956dbc33a926cf379f531896f2c75fbb4b4dfa2c9d276a98bbad51bc587886bb572c3221be06e5116443c8ab44e1d12da5 +AUX caffe2-2.5.1-unbundle_kineto.patch 830 BLAKE2B 80c9ebc30d0ca3b964141a5d9a7cb3662e6dc8472454ceabc2725f47277211cd495c4146dc9c2046cc5c5505909cf4e30c780685fceebdb05319aba5c4366346 SHA512 9645b11b5395f7a4626f17edae22c718c73d2e2f3de56e98653932a3c66f417942d54fd1dadc99112337c11513ac707a96d0caac4bf3d100db8f7079609b9b68 DIST caffe2-patches-20240809.tar.gz 15242 BLAKE2B 77503c61487e7d85cca5afcab9a6e638f9833a70861845638cf1b62bc492d7b6650e6db81d53ebb2f39c6313509250d339f725f04d03ec6dd23dd0cf70843d8c SHA512 74b3b0b6671b655ecac93f7436c4ed7cb0157a83aafbf6afcc0811e11cef341cd8f638db1a111bcbb01e1a6dd4daf3a36b96d7a8ce90f04c2fa091bd6e3a142b DIST pytorch-2.4.0.tar.gz 115031093 BLAKE2B d206477963977011627df284efa01482fbf57e9fcb5f58f51d679c742b8e5dde6aa6affd8745ab817fcd09477d129a81e74e07be576b5d3585eaca1c735b8e01 SHA512 804d25944035f33de6591fd942fbda44d3de037717a4397d38a97474b01775d30eaf93d16dd708a832c0119050d24d73b90990fd3e3773be79d26ada25244d22 DIST pytorch-2.4.1.tar.gz 115029469 BLAKE2B c2909ff27d527bc57cba56b780d3b8cd07a043ab045caa6c6b27857a16f9ad10aaab2116b26226b1e46ee08ffb44007965d914464418e4ae14ca48c3f3f383bb SHA512 7e9b4485e242eaf0d648765c6621d73d95e7107b766646a098175436d1ab2e2b864badd0757a3bab6b7c318233f2120bad9ac07b39bb9e357897919580c87631 +DIST pytorch-2.5.1.tar.gz 116091366 BLAKE2B 7838b17562b94ffc7d798031348689db607dd5eae2a3c35be365972e2b52a2c1b12067068d5aca5ab00cf0977d9c2c3c9ae5337d69534c864c732e6256cbeef6 SHA512 a913a466324a65fa3d79c5e9ad4d605fc7976f0134fda2f81aaa3cea29d56926604999b8a238759646d211e63b47bbb446cdffa86ca8defd8159f11e30301289 EBUILD caffe2-2.4.0-r1.ebuild 8334 BLAKE2B f904d32b44211fceaaee3ac78379980ff753c8487a9f0afb89eddb01b0ec3533ea5cb1b84f59e2aee83960e8a487bb360b2ca99f151b2b3f30f3d0b4cd2bc432 SHA512 3edc1603fed4db66ea6e3a908508739bb2dcb49b816b5980abc1054af027caa5e61e918129e3de283adb07bbcdc3f30c9cf37024cf1e24ac5d1db7c87390e084 EBUILD caffe2-2.4.1-r4.ebuild 8557 BLAKE2B da9583ba20e7a2736cd7c81c387c8b1c755a2c0d295a3d8309f9751579caf15e4fff1429a401d1c0859b247ca4b764d3df8d37159b295aec35e41cd62d8a9594 SHA512 f2d8d0fc6a1fc10e95227dbcbf085db2efb0b9a3633e0269fdae9e3b7a677849ca4256249c59d3335e58b133cf87b85afebb782d5b8d9c5925c4c8c3e2578c73 +EBUILD caffe2-2.5.1-r1.ebuild 8671 BLAKE2B 8e821a990f04063a65bf69d90bf369d1525a059500530fbc27ee1f9e8fe0567ae071472e2240a074e8cf9104a7bbe3c04531cff92b78388c906132a9c2b84d16 SHA512 8089326c4cedd8e68b346b94f6832bcae50c75722e23b376983cc5a68d1529945497a3e9841a6ce7e87501ed422ee7ca42ecbaecf388963a8fc8b859a1e6f12d MISC metadata.xml 1081 BLAKE2B 57800165612fd555263cab4cf0bb0521acd7d41f0023da501a50ccc5a479d25ad7087661a6eec500333c3cf9cc3a85d7be8e9385869c14d92f351d8d9df68556 SHA512 71cc785a5b1688b6a0ac971d31d5fa85bef86966aa80009c34e97caa385c81a7c2fb64ae34d0a39c21548d8238efd008da24bd838a47886bfa3f0d952246b76e diff --git a/sci-libs/caffe2/caffe2-2.5.1-r1.ebuild b/sci-libs/caffe2/caffe2-2.5.1-r1.ebuild new file mode 100644 index 000000000000..393000c79567 --- /dev/null +++ b/sci-libs/caffe2/caffe2-2.5.1-r1.ebuild @@ -0,0 +1,321 @@ +# Copyright 2022-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +ROCM_VERSION=6.1 +inherit python-single-r1 cmake cuda flag-o-matic prefix rocm toolchain-funcs + +MYPN=pytorch +MYP=${MYPN}-${PV} + +DESCRIPTION="A deep learning framework" +HOMEPAGE="https://pytorch.org/" +SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz + -> ${MYP}.tar.gz" + +S="${WORKDIR}"/${MYP} + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" +IUSE="cuda distributed fbgemm flash gloo mkl mpi nnpack +numpy onednn openblas opencl openmp qnnpack rocm xnnpack" +RESTRICT="test" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + mpi? ( distributed ) + gloo? ( distributed ) + ?? ( cuda rocm ) + rocm? ( + || ( ${ROCM_REQUIRED_USE} ) + !flash + ) +" + +RDEPEND=" + ${PYTHON_DEPS} + dev-cpp/abseil-cpp:= + dev-cpp/gflags:= + >=dev-cpp/glog-0.5.0 + dev-cpp/nlohmann_json + dev-cpp/opentelemetry-cpp + dev-libs/cpuinfo + dev-libs/libfmt + dev-libs/protobuf:= + dev-libs/pthreadpool + dev-libs/sleef[cpu_flags_x86_avx512f(+),cpu_flags_x86_avx(+)] + dev-libs/sleef[cpu_flags_x86_sse3(+),cpu_flags_x86_ssse3(+)] + dev-libs/sleef[cpu_flags_x86_sse4_1(+),cpu_flags_x86_sse4_2(+)] + virtual/lapack + sci-libs/onnx + sci-libs/foxi + cuda? ( + dev-libs/cudnn + >=dev-libs/cudnn-frontend-1.0.3:0/8 + <dev-util/nvidia-cuda-toolkit-12.5:=[profiler] + ) + fbgemm? ( >=dev-libs/FBGEMM-2023.12.01 ) + gloo? ( sci-libs/gloo[cuda?] ) + mpi? ( virtual/mpi ) + nnpack? ( sci-libs/NNPACK ) + numpy? ( $(python_gen_cond_dep ' + dev-python/numpy[${PYTHON_USEDEP}] + ') ) + onednn? ( dev-libs/oneDNN ) + opencl? ( virtual/opencl ) + qnnpack? ( + !sci-libs/QNNPACK + dev-cpp/gemmlowp + ) + rocm? ( + =dev-util/hip-6.1* + =dev-libs/rccl-6.1*[${ROCM_USEDEP}] + =sci-libs/rocThrust-6.1*[${ROCM_USEDEP}] + =sci-libs/rocPRIM-6.1*[${ROCM_USEDEP}] + =sci-libs/hipBLAS-6.1*[${ROCM_USEDEP}] + =sci-libs/hipFFT-6.1*[${ROCM_USEDEP}] + =sci-libs/hipSPARSE-6.1*[${ROCM_USEDEP}] + =sci-libs/hipRAND-6.1*[${ROCM_USEDEP}] + =sci-libs/hipCUB-6.1*[${ROCM_USEDEP}] + =sci-libs/hipSOLVER-6.1*[${ROCM_USEDEP}] + =sci-libs/miopen-6.1*[${ROCM_USEDEP}] + =dev-util/roctracer-6.1*[${ROCM_USEDEP}] + + =sci-libs/hipBLASLt-6.1* + amdgpu_targets_gfx90a? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx90a] ) + amdgpu_targets_gfx940? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx940] ) + amdgpu_targets_gfx941? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx941] ) + amdgpu_targets_gfx942? ( =sci-libs/hipBLASLt-6.1*[amdgpu_targets_gfx942] ) + ) + distributed? ( + sci-libs/tensorpipe[cuda?] + dev-cpp/cpp-httplib + ) + xnnpack? ( >=sci-libs/XNNPACK-2024.02.29 ) + mkl? ( sci-libs/mkl ) + openblas? ( sci-libs/openblas ) +" + +DEPEND=" + ${RDEPEND} + cuda? ( >=dev-libs/cutlass-3.4.1 ) + onednn? ( sci-libs/ideep ) + dev-libs/psimd + dev-libs/FP16 + dev-libs/FXdiv + dev-libs/pocketfft + dev-libs/flatbuffers + >=sci-libs/kineto-0.4.0_p20240525 + $(python_gen_cond_dep ' + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/pybind11[${PYTHON_USEDEP}] + dev-python/typing-extensions[${PYTHON_USEDEP}] + ') +" + +PATCHES=( + "${FILESDIR}"/${P}-unbundle_fmt.patch + "${FILESDIR}"/${P}-unbundle_kineto.patch + "${FILESDIR}"/${P}-fix-functorch-install.patch + "${FILESDIR}"/${P}-cudnn_include_fix.patch + "${FILESDIR}"/${P}-gentoo.patch + "${FILESDIR}"/${PN}-2.4.0-cpp-httplib.patch + "${FILESDIR}"/${P}-glog-0.6.0.patch +) + +src_prepare() { + filter-lto #bug 862672 + + # Unbundle fmt + sed -i \ + -e 's|::fmt-header-only||' \ + c10/CMakeLists.txt \ + cmake/Dependencies.cmake \ + torch/CMakeLists.txt \ + || die + + # Drop third_party from CMake tree + sed -i \ + -e '/add_subdirectory.*third_party/d' \ + CMakeLists.txt \ + cmake/Dependencies.cmake \ + cmake/ProtoBuf.cmake \ + aten/src/ATen/CMakeLists.txt \ + || die + + cmake_src_prepare + pushd torch/csrc/jit/serialization || die + flatc --cpp --gen-mutable --scoped-enums mobile_bytecode.fbs || die + popd + + # prefixify the hardcoded paths, after all patches are applied + hprefixify \ + aten/CMakeLists.txt \ + caffe2/CMakeLists.txt \ + cmake/Metal.cmake \ + cmake/Modules/*.cmake \ + cmake/Modules_CUDA_fix/FindCUDNN.cmake \ + cmake/Modules_CUDA_fix/upstream/FindCUDA/make2cmake.cmake \ + cmake/Modules_CUDA_fix/upstream/FindPackageHandleStandardArgs.cmake \ + cmake/public/LoadHIP.cmake \ + cmake/public/cuda.cmake \ + cmake/Dependencies.cmake \ + torch/CMakeLists.txt \ + CMakeLists.txt + + if use rocm; then + sed -e "s:/opt/rocm:/usr:" \ + -e "s:lib/cmake:$(get_libdir)/cmake:g" \ + -e "s/HIP 1.0/HIP 1.0 REQUIRED/" \ + -i cmake/public/LoadHIP.cmake || die + + ebegin "HIPifying cuda sources" + ${EPYTHON} tools/amd_build/build_amd.py || die + eend $? + fi +} + +src_configure() { + if use cuda && [[ -z ${TORCH_CUDA_ARCH_LIST} ]]; then + ewarn "WARNING: caffe2 is being built with its default CUDA compute capabilities: 3.5 and 7.0." + ewarn "These may not be optimal for your GPU." + ewarn "" + ewarn "To configure caffe2 with the CUDA compute capability that is optimal for your GPU," + ewarn "set TORCH_CUDA_ARCH_LIST in your make.conf, and re-emerge caffe2." + ewarn "For example, to use CUDA capability 7.5 & 3.5, add: TORCH_CUDA_ARCH_LIST=7.5 3.5" + ewarn "For a Maxwell model GPU, an example value would be: TORCH_CUDA_ARCH_LIST=Maxwell" + ewarn "" + ewarn "You can look up your GPU's CUDA compute capability at https://developer.nvidia.com/cuda-gpus" + ewarn "or by running /opt/cuda/extras/demo_suite/deviceQuery | grep 'CUDA Capability'" + fi + + local mycmakeargs=( + -DBUILD_CUSTOM_PROTOBUF=OFF + -DLIBSHM_INSTALL_LIB_SUBDIR="${EPREFIX}"/usr/$(get_libdir) + -DPython_EXECUTABLE="${PYTHON}" + -DTORCH_INSTALL_LIB_DIR="${EPREFIX}"/usr/$(get_libdir) + -DUSE_CCACHE=OFF + -DUSE_CUDA=$(usex cuda) + -DUSE_DISTRIBUTED=$(usex distributed) + -DUSE_FAKELOWP=OFF + -DUSE_FBGEMM=$(usex fbgemm) + -DUSE_FLASH_ATTENTION=$(usex flash) + -DUSE_GFLAGS=ON + -DUSE_GLOG=ON + -DUSE_GLOO=$(usex gloo) + -DUSE_ITT=OFF + -DUSE_KINETO=OFF # TODO + -DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma + -DUSE_MEM_EFF_ATTENTION=OFF + -DUSE_MKLDNN=$(usex onednn) + -DUSE_MPI=$(usex mpi) + -DUSE_NCCL=OFF + -DUSE_NNPACK=$(usex nnpack) + -DUSE_NUMA=OFF + -DUSE_NUMPY=$(usex numpy) + -DUSE_OPENCL=$(usex opencl) + -DUSE_OPENMP=$(usex openmp) + -DUSE_PYTORCH_QNNPACK=$(usex qnnpack) + -DUSE_PYTORCH_METAL=OFF + -DUSE_ROCM=$(usex rocm) + -DUSE_SYSTEM_CPUINFO=ON + -DUSE_SYSTEM_EIGEN_INSTALL=ON + -DUSE_SYSTEM_FP16=ON + -DUSE_SYSTEM_FXDIV=ON + -DUSE_SYSTEM_GLOO=ON + -DUSE_SYSTEM_ONNX=ON + -DUSE_SYSTEM_PSIMD=ON + -DUSE_SYSTEM_PSIMD=ON + -DUSE_SYSTEM_PTHREADPOOL=ON + -DUSE_SYSTEM_PYBIND11=ON + -DUSE_SYSTEM_SLEEF=ON + -DUSE_SYSTEM_XNNPACK=$(usex xnnpack) + -DUSE_TENSORPIPE=$(usex distributed) + -DUSE_UCC=OFF + -DUSE_VALGRIND=OFF + -DUSE_XNNPACK=$(usex xnnpack) + -DUSE_XPU=OFF + -Wno-dev + ) + + if use mkl; then + mycmakeargs+=(-DBLAS=MKL) + elif use openblas; then + mycmakeargs+=(-DBLAS=OpenBLAS) + else + mycmakeargs+=(-DBLAS=Generic -DBLAS_LIBRARIES=) + fi + + if use cuda; then + addpredict "/dev/nvidiactl" # bug 867706 + addpredict "/dev/char" + addpredict "/proc/self/task" # bug 926116 + + mycmakeargs+=( + -DUSE_CUDNN=ON + -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}" + -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library + -DCMAKE_CUDA_FLAGS="$(cuda_gccdir -f | tr -d \")" + ) + elif use rocm; then + export PYTORCH_ROCM_ARCH="$(get_amdgpu_flags)" + + mycmakeargs+=( + -DUSE_NCCL=ON + -DUSE_SYSTEM_NCCL=ON + ) + + # ROCm libraries produce too much warnings + append-cxxflags -Wno-deprecated-declarations -Wno-unused-result + + if tc-is-clang; then + # fix mangling in LLVM: https://github.com/llvm/llvm-project/issues/85656 + append-cxxflags -fclang-abi-compat=17 + fi + fi + + if use onednn; then + mycmakeargs+=( + -DMKLDNN_FOUND=ON + -DMKLDNN_LIBRARIES=dnnl + -DMKLDNN_INCLUDE_DIR="${ESYSROOT}/usr/include/oneapi/dnnl" + ) + fi + + cmake_src_configure +} + +src_compile() { + PYTORCH_BUILD_VERSION=${PV} \ + PYTORCH_BUILD_NUMBER=0 \ + cmake_src_compile +} + +src_install() { + cmake_src_install + + insinto "/var/lib/${PN}" + doins "${BUILD_DIR}"/CMakeCache.txt + + rm -rf python + mkdir -p python/torch || die + cp torch/version.py python/torch/ || die + python_domodule python/torch + + mkdir "${D}"$(python_get_sitedir)/torch/bin || die + mkdir "${D}"$(python_get_sitedir)/torch/lib || die + mkdir "${D}"$(python_get_sitedir)/torch/include || die + + ln -s ../../../../../include/torch \ + "${D}$(python_get_sitedir)"/torch/include/torch || die # bug 923269 + + mv "${D}"/usr/bin/torch_shm_manager \ + "${D}"/$(python_get_sitedir)/torch/bin/ || die + + mv "${D}"/usr/$(get_libdir)/libtorch_global_deps.so \ + "${D}"/$(python_get_sitedir)/torch/lib/ || die + + mv "${D}"/usr/lib/libc10*.so \ + "${D}"/usr/$(get_libdir)/ || die +} diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-cudnn_include_fix.patch b/sci-libs/caffe2/files/caffe2-2.5.1-cudnn_include_fix.patch new file mode 100644 index 000000000000..77905dbd1ac8 --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-cudnn_include_fix.patch @@ -0,0 +1,11 @@ +--- a/cmake/Dependencies.cmake 2024-04-29 18:37:34.005639858 +0200 ++++ b/cmake/Dependencies.cmake 2024-04-29 18:39:29.126587738 +0200 +@@ -1235,7 +1235,7 @@ + if(CUDNN_VERSION VERSION_LESS 8.5) + message(FATAL_ERROR "PyTorch needs CuDNN-8.5 or above, but found ${CUDNN_VERSION}. Builds are still possible with `USE_CUDNN=0`") + endif() +- set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include) ++ set(CUDNN_FRONTEND_INCLUDE_DIR /opt/cuda/include) + target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR}) + endif() + diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-exclude-aotriton.patch b/sci-libs/caffe2/files/caffe2-2.5.1-exclude-aotriton.patch new file mode 100644 index 000000000000..340d6e45c95a --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-exclude-aotriton.patch @@ -0,0 +1,22 @@ +Disables aotriton download when both USE_FLASH_ATTENTION and USE_MEM_EFF_ATTENTION cmake flags are OFF +Backports upstream PR to 2.3.0: https://github.com/pytorch/pytorch/pull/130197 +--- a/aten/src/ATen/native/transformers/cuda/sdp_utils.cpp ++++ b/aten/src/ATen/native/transformers/cuda/sdp_utils.cpp +@@ -659,7 +659,7 @@ bool can_use_mem_efficient_attention(sdp_params const& params, bool debug) { + array_of<at::ScalarType>(at::kHalf, at::kFloat, at::kBFloat16); + constexpr auto less_than_sm80_mem_efficient_dtypes = + array_of<at::ScalarType>(at::kHalf, at::kFloat); +-#ifdef USE_ROCM ++#if defined(USE_ROCM) && defined(USE_MEM_EFF_ATTENTION) + constexpr auto aotriton_mem_efficient_dtypes = + array_of<at::ScalarType>(at::kHalf, at::kFloat, at::kBFloat16); + #endif +@@ -709,7 +709,7 @@ bool can_use_mem_efficient_attention(sdp_params const& params, bool debug) { + } + } + +-#ifdef USE_ROCM ++#if defined(USE_ROCM) && defined(USE_MEM_EFF_ATTENTION) + return check_tensor_dtype(params, aotriton_mem_efficient_dtypes, debug); + #else + auto dprop = at::cuda::getCurrentDeviceProperties(); diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-fix-functorch-install.patch b/sci-libs/caffe2/files/caffe2-2.5.1-fix-functorch-install.patch new file mode 100644 index 000000000000..ffce0028a556 --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-fix-functorch-install.patch @@ -0,0 +1,8 @@ +--- a/functorch/CMakeLists.txt 2024-11-10 11:18:29.151992840 +0100 ++++ b/functorch/CMakeLists.txt 2024-11-10 11:20:19.642389982 +0100 +@@ -42,4 +42,4 @@ + if(NOT ${TORCH_PYTHON_LINK_FLAGS} STREQUAL "") + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS ${TORCH_PYTHON_LINK_FLAGS}) + endif() +-install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}") ++install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}") diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-gentoo.patch b/sci-libs/caffe2/files/caffe2-2.5.1-gentoo.patch new file mode 100644 index 000000000000..f923b6746a4b --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-gentoo.patch @@ -0,0 +1,127 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -986,12 +986,11 @@ endif() + # third_party/FBGEMM + include(cmake/public/utils.cmake) + if(NOT MSVC) +- string(APPEND CMAKE_CXX_FLAGS " -O2 -fPIC") ++ string(APPEND CMAKE_CXX_FLAGS " -O2") + # Eigen fails to build with some versions, so convert this to a warning + # Details at http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1459 + string(APPEND CMAKE_CXX_FLAGS " -Wall") + string(APPEND CMAKE_CXX_FLAGS " -Wextra") +- append_cxx_flag_if_supported("-Werror=return-type" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-Werror=non-virtual-dtor" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-Werror=braced-scalar-init" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-Werror=range-loop-construct" CMAKE_CXX_FLAGS) +@@ -1085,7 +1084,6 @@ if(NOT MSVC) + string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fno-omit-frame-pointer -O0") + append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS) +- append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS) + else() + # skip unwanted includes from windows.h + add_compile_definitions(WIN32_LEAN_AND_MEAN) +--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt ++++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt +@@ -324,16 +324,8 @@ set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/pytorch_q + set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/qnnpack_func.h) + + # ---[ Configure clog +-if(NOT TARGET clog) +- set(CLOG_BUILD_TESTS OFF CACHE BOOL "") +- set(CLOG_RUNTIME_TYPE "${CPUINFO_RUNTIME_TYPE}" CACHE STRING "") +- add_subdirectory( +- "${CLOG_SOURCE_DIR}" +- "${CONFU_DEPENDENCIES_BINARY_DIR}/clog") +- # We build static version of clog but a dynamic library may indirectly depend on it +- set_property(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON) +-endif() +-target_link_libraries(pytorch_qnnpack PUBLIC clog) ++find_library(CLOG_LIBRARY NAMES clog REQUIRED) ++target_link_libraries(pytorch_qnnpack PUBLIC ${CLOG_LIBRARY}) + + # ---[ Configure cpuinfo + if(NOT TARGET cpuinfo AND USE_SYSTEM_CPUINFO) +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -87,7 +87,7 @@ endif() + # Note: the folders that are being commented out have not been properly + # addressed yet. + +-if(NOT MSVC AND USE_XNNPACK) ++if(FALSE) + if(NOT TARGET fxdiv) + set(FXDIV_BUILD_TESTS OFF CACHE BOOL "") + set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "") +@@ -1081,7 +1081,6 @@ if(USE_XPU) + endif() + + if(NOT MSVC AND USE_XNNPACK) +- TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv) + endif() + + # ========================================================== +--- a/cmake/Codegen.cmake ++++ b/cmake/Codegen.cmake +@@ -57,7 +57,7 @@ if(INTERN_BUILD_ATEN_OPS) + if(MSVC) + set(OPT_FLAG "/fp:strict ") + else(MSVC) +- set(OPT_FLAG "-O3 ") ++ set(OPT_FLAG " ") + if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") + set(OPT_FLAG " ") + endif() +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -473,7 +473,9 @@ if(USE_PYTORCH_QNNPACK) + set_property(TARGET pytorch_qnnpack PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET cpuinfo PROPERTY POSITION_INDEPENDENT_CODE ON) + # QNNPACK depends on gemmlowp headers +- target_include_directories(pytorch_qnnpack PRIVATE "${CAFFE2_THIRD_PARTY_ROOT}/gemmlowp") ++ find_package(gemmlowp REQUIRED) ++ get_target_property(GEMMLOWP_INCLUDE_DIRS gemmlowp::gemmlowp INTERFACE_INCLUDE_DIRECTORIES) ++ target_include_directories(pytorch_qnnpack PRIVATE ${GEMMLOWP_INCLUDE_DIRS}) + + if(PYTORCH_QNNPACK_CUSTOM_THREADPOOL) + target_compile_definitions( +@@ -710,7 +712,7 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST) + endif() + + # ---[ FBGEMM +-if(USE_FBGEMM) ++if(FALSE) + set(CAFFE2_THIRD_PARTY_ROOT "${PROJECT_SOURCE_DIR}/third_party") + if(NOT DEFINED FBGEMM_SOURCE_DIR) + set(FBGEMM_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/fbgemm" CACHE STRING "FBGEMM source directory") +@@ -758,6 +760,7 @@ if(USE_FBGEMM) + endif() + + if(USE_FBGEMM) ++ list(APPEND Caffe2_DEPENDENCY_LIBS fbgemm) + caffe2_update_option(USE_FBGEMM ON) + else() + caffe2_update_option(USE_FBGEMM OFF) +--- a/cmake/External/nnpack.cmake ++++ b/cmake/External/nnpack.cmake +@@ -56,7 +56,7 @@ if(ANDROID OR IOS OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAM + set(PTHREADPOOL_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/pthreadpool" CACHE STRING "pthreadpool source directory") + set(GOOGLETEST_SOURCE_DIR "${CAFFE2_THIRD_PARTY_ROOT}/googletest" CACHE STRING "Google Test source directory") + +- if(NOT TARGET nnpack) ++ if(FALSE) + if(NOT USE_SYSTEM_PTHREADPOOL AND USE_INTERNAL_PTHREADPOOL_IMPL) + set(NNPACK_CUSTOM_THREADPOOL ON CACHE BOOL "") + endif() +--- a/cmake/public/utils.cmake ++++ b/cmake/public/utils.cmake +@@ -422,8 +422,6 @@ function(torch_compile_options libname) + endif() + + # Use -O2 for release builds (-O3 doesn't improve perf, and -Os results in perf regression) +- target_compile_options(${libname} PRIVATE +- $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>>:-O2>) + + endfunction() + diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-glog-0.6.0.patch b/sci-libs/caffe2/files/caffe2-2.5.1-glog-0.6.0.patch new file mode 100644 index 000000000000..6c06d2cca654 --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-glog-0.6.0.patch @@ -0,0 +1,29 @@ +https://github.com/pytorch/pytorch/issues/58054 + +--- a/c10/util/Logging.cpp ++++ b/c10/util/Logging.cpp +@@ -192,23 +192,13 @@ + google::GLOG_WARNING, + "The minimum log level that caffe2 will output."); + +-// Google glog's api does not have an external function that allows one to check +-// if glog is initialized or not. It does have an internal function - so we are +-// declaring it here. This is a hack but has been used by a bunch of others too +-// (e.g. Torch). +-namespace google { +-namespace glog_internal_namespace_ { +-bool IsGoogleLoggingInitialized(); +-} // namespace glog_internal_namespace_ +-} // namespace google +- + namespace c10 { + namespace { + + void initGoogleLogging(char const* name) { + #if !defined(_MSC_VER) + // This trick can only be used on UNIX platforms +- if (!::google::glog_internal_namespace_::IsGoogleLoggingInitialized()) ++ if (!::google::IsGoogleLoggingInitialized()) + #endif + { + ::google::InitGoogleLogging(name); diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-install-dirs.patch b/sci-libs/caffe2/files/caffe2-2.5.1-install-dirs.patch new file mode 100644 index 000000000000..e99b7e59cb5b --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-install-dirs.patch @@ -0,0 +1,11 @@ +--- a/c10/CMakeLists.txt ++++ b/c10/CMakeLists.txt +@@ -162,7 +162,7 @@ if(NOT BUILD_LIBTORCHLESS) + # Note: for now, we will put all export path into one single Caffe2Targets group + # to deal with the cmake deployment need. Inside the Caffe2Targets set, the + # individual libraries like libc10.so and libcaffe2.so are still self-contained. +- install(TARGETS c10 EXPORT Caffe2Targets DESTINATION lib) ++ install(TARGETS c10 EXPORT Caffe2Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + + install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR} diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-unbundle_fmt.patch b/sci-libs/caffe2/files/caffe2-2.5.1-unbundle_fmt.patch new file mode 100644 index 000000000000..2594a56b36a5 --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-unbundle_fmt.patch @@ -0,0 +1,10 @@ +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -1522,7 +1522,6 @@ + # CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know + # `fmt` is compatible with a superset of the compilers that PyTorch is, it + # shouldn't be too bad to just disable the checks. +-set_target_properties(fmt-header-only PROPERTIES INTERFACE_COMPILE_FEATURES "") + + list(APPEND Caffe2_DEPENDENCY_LIBS fmt) + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) diff --git a/sci-libs/caffe2/files/caffe2-2.5.1-unbundle_kineto.patch b/sci-libs/caffe2/files/caffe2-2.5.1-unbundle_kineto.patch new file mode 100644 index 000000000000..ebe931bc49b6 --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.5.1-unbundle_kineto.patch @@ -0,0 +1,22 @@ +--- a/torch/CMakeLists.txt 2024-11-09 20:50:21.806784527 +0100 ++++ b/torch/CMakeLists.txt 2024-11-09 20:52:56.303892418 +0100 +@@ -67,7 +67,7 @@ + ${TORCH_ROOT}/third_party/gloo + ${TORCH_ROOT}/third_party/onnx + ${TORCH_ROOT}/third_party/flatbuffers/include +- ${TORCH_ROOT}/third_party/kineto/libkineto/include ++ "/usr/include/kineto" + ${TORCH_ROOT}/third_party/cpp-httplib + ${TORCH_ROOT}/third_party/nlohmann/include + +--- a/caffe2/CMakeLists.txt 2024-11-09 20:58:37.698085144 +0100 ++++ b/caffe2/CMakeLists.txt 2024-11-09 20:59:15.771391643 +0100 +@@ -1185,7 +1185,7 @@ + ${TORCH_ROOT}/third_party/miniz-2.1.0) + + target_include_directories(torch_cpu PRIVATE +- ${TORCH_ROOT}/third_party/kineto/libkineto/include) ++ "/usr/include/kineto") + + if(USE_KINETO) + target_include_directories(torch_cpu PRIVATE diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest index 6b9a7dd61c09..a1a2d545213b 100644 --- a/sci-libs/pytorch/Manifest +++ b/sci-libs/pytorch/Manifest @@ -4,8 +4,13 @@ AUX pytorch-2.2.1-emptyso.patch 464 BLAKE2B 8c93245f36218a63a910ddf41e1181c83306 AUX pytorch-2.4.0-dontbuildagain.patch 416 BLAKE2B 42d62ba2342a32a7eb0a8062750cd59ca9ebd6085b06f6751ac884c7daaf6d4a36373290403c02da7bd8d96e409cb7f57fc601cab4bace45613b3f7a14892c24 SHA512 a844b68faf11072b6e2b7d23cd17fff21cb96226f72dc6b52ec5d4f98d48beebcb341b3528b70c89e831e6de0aecefd01e3ad3f41c05347114ca8c19bd31c34d AUX pytorch-2.4.0-global-dlopen.patch 887 BLAKE2B 044e7708619070f93b1157a0c4e560dadda88b299c32023f4f953711201c308966e07dc6c8a34ed9f56cd6ee4b02d5870fd3637365f83f98444695f5747ca7cb SHA512 091b353b33a5d8496836adcafba7f0c04f2085ddbd33bf1fda8222a4afdf2c5b12bed53c26140f22442a1a77c465b326f603de02837f6d214f16dfae01c56417 AUX pytorch-2.4.0-torch_shm_manager.patch 367 BLAKE2B f03c002cbd50fb959dfc3ccf89cb8aa9fe6e001ff2cb47bee45cde28cac262e20df1d06f396776ce069f0a9e92cd370c96788db0aa5d1b9d9f3bc1832701502a SHA512 94f095908385b3058863d05a78a0e243f8614bbde406d457e50bdba574a8e1911b77790a0806f705644dc0c0ae235888314ea4a31aed7c0eb8ddfb29ff42636e +AUX pytorch-2.5.1-dontbuildagain.patch 420 BLAKE2B 42935902e5cb98d5d013fd4e409107c7fa95b91a09ee34723b67dbee37eed4575bb008de0aaab4d00b36bb19d87b4d6855829498fe5b7de95e47b4d536edc71c SHA512 e78b572110ff62d7d90ecd8dfb3f9f6a72c05e5190991ee8084107bbe11f0fe4f85d6fa440b2b4d3ce5e2611685e6e6f35d4fb026eef43131e3e4e60dba53bcf +AUX pytorch-2.5.1-setup.patch 437 BLAKE2B 4107ad2dfde10b25e7422f65c7f87833bb662958eb3fca3ac0c1a5c2e203f7186c31142ac6cdf2a10009a95408e45caaa09fd85a5cc35ee6c9106f8c630a8beb SHA512 a51b3840763f960c1c63df0181c2d35747697a57e11bb08681acf21af06b64d2fca45f6bb3647034d20860e497cab53cec9bd2b5719c5c5aab7bf01080da9103 +AUX pytorch-2.5.1-torch_shm_manager.patch 216 BLAKE2B bd7c51437bf9203bd9ade0c17ee10c860d5aec810435a378f7dc67a401a438050c32e4bec54b9062cebdae4c93db20b3f94bf2bea45332650b848478771bd499 SHA512 e7ea54149bda50d7da6a849d5bf2053da7654ba3f4a83c157d996721a575ccb9060c59055709606c8a455eaffa1ef9e73bda2ffbba7e724a25a8a5d177072082 DIST pytorch-2.4.0.tar.gz 115031093 BLAKE2B d206477963977011627df284efa01482fbf57e9fcb5f58f51d679c742b8e5dde6aa6affd8745ab817fcd09477d129a81e74e07be576b5d3585eaca1c735b8e01 SHA512 804d25944035f33de6591fd942fbda44d3de037717a4397d38a97474b01775d30eaf93d16dd708a832c0119050d24d73b90990fd3e3773be79d26ada25244d22 DIST pytorch-2.4.1.tar.gz 115029469 BLAKE2B c2909ff27d527bc57cba56b780d3b8cd07a043ab045caa6c6b27857a16f9ad10aaab2116b26226b1e46ee08ffb44007965d914464418e4ae14ca48c3f3f383bb SHA512 7e9b4485e242eaf0d648765c6621d73d95e7107b766646a098175436d1ab2e2b864badd0757a3bab6b7c318233f2120bad9ac07b39bb9e357897919580c87631 +DIST pytorch-2.5.1.tar.gz 116091366 BLAKE2B 7838b17562b94ffc7d798031348689db607dd5eae2a3c35be365972e2b52a2c1b12067068d5aca5ab00cf0977d9c2c3c9ae5337d69534c864c732e6256cbeef6 SHA512 a913a466324a65fa3d79c5e9ad4d605fc7976f0134fda2f81aaa3cea29d56926604999b8a238759646d211e63b47bbb446cdffa86ca8defd8159f11e30301289 EBUILD pytorch-2.4.0.ebuild 1616 BLAKE2B 6d2b4012e2ee45eff08e7d38cd6f8177b94ae556337cde21fe5352aca2bbfeecda582159f45bb947d96775468aed2617eaf28cdc4d42e0e0d2cb2c662dbe70ed SHA512 a0ea63813cac1cdc2d23f99982574786417b8f9a829f7166be2b33eb9b2f7dcb20a174ca2a70bc7e887d415efea361a7491c1642b3bbeb68446a8cbee4ed4a1c EBUILD pytorch-2.4.1.ebuild 1616 BLAKE2B 6d2b4012e2ee45eff08e7d38cd6f8177b94ae556337cde21fe5352aca2bbfeecda582159f45bb947d96775468aed2617eaf28cdc4d42e0e0d2cb2c662dbe70ed SHA512 a0ea63813cac1cdc2d23f99982574786417b8f9a829f7166be2b33eb9b2f7dcb20a174ca2a70bc7e887d415efea361a7491c1642b3bbeb68446a8cbee4ed4a1c +EBUILD pytorch-2.5.1.ebuild 1361 BLAKE2B 872c4487a7a334606010f2e2fb844841a3f4d150c62a4bbd795c6c745641b8ad9b4aa3c2dea67a557d82cb19ea24bbf5ba97dc5bb402c3b25fba23f10259771e SHA512 0f04fb7e0cb92b34c1a85fd8ee1614739727d33ae70603f4a200ba5cb189eb3d664c71cc17da6c32d59fefe04e8ad2d732ddbaa09bb6ab6500a933dace54251a MISC metadata.xml 328 BLAKE2B f49c6d62ac88dfffe497ed05b1f727941a94acb87a809611dda8aedbd87508fdfdf94ec0e025cac2a649b0881b600236289943b4be0f6ca44fc105b6d8fbe97c SHA512 16c29d2c1177a89026235191ea3e33870c2e6b63f029b7febd4dbd2e99f598fab4b4fd2fa7a801ffd88393663a00752300e6e2cc847a83690b715bcc481d9dc2 diff --git a/sci-libs/pytorch/files/pytorch-2.5.1-dontbuildagain.patch b/sci-libs/pytorch/files/pytorch-2.5.1-dontbuildagain.patch new file mode 100644 index 000000000000..3a3d24e155d9 --- /dev/null +++ b/sci-libs/pytorch/files/pytorch-2.5.1-dontbuildagain.patch @@ -0,0 +1,17 @@ +--- a/setup.py ++++ b/setup.py +@@ -470,14 +470,6 @@ + check_submodules() + check_pydep("yaml", "pyyaml") + build_python = not BUILD_LIBTORCH_WHL +- build_caffe2( +- version=version, +- cmake_python_library=cmake_python_library, +- build_python=build_python, +- rerun_cmake=RERUN_CMAKE, +- cmake_only=CMAKE_ONLY, +- cmake=cmake, +- ) + + if CMAKE_ONLY: + report( diff --git a/sci-libs/pytorch/files/pytorch-2.5.1-setup.patch b/sci-libs/pytorch/files/pytorch-2.5.1-setup.patch new file mode 100644 index 000000000000..10052a65c939 --- /dev/null +++ b/sci-libs/pytorch/files/pytorch-2.5.1-setup.patch @@ -0,0 +1,10 @@ +--- a/setup.py 2023-02-14 19:34:56.327571750 +0100 ++++ b/setup.py 2023-02-14 19:35:31.073020464 +0100 +@@ -238,6 +238,7 @@ + import setuptools.command.sdist + from setuptools import Extension, find_packages, setup + from setuptools.dist import Distribution ++sys.path[:0] = os.getcwd() + from tools.build_pytorch_libs import build_caffe2 + from tools.generate_torch_version import get_torch_version + from tools.setup_helpers.cmake import CMake diff --git a/sci-libs/pytorch/files/pytorch-2.5.1-torch_shm_manager.patch b/sci-libs/pytorch/files/pytorch-2.5.1-torch_shm_manager.patch new file mode 100644 index 000000000000..5d7902b9bef7 --- /dev/null +++ b/sci-libs/pytorch/files/pytorch-2.5.1-torch_shm_manager.patch @@ -0,0 +1,11 @@ +--- a/torch/__init__.py ++++ b/torch/__init__.py +@@ -1951,7 +1951,7 @@ + return path.encode("utf-8") + + +-_C._initExtension(_manager_path()) ++_C._initExtension(b"/usr/bin/torch_shm_manager") + + del _manager_path + diff --git a/sci-libs/pytorch/pytorch-2.5.1.ebuild b/sci-libs/pytorch/pytorch-2.5.1.ebuild new file mode 100644 index 000000000000..1a5e4c9a039f --- /dev/null +++ b/sci-libs/pytorch/pytorch-2.5.1.ebuild @@ -0,0 +1,62 @@ +# Copyright 2022-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..12} ) +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_EXT=1 +inherit distutils-r1 prefix + +DESCRIPTION="Tensors and Dynamic neural networks in Python" +HOMEPAGE="https://pytorch.org/" +SRC_URI="https://github.com/pytorch/${PN}/archive/refs/tags/v${PV}.tar.gz + -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" +RESTRICT="test" + +REQUIRED_USE=${PYTHON_REQUIRED_USE} +RDEPEND=" + ${PYTHON_DEPS} + ~sci-libs/caffe2-${PV}[${PYTHON_SINGLE_USEDEP}] + $(python_gen_cond_dep ' + dev-python/typing-extensions[${PYTHON_USEDEP}] + dev-python/sympy[${PYTHON_USEDEP}] + ') +" +DEPEND="${RDEPEND} + $(python_gen_cond_dep ' + dev-python/pyyaml[${PYTHON_USEDEP}] + ') +" + +src_prepare() { + eapply \ + "${FILESDIR}"/${P}-dontbuildagain.patch \ + "${FILESDIR}"/${P}-setup.patch + + # Set build dir for pytorch's setup + sed -i \ + -e "/BUILD_DIR/s|build|/var/lib/caffe2/|" \ + tools/setup_helpers/env.py \ + || die + distutils-r1_src_prepare + + hprefixify tools/setup_helpers/env.py +} + +python_compile() { + PYTORCH_BUILD_VERSION=${PV} \ + PYTORCH_BUILD_NUMBER=0 \ + USE_SYSTEM_LIBS=ON \ + CMAKE_BUILD_DIR="${BUILD_DIR}" \ + distutils-r1_python_compile develop sdist +} + +python_install() { + USE_SYSTEM_LIBS=ON distutils-r1_python_install +} |