# Copyright 2022-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 PYTHON_COMPAT=( python3_{10..13} ) 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 https://dev.gentoo.org/~tupone/distfiles/${PN}-patches-20240809.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 ) " # CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122 RDEPEND=" ${PYTHON_DEPS} dev-cpp/abseil-cpp:= dev-cpp/gflags:= >=dev-cpp/glog-0.5.0 dev-libs/cpuinfo dev-libs/libfmt:= dev-cpp/opentelemetry-cpp 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-ml/onnx sci-ml/foxi cuda? ( dev-libs/cudnn >=dev-libs/cudnn-frontend-1.0.3:0/8