[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2024-03-11 Thread Alfredo Tupone
commit: a5bd494c9be931e7bdcf88f75f37d9f4d8594864
Author: Sv. Lockal  gmail  com>
AuthorDate: Mon Mar 11 16:37:02 2024 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Mon Mar 11 19:27:48 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5bd494c

sci-libs/caffe2: add USE=rocm flag for AMDGPU support for 2.1.2 and 2.2.1

Closes: https://bugs.gentoo.org/905286
Signed-off-by: Sv. Lockal  gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35713
Signed-off-by: Alfredo Tupone  gentoo.org>

 ...ffe2-2.1.2-r6.ebuild => caffe2-2.1.2-r7.ebuild} | 61 +++
 ...{caffe2-2.2.1.ebuild => caffe2-2.2.1-r1.ebuild} | 54 ++---
 .../files/caffe2-2.1.2-rocm-fix-std-cpp17.patch| 68 ++
 sci-libs/caffe2/metadata.xml   |  1 +
 4 files changed, 166 insertions(+), 18 deletions(-)

diff --git a/sci-libs/caffe2/caffe2-2.1.2-r6.ebuild 
b/sci-libs/caffe2/caffe2-2.1.2-r7.ebuild
similarity index 79%
rename from sci-libs/caffe2/caffe2-2.1.2-r6.ebuild
rename to sci-libs/caffe2/caffe2-2.1.2-r7.ebuild
index 969c36754c5c..f57406145c6a 100644
--- a/sci-libs/caffe2/caffe2-2.1.2-r6.ebuild
+++ b/sci-libs/caffe2/caffe2-2.1.2-r7.ebuild
@@ -4,7 +4,8 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{9..12} )
-inherit python-single-r1 cmake cuda flag-o-matic prefix
+ROCM_VERSION=5.7
+inherit python-single-r1 cmake cuda flag-o-matic prefix rocm
 
 MYPN=pytorch
 MYP=${MYPN}-${PV}
@@ -17,7 +18,7 @@ 
SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn 
openblas opencl opencv openmp qnnpack tensorpipe xnnpack"
+IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn 
openblas opencl opencv openmp qnnpack rocm tensorpipe xnnpack"
 RESTRICT="test"
 REQUIRED_USE="
${PYTHON_REQUIRED_USE}
@@ -26,7 +27,9 @@ REQUIRED_USE="
tensorpipe? ( distributed )
distributed? ( tensorpipe )
gloo? ( distributed )
-" # ?? ( cuda rocm )
+   ?? ( cuda rocm )
+   rocm? ( || ( ${ROCM_REQUIRED_USE} ) )
+"
 
 # CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122
 RDEPEND="
@@ -59,6 +62,20 @@ RDEPEND="
opencl? ( virtual/opencl )
opencv? ( media-libs/opencv:= )
qnnpack? ( sci-libs/QNNPACK )
+   rocm? (
+   >=dev-util/hip-5.7
+   >=dev-libs/rccl-5.7[${ROCM_USEDEP}]
+   >=sci-libs/rocThrust-5.7[${ROCM_USEDEP}]
+   >=sci-libs/rocPRIM-5.7[${ROCM_USEDEP}]
+   >=sci-libs/hipBLAS-5.7[${ROCM_USEDEP}]
+   >=sci-libs/hipFFT-5.7[${ROCM_USEDEP}]
+   >=sci-libs/hipSPARSE-5.7[${ROCM_USEDEP}]
+   >=sci-libs/hipRAND-5.7[${ROCM_USEDEP}]
+   >=sci-libs/hipCUB-5.7[${ROCM_USEDEP}]
+   >=sci-libs/hipSOLVER-5.7[${ROCM_USEDEP}]
+   >=sci-libs/miopen-5.7[${ROCM_USEDEP}]
+   >=dev-util/roctracer-5.7[${ROCM_USEDEP}]
+   )
tensorpipe? ( sci-libs/tensorpipe[cuda?] )
xnnpack? ( >=sci-libs/XNNPACK-2022.12.22 )
mkl? ( sci-libs/mkl )
@@ -92,6 +109,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.1.1-cudaExtra.patch
"${FILESDIR}"/${PN}-2.1.2-fix-rpath.patch
"${FILESDIR}"/${PN}-2.1.2-fix-openmp-link.patch
+   "${FILESDIR}"/${PN}-2.1.2-rocm-fix-std-cpp17.patch
 )
 
 src_prepare() {
@@ -118,6 +136,18 @@ src_prepare() {
cmake/Dependencies.cmake \
torch/CMakeLists.txt \
CMakeLists.txt
+
+   if use rocm; then
+   sed -e "s:ROCM_PATH /opt/rocm:ROCM_PATH /usr:" \
+   -e "s:HIP_PATH \${ROCM_PATH}/hip:HIP_PATH /usr:" \
+   -e 
"s:\${HIP_PATH}/cmake:/usr/$(get_libdir)/cmake/hip: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() {
@@ -140,9 +170,6 @@ src_configure() {
 
-DUSE_CCACHE=OFF
-DUSE_CUDA=$(usex cuda)
-   -DUSE_CUDNN=$(usex cuda)
-   -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}"
-   -DBUILD_NVFUSER=$(usex cuda)
-DUSE_DISTRIBUTED=$(usex distributed)
-DUSE_MPI=$(usex mpi)
-DUSE_FAKELOWP=OFF
@@ -155,7 +182,6 @@ src_configure() {
-DUSE_LEVELDB=OFF
-DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma
-DUSE_MKLDNN=$(usex onednn)
-   -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library
-DUSE_NNPACK=$(usex nnpack)
-DUSE_QNNPACK=$(usex qnnpack)
-DUSE_XNNPACK=$(usex xnnpack)
@@ -166,7 +192,7 @@ src_configure() {

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2024-03-08 Thread Alfredo Tupone
commit: 087c7302f2f874abf503fad2c0eaf04fde04cb40
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Fri Mar  8 18:40:10 2024 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Fri Mar  8 18:45:29 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=087c7302

sci-libs/caffe2: add 2.2.1

Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/Manifest|   1 +
 sci-libs/caffe2/caffe2-2.2.1.ebuild | 230 
 sci-libs/caffe2/files/caffe2-2.2.1-gentoo.patch | 195 
 3 files changed, 426 insertions(+)

diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest
index a05e285f98e0..2a63d8018442 100644
--- a/sci-libs/caffe2/Manifest
+++ b/sci-libs/caffe2/Manifest
@@ -1,3 +1,4 @@
 DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 
75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3
 SHA512 
f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62
 DIST pytorch-2.0.1.tar.gz 111335778 BLAKE2B 
7a10cc2b2d5e2422aef7e060a0c3a62ca5c7460c6e0b9becade9b98939501975c74ed5a175a653731f43ca824d2c9bd31f41d1f633c2b139779ab23d5331e9ce
 SHA512 
2309a22b3be3ccdb36d8d9781a59a7bdcc2fdb8d95ada205702ec77862480f0cbb12cd5d6b8cd3114d01a6e33b7743d0fe9de93debf37138ca5c14403cdb0c43
 DIST pytorch-2.1.2.tar.gz 116316469 BLAKE2B 
c5a55ee264bc3477d3556ba6376b5591117e992e56e0dd0c9ba93d12526e2727f7840f6f1e0730a38223b6492c9556840c4ebf22ffd220e97225c2abff303747
 SHA512 
a8961d78ad785b13c959a0612563a60e0de17a7c8bb9822ddea9a24072796354d07e81c47b6cc8761b21a6448845b088cf80e1661d9e889b0ed5474d3dc76756
+DIST pytorch-2.2.1.tar.gz 116370903 BLAKE2B 
7d08e80f91bad76fba1751c30a34bebfe7145058b7758c0d47112702263a80666f70687a8860744725c6aa995e854f766a5bfa4644c23e5635e7e08c8d63a6e9
 SHA512 
f19ebcf59d183c3348946ba7cfcab2bc4ca93785863b8edc39dba5772083a7b0425ccb4f92a8df4dc0d18246c75e8ff812993161467fbf9dc48d7fb28a1e26f1

diff --git a/sci-libs/caffe2/caffe2-2.2.1.ebuild 
b/sci-libs/caffe2/caffe2-2.2.1.ebuild
new file mode 100644
index ..68328fb71624
--- /dev/null
+++ b/sci-libs/caffe2/caffe2-2.2.1.ebuild
@@ -0,0 +1,230 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..12} )
+inherit python-single-r1 cmake cuda flag-o-matic prefix
+
+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"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy onednn 
openblas opencl opencv openmp qnnpack xnnpack"
+RESTRICT="test"
+REQUIRED_USE="
+   ${PYTHON_REQUIRED_USE}
+   ffmpeg? ( opencv )
+   mpi? ( distributed )
+   gloo? ( distributed )
+" # ?? ( cuda rocm )
+
+# CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122
+RDEPEND="
+   ${PYTHON_DEPS}
+   dev-cpp/gflags:=
+   >=dev-cpp/glog-0.5.0
+   dev-libs/cpuinfo
+   dev-libs/libfmt
+   dev-libs/protobuf:=
+   dev-libs/pthreadpool
+   dev-libs/sleef
+   virtual/lapack
+   >=sci-libs/onnx-1.12.0
+   =dev-libs/cudnn-frontend-0.9.2:0/8
+   dev-util/nvidia-cuda-toolkit:=[profiler]
+   )
+   fbgemm? ( >=dev-libs/FBGEMM-2023.11.02 )
+   ffmpeg? ( media-video/ffmpeg:= )
+   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 )
+   opencv? ( media-libs/opencv:= )
+   qnnpack? ( sci-libs/QNNPACK )
+   distributed? ( sci-libs/tensorpipe[cuda?] )
+   xnnpack? ( >=sci-libs/XNNPACK-2022.12.22 )
+   mkl? ( sci-libs/mkl )
+   openblas? ( sci-libs/openblas )
+"
+DEPEND="
+   ${RDEPEND}
+   cuda? ( >=dev-libs/cutlass-3.1.0 )
+   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_p20231031
+   $(python_gen_cond_dep '
+   dev-python/pyyaml[${PYTHON_USEDEP}]
+   dev-python/pybind11[${PYTHON_USEDEP}]
+   ')
+"
+
+S="${WORKDIR}"/${MYP}
+
+PATCHES=(
+   "${FILESDIR}"/${P}-gentoo.patch
+   "${FILESDIR}"/${PN}-1.13.0-install-dirs.patch
+   "${FILESDIR}"/${PN}-1.12.0-glog-0.6.0.patch
+   "${FILESDIR}"/${PN}-1.13.1-tensorpipe.patch
+   "${FILESDIR}"/${PN}-2.0.0-gcc13.patch
+   "${FILESDIR}"/${PN}-2.0.0-cudnn_include_fix.patch
+   "${FILESDIR}"/${PN}-2.1.2-fix-rpath.patch
+   "${FILESDIR}"/${PN}-2.1.2-fix-openmp-link.patch

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/, profiles/features/musl/

2023-12-31 Thread Alfredo Tupone
commit: 53a5bc45ce81fd5e1cc56536f408d1eea1c7f537
Author: Sv. Lockal  gmail  com>
AuthorDate: Sun Dec 31 15:07:04 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Sun Dec 31 16:23:21 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53a5bc45

sci-libs/caffe2: add support of blas/lapack providers, including mkl

Closes: https://bugs.gentoo.org/921129
Signed-off-by: Sv. Lockal  gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/34584
Signed-off-by: Alfredo Tupone  gentoo.org>

 profiles/features/musl/package.use.mask   |  3 +++
 .../{caffe2-2.1.2.ebuild => caffe2-2.1.2-r1.ebuild}   | 19 +--
 .../caffe2/files/caffe2-2.1.2-fix-openmp-link.patch   | 15 +++
 sci-libs/caffe2/files/caffe2-2.1.2-fix-rpath.patch| 12 
 sci-libs/caffe2/metadata.xml  |  1 +
 5 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/profiles/features/musl/package.use.mask 
b/profiles/features/musl/package.use.mask
index c9b7d23aaca6..3fa72fa2eaa5 100644
--- a/profiles/features/musl/package.use.mask
+++ b/profiles/features/musl/package.use.mask
@@ -142,3 +142,6 @@ app-shells/bash mem-scramble
 
 # static linking works with musl
 app-shells/mksh -static
+
+# linked against glibc
+sci-libs/caffe2 mkl

diff --git a/sci-libs/caffe2/caffe2-2.1.2.ebuild 
b/sci-libs/caffe2/caffe2-2.1.2-r1.ebuild
similarity index 93%
rename from sci-libs/caffe2/caffe2-2.1.2.ebuild
rename to sci-libs/caffe2/caffe2-2.1.2-r1.ebuild
index aca834318aa5..56ae2472b0fb 100644
--- a/sci-libs/caffe2/caffe2-2.1.2.ebuild
+++ b/sci-libs/caffe2/caffe2-2.1.2-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{9..12} )
 inherit python-single-r1 cmake cuda flag-o-matic prefix
 
 MYPN=pytorch
@@ -17,7 +17,7 @@ 
SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="cuda distributed fbgemm ffmpeg gloo mpi nnpack +numpy opencl opencv 
openmp qnnpack tensorpipe xnnpack"
+IUSE="cuda distributed fbgemm ffmpeg gloo mkl mpi nnpack +numpy opencl opencv 
openmp qnnpack tensorpipe xnnpack"
 RESTRICT="test"
 REQUIRED_USE="
${PYTHON_REQUIRED_USE}
@@ -38,7 +38,7 @@ RDEPEND="
dev-libs/protobuf:=
dev-libs/pthreadpool
dev-libs/sleef
-   sci-libs/lapack
+   virtual/lapack
>=sci-libs/onnx-1.12.0
 
builds
+https://github.com/pytorch/pytorch/issues/116576
+--- a/caffe2/CMakeLists.txt
 b/caffe2/CMakeLists.txt
+@@ -1575,6 +1575,10 @@ if(BUILD_SHARED_LIBS)
+ target_link_libraries(torch_global_deps TBB::tbb)
+   endif()
+ 
++  if(USE_OPENMP)
++target_link_libraries(torch_global_deps OpenMP::OpenMP_CXX)
++  endif()
++
+   install(TARGETS torch_global_deps DESTINATION "${TORCH_INSTALL_LIB_DIR}")
+ endif()
+ 

diff --git a/sci-libs/caffe2/files/caffe2-2.1.2-fix-rpath.patch 
b/sci-libs/caffe2/files/caffe2-2.1.2-fix-rpath.patch
new file mode 100644
index ..731227fa25ee
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-2.1.2-fix-rpath.patch
@@ -0,0 +1,12 @@
+Unset rpath to support blas-lapack-switch
+Bug: https://bugs.gentoo.org/921129
+--- a/cmake/Dependencies.cmake
 b/cmake/Dependencies.cmake
+@@ -10,7 +10,6 @@ endif(APPLE)
+ set(CMAKE_SKIP_BUILD_RPATH  FALSE)
+ # Don't use the install-rpath during the build phase
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+-set(CMAKE_INSTALL_RPATH "${_rpath_portable_origin}")
+ # Automatically add all linked folders that are NOT in the build directory to
+ # the rpath (per library?)
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

diff --git a/sci-libs/caffe2/metadata.xml b/sci-libs/caffe2/metadata.xml
index 3b4ad7f29919..eac4c942a88d 100644
--- a/sci-libs/caffe2/metadata.xml
+++ b/sci-libs/caffe2/metadata.xml
@@ -21,6 +21,7 @@
Use QNNPACK
Use tensorpipe
Use XNNPACK
+   Use sci-libs/mkl for blas, lapack 
and sparse blas routines


pytorch/pytorch



[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2023-12-06 Thread Alfredo Tupone
commit: 783ebfe477601f3a416a1bf7f7f0daf5b0732c5c
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Wed Dec  6 11:55:09 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Wed Dec  6 11:55:25 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=783ebfe4

sci-libs/caffe2: add 2.1.1

Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/Manifest   |   1 +
 sci-libs/caffe2/caffe2-2.1.1.ebuild| 210 +
 sci-libs/caffe2/files/caffe2-2.1.1-cudaExtra.patch |  28 +++
 sci-libs/caffe2/files/caffe2-2.1.1-gentoo.patch| 188 ++
 4 files changed, 427 insertions(+)

diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest
index 0ee75499ccbe..d51cccdc3c37 100644
--- a/sci-libs/caffe2/Manifest
+++ b/sci-libs/caffe2/Manifest
@@ -1,3 +1,4 @@
 DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 
75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3
 SHA512 
f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62
 DIST pytorch-2.0.0.tar.gz 111327292 BLAKE2B 
6d593a975c0ade714f0b189f7e3c4ff704b9a9a2377b5e441a9cefc202fa22779966d08948e63671912c6ea5a0eee124042155f4f57a654db34e19e42f013cc9
 SHA512 
4dd76160711c0d87f3026c8b7fa3ed149dd86b8ac0ee9ecea0eaf80d2e6ce8c29368392e77b9466d90b60634087b462b782495997a5d33367cc8ca9fe14c8a14
 DIST pytorch-2.0.1.tar.gz 111335778 BLAKE2B 
7a10cc2b2d5e2422aef7e060a0c3a62ca5c7460c6e0b9becade9b98939501975c74ed5a175a653731f43ca824d2c9bd31f41d1f633c2b139779ab23d5331e9ce
 SHA512 
2309a22b3be3ccdb36d8d9781a59a7bdcc2fdb8d95ada205702ec77862480f0cbb12cd5d6b8cd3114d01a6e33b7743d0fe9de93debf37138ca5c14403cdb0c43
+DIST pytorch-2.1.1.tar.gz 116317162 BLAKE2B 
d9819256cba0b9951aabe95d86fb135e97d8bafa2c010d13162cd9b3373ca75f20d218e31279ace41981f3f76308721c522f9e53745a1ff9e6386fa10634f9ad
 SHA512 
31b36e7732ee086ae7565a3811ab2d1b2869e79057bea7a4ffc4a3c95c544757e656a6d2289ee11fe7508828aca144e4220ef1e9ab1878e075e1259cf6ff9ca4

diff --git a/sci-libs/caffe2/caffe2-2.1.1.ebuild 
b/sci-libs/caffe2/caffe2-2.1.1.ebuild
new file mode 100644
index ..e5e9a71069cd
--- /dev/null
+++ b/sci-libs/caffe2/caffe2-2.1.1.ebuild
@@ -0,0 +1,210 @@
+# Copyright 2022-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+inherit python-single-r1 cmake cuda flag-o-matic prefix
+
+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"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cuda distributed fbgemm ffmpeg gloo mpi nnpack +numpy opencl opencv 
openmp qnnpack tensorpipe xnnpack"
+RESTRICT="test"
+REQUIRED_USE="
+   ${PYTHON_REQUIRED_USE}
+   ffmpeg? ( opencv )
+   mpi? ( distributed )
+   tensorpipe? ( distributed )
+   distributed? ( tensorpipe )
+   gloo? ( distributed )
+" # ?? ( cuda rocm )
+
+# CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122
+RDEPEND="
+   ${PYTHON_DEPS}
+   dev-cpp/gflags:=
+   >=dev-cpp/glog-0.5.0
+   dev-libs/cpuinfo
+   dev-libs/libfmt
+   dev-libs/protobuf:=
+   dev-libs/pthreadpool
+   dev-libs/sleef
+   sci-libs/lapack
+   >=sci-libs/onnx-1.12.0
+   sci-libs/foxi
+   cuda? (
+   =dev-libs/cudnn-8*
+   dev-libs/cudnn-frontend:0/8
+   =sci-libs/XNNPACK-2022.12.22 )
+"
+DEPEND="
+   ${RDEPEND}
+   dev-cpp/eigen
+   cuda? ( dev-libs/cutlass )
+   dev-libs/psimd
+   dev-libs/FP16
+   dev-libs/FXdiv
+   dev-libs/pocketfft
+   dev-libs/flatbuffers
+   >=sci-libs/kineto-0.4.0_p20231031
+   $(python_gen_cond_dep '
+   dev-python/pyyaml[${PYTHON_USEDEP}]
+   dev-python/pybind11[${PYTHON_USEDEP}]
+   ')
+"
+
+S="${WORKDIR}"/${MYP}
+
+PATCHES=(
+   "${FILESDIR}"/${P}-gentoo.patch
+   "${FILESDIR}"/${PN}-1.13.0-install-dirs.patch
+   "${FILESDIR}"/${PN}-1.12.0-glog-0.6.0.patch
+   "${FILESDIR}"/${PN}-1.13.1-tensorpipe.patch
+   "${FILESDIR}"/${PN}-2.0.0-gcc13.patch
+   "${FILESDIR}"/${PN}-2.0.0-cudnn_include_fix.patch
+   "${FILESDIR}"/${P}-cudaExtra.patch
+)
+
+src_prepare() {
+   filter-lto #bug 862672
+   sed -i \
+   -e "/third_party\/gloo/d" \
+   cmake/Dependencies.cmake \
+   || 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 \
+   

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2023-04-24 Thread Alfredo Tupone
commit: 4d6a404d63ba3914c98344efe64d9b631089e3e1
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Mon Apr 24 08:06:19 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Mon Apr 24 08:35:48 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d6a404d

sci-libs/caffe2: fix cudnn include path

Closes: https://bugs.gentoo.org/904882
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/caffe2-2.0.0-r2.ebuild |  1 +
 sci-libs/caffe2/files/caffe2-2.0.0-cudnn_include_fix.patch | 12 
 2 files changed, 13 insertions(+)

diff --git a/sci-libs/caffe2/caffe2-2.0.0-r2.ebuild 
b/sci-libs/caffe2/caffe2-2.0.0-r2.ebuild
index 38ce9cd3befa..7667c7bbee17 100644
--- a/sci-libs/caffe2/caffe2-2.0.0-r2.ebuild
+++ b/sci-libs/caffe2/caffe2-2.0.0-r2.ebuild
@@ -81,6 +81,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.12.0-glog-0.6.0.patch
"${FILESDIR}"/${PN}-1.13.1-tensorpipe.patch
"${FILESDIR}"/${P}-gcc13.patch
+   "${FILESDIR}"/${P}-cudnn_include_fix.patch
 )
 
 src_prepare() {

diff --git a/sci-libs/caffe2/files/caffe2-2.0.0-cudnn_include_fix.patch 
b/sci-libs/caffe2/files/caffe2-2.0.0-cudnn_include_fix.patch
new file mode 100644
index ..ff64e4108087
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-2.0.0-cudnn_include_fix.patch
@@ -0,0 +1,12 @@
+diff -uar pytorch-2.0.0/cmake/Dependencies.cmake 
pytorch-2.0.0orig/cmake/Dependencies.cmake
+--- a/cmake/Dependencies.cmake 2023-04-23 09:43:20.767566047 -0400
 b/cmake/Dependencies.cmake 2023-03-09 17:42:00.0 -0500
+@@ -1235,7 +1235,7 @@
+ 
+ # ---[ cuDNN
+ if(USE_CUDNN)
+-  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()
+ 



[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2023-04-05 Thread Alfredo Tupone
commit: af7595c6e757334814a1d164a6fcaf35cfd0a944
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Wed Apr  5 09:05:54 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Wed Apr  5 09:06:53 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af7595c6

sci-libs/caffe2: add 2.0.0

Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/Manifest|   1 +
 sci-libs/caffe2/caffe2-2.0.0.ebuild | 184 +++
 sci-libs/caffe2/files/caffe2-2.0.0-gentoo.patch | 189 
 3 files changed, 374 insertions(+)

diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest
index 616b75a49763..1424256938e9 100644
--- a/sci-libs/caffe2/Manifest
+++ b/sci-libs/caffe2/Manifest
@@ -1 +1,2 @@
 DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 
75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3
 SHA512 
f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62
+DIST pytorch-2.0.0.tar.gz 111327292 BLAKE2B 
6d593a975c0ade714f0b189f7e3c4ff704b9a9a2377b5e441a9cefc202fa22779966d08948e63671912c6ea5a0eee124042155f4f57a654db34e19e42f013cc9
 SHA512 
4dd76160711c0d87f3026c8b7fa3ed149dd86b8ac0ee9ecea0eaf80d2e6ce8c29368392e77b9466d90b60634087b462b782495997a5d33367cc8ca9fe14c8a14

diff --git a/sci-libs/caffe2/caffe2-2.0.0.ebuild 
b/sci-libs/caffe2/caffe2-2.0.0.ebuild
new file mode 100644
index ..d06eaa5b375f
--- /dev/null
+++ b/sci-libs/caffe2/caffe2-2.0.0.ebuild
@@ -0,0 +1,184 @@
+# Copyright 2022-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+inherit python-single-r1 cmake cuda flag-o-matic
+
+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"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cuda distributed ffmpeg mpi nnpack +numpy opencl opencv openmp qnnpack 
tensorpipe xnnpack"
+RESTRICT="test"
+REQUIRED_USE="
+   ${PYTHON_REQUIRED_USE}
+   ffmpeg? ( opencv )
+   mpi? ( distributed )
+   tensorpipe? ( distributed )
+" # ?? ( cuda rocm )
+
+# CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122
+RDEPEND="
+   ${PYTHON_DEPS}
+   dev-cpp/gflags:=
+   >=dev-cpp/glog-0.5.0
+   dev-libs/cpuinfo
+   dev-libs/libfmt
+   dev-libs/protobuf:=
+   dev-libs/pthreadpool
+   dev-libs/sleef
+   sci-libs/lapack
+   >=sci-libs/onnx-1.12.0
+   sci-libs/foxi
+   cuda? (
+   =dev-libs/cudnn-8*
+   dev-libs/cudnn-frontend:0/8
+   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
+   -DBUILD_SHARED_LIBS=ON
+
+   -DUSE_CCACHE=OFF
+   -DUSE_CUDA=$(usex cuda)
+   -DUSE_CUDNN=$(usex cuda)
+   -DUSE_FAST_NVCC=$(usex cuda)
+   -DTORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5 7.0}"
+   -DUSE_DISTRIBUTED=$(usex distributed)
+   -DUSE_MPI=$(usex mpi)
+   -DUSE_FAKELOWP=OFF
+   -DUSE_FBGEMM=OFF # TODO
+   -DUSE_FFMPEG=$(usex ffmpeg)
+   -DUSE_GFLAGS=ON
+   -DUSE_GLOG=ON
+   -DUSE_GLOO=OFF
+   -DUSE_KINETO=OFF # TODO
+   -DUSE_LEVELDB=OFF
+   -DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma
+   -DUSE_MKLDNN=OFF
+   -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library
+   -DUSE_NNPACK=$(usex nnpack)
+   -DUSE_QNNPACK=$(usex qnnpack)
+   -DUSE_XNNPACK=$(usex xnnpack)
+   -DUSE_SYSTEM_XNNPACK=$(usex xnnpack)
+   -DUSE_TENSORPIPE=$(usex tensorpipe)
+   -DUSE_PYTORCH_QNNPACK=OFF
+   -DUSE_NUMPY=$(usex numpy)
+   -DUSE_OPENCL=$(usex opencl)
+   -DUSE_OPENCV=$(usex opencv)
+   -DUSE_OPENMP=$(usex openmp)
+   -DUSE_ROCM=OFF # TODO
+   -DUSE_SYSTEM_CPUINFO=ON
+   -DUSE_SYSTEM_PYBIND11=ON
+   -DUSE_UCC=OFF
+   -DUSE_VALGRIND=OFF
+   -DPYBIND11_PYTHON_VERSION="${EPYTHON#python}"
+   -DPYTHON_EXECUTABLE="${PYTHON}"
+   -DUSE_ITT=OFF
+   -DBLAS=Eigen # avoid the use of MKL, if found on the system
+   -DUSE_SYSTEM_EIGEN_INSTALL=ON
+   -DUSE_SYSTEM_PTHREADPOOL=ON
+   -DUSE_SYSTEM_FXDIV=ON
+   -DUSE_SYSTEM_FP16=ON
+   -DUSE_SYSTEM_GLOO=ON
+ 

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2023-02-28 Thread Alfredo Tupone
commit: 725ad515274266020396fdae1a5b949b30fdc127
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Tue Feb 28 20:37:40 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Tue Feb 28 20:38:24 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=725ad515

sci-libs/caffe2: add tensorpipe use flag

Signed-off-by: Alfredo Tupone  gentoo.org>

 .../{caffe2-1.13.1-r3.ebuild => caffe2-1.13.1-r4.ebuild}   |  7 +--
 sci-libs/caffe2/files/caffe2-1.13.1-tensorpipe.patch   | 10 ++
 sci-libs/caffe2/metadata.xml   |  1 +
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/sci-libs/caffe2/caffe2-1.13.1-r3.ebuild 
b/sci-libs/caffe2/caffe2-1.13.1-r4.ebuild
similarity index 96%
rename from sci-libs/caffe2/caffe2-1.13.1-r3.ebuild
rename to sci-libs/caffe2/caffe2-1.13.1-r4.ebuild
index 04521a5c26ef..9411531dd1ec 100644
--- a/sci-libs/caffe2/caffe2-1.13.1-r3.ebuild
+++ b/sci-libs/caffe2/caffe2-1.13.1-r4.ebuild
@@ -17,12 +17,13 @@ 
SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="cuda distributed ffmpeg mpi nnpack +numpy opencl opencv openmp qnnpack 
xnnpack"
+IUSE="cuda distributed ffmpeg mpi nnpack +numpy opencl opencv openmp qnnpack 
tensorpipe xnnpack"
 RESTRICT="test"
 REQUIRED_USE="
${PYTHON_REQUIRED_USE}
ffmpeg? ( opencv )
mpi? ( distributed )
+   tensorpipe? ( distributed )
 " # ?? ( cuda rocm )
 
 # CUDA 12 not supported yet: https://github.com/pytorch/pytorch/issues/91122
@@ -52,6 +53,7 @@ RDEPEND="
opencl? ( virtual/opencl )
opencv? ( media-libs/opencv:= )
qnnpack? ( sci-libs/QNNPACK )
+   tensorpipe? ( sci-libs/tensorpipe )
xnnpack? ( sci-libs/XNNPACK )
 "
 DEPEND="
@@ -77,6 +79,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.13.0-install-dirs.patch
"${FILESDIR}"/${PN}-1.12.0-glog-0.6.0.patch
"${FILESDIR}"/${PN}-1.12.0-clang.patch
+   "${FILESDIR}"/${P}-tensorpipe.patch
 )
 
 src_prepare() {
@@ -127,6 +130,7 @@ src_configure() {
-DUSE_QNNPACK=$(usex qnnpack)
-DUSE_XNNPACK=$(usex xnnpack)
-DUSE_SYSTEM_XNNPACK=$(usex xnnpack)
+   -DUSE_TENSORPIPE=$(usex tensorpipe)
-DUSE_PYTORCH_QNNPACK=OFF
-DUSE_NUMPY=$(usex numpy)
-DUSE_OPENCL=$(usex opencl)
@@ -147,7 +151,6 @@ src_configure() {
-DUSE_SYSTEM_GLOO=ON
-DUSE_SYSTEM_ONNX=ON
-DUSE_SYSTEM_SLEEF=ON
-   -DUSE_TENSORPIPE=OFF
 
-Wno-dev
-DTORCH_INSTALL_LIB_DIR="${EPREFIX}"/usr/$(get_libdir)

diff --git a/sci-libs/caffe2/files/caffe2-1.13.1-tensorpipe.patch 
b/sci-libs/caffe2/files/caffe2-1.13.1-tensorpipe.patch
new file mode 100644
index ..ae0cac9fb947
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-1.13.1-tensorpipe.patch
@@ -0,0 +1,10 @@
+--- a/cmake/Dependencies.cmake 2023-02-28 14:14:49.099057348 +0100
 b/cmake/Dependencies.cmake 2023-02-28 14:15:05.326790806 +0100
+@@ -1404,7 +1404,6 @@
+ 
+ # Tensorpipe uses cuda_add_library
+ torch_update_find_cuda_flags()
+-add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/tensorpipe)
+ 
+ list(APPEND Caffe2_DEPENDENCY_LIBS tensorpipe)
+ if(USE_CUDA)

diff --git a/sci-libs/caffe2/metadata.xml b/sci-libs/caffe2/metadata.xml
index f009baee81bb..531b9cbf5879 100644
--- a/sci-libs/caffe2/metadata.xml
+++ b/sci-libs/caffe2/metadata.xml
@@ -19,6 +19,7 @@
Add support for image processing 
operators
Use OpenMP for parallel code
Use QNNPACK
+   Use tensorpipe
Use XNNPACK





[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2023-02-22 Thread Alfredo Tupone
commit: 67094a0ab3f18f4c8bbcf4db3e1838b33527b15c
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Wed Feb 22 08:06:43 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Wed Feb 22 08:06:43 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67094a0a

sci-libs/caffe2: drop 1.12.0-r1, 1.12.1, 1.13.0-r1

Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/Manifest   |   3 -
 sci-libs/caffe2/caffe2-1.12.0-r1.ebuild| 165 
 sci-libs/caffe2/caffe2-1.12.1.ebuild   | 165 
 sci-libs/caffe2/caffe2-1.13.0-r1.ebuild| 169 -
 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch   | 168 
 .../caffe2/files/caffe2-1.12.0-install-dirs.patch  | 129 
 6 files changed, 799 deletions(-)

diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest
index 7a1c9e4370ae..616b75a49763 100644
--- a/sci-libs/caffe2/Manifest
+++ b/sci-libs/caffe2/Manifest
@@ -1,4 +1 @@
-DIST pytorch-1.12.0.tar.gz 106286765 BLAKE2B 
ff9bafedb35f859f7dccb9b606299cf9c345bdaa0deb87ecfe0c0c30c3c828414d989e1d9a243d9b7cd3f376d56a2f81c241ca2e3c9a8a2b30cddcdeddd3a5c7
 SHA512 
c9c748a2e0047daaaf199a1ba3198d2d1aee47f664170a9b34ccacd3deeb95f2070e4035eeb900012ef48dc62cf6fb6806f1a1dfe22de8c94892963076e593b7
-DIST pytorch-1.12.1.tar.gz 106311625 BLAKE2B 
e8ca19d0e1987449c33ad4c36722a3a467f7f8a9f90be2a7f2de643cbd665038f6802b5ff1f1d3da09b6253d8f29e11549a24295de013d97f73affe538c84c99
 SHA512 
afeb551904ebd9b5901ae623a98eadbb3045115247cedf8006a940742cfad04e5ce24cfaf363336a9ed88d7ce6a4ac53dbb6a5c690aef6efdf20477c3a22c7ca
-DIST pytorch-1.13.0.tar.gz 108276317 BLAKE2B 
8149775dea06d8e4027b741c828169d33f768a96aef58cd2f86daa3bbad5bf36143454e26b683a992aca34e7fb52e6483c46168b698db48ff6978c9605d7a3d2
 SHA512 
5a0e8c589bdf552ccf682511a8860c754ab6f5844f51e568c5034793f787b97707af4340b338b9b8606dd27a6ced6ef50091f0cc514458b3021a2220409d7f20
 DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 
75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3
 SHA512 
f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62

diff --git a/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild 
b/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
deleted file mode 100644
index 1840db7282a4..
--- a/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright 2022-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..10} )
-inherit python-single-r1 cmake flag-o-matic
-
-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"
-
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="~amd64"
-IUSE="cuda ffmpeg nnpack +numpy opencl opencv openmp qnnpack xnnpack"
-RESTRICT="test"
-REQUIRED_USE="
-   ${PYTHON_REQUIRED_USE}
-   ffmpeg? ( opencv )
-" # ?? ( cuda rocm )
-
-RDEPEND="
-   ${PYTHON_DEPS}
-   dev-cpp/gflags:=
-   >=dev-cpp/glog-0.5.0
-   dev-libs/cpuinfo
-   dev-libs/libfmt
-   dev-libs/protobuf:=
-   dev-libs/pthreadpool
-   dev-libs/sleef
-   sci-libs/lapack
-   sci-libs/onnx
-   sci-libs/foxi
-   cuda? (
-   =dev-libs/cudnn-8*
-   dev-libs/cudnn-frontend:0/8
-   dev-util/nvidia-cuda-toolkit:=[profiler]
-   )
-   ffmpeg? ( media-video/ffmpeg:= )
-   nnpack? ( sci-libs/NNPACK )
-   numpy? ( $(python_gen_cond_dep '
-   dev-python/numpy[${PYTHON_USEDEP}]
-   ') )
-   opencl? ( virtual/opencl )
-   opencv? ( media-libs/opencv:= )
-   qnnpack? ( sci-libs/QNNPACK )
-   xnnpack? ( sci-libs/XNNPACK )
-"
-DEPEND="
-   ${RDEPEND}
-   dev-cpp/eigen
-   dev-libs/psimd
-   dev-libs/FP16
-   dev-libs/FXdiv
-   dev-libs/pocketfft
-   dev-libs/flatbuffers
-   $(python_gen_cond_dep '
-   dev-python/pyyaml[${PYTHON_USEDEP}]
-   dev-python/pybind11[${PYTHON_USEDEP}]
-   ')
-"
-
-S="${WORKDIR}"/${MYP}
-
-PATCHES=(
-   "${FILESDIR}"/${PN}-1.11.0-gentoo.patch
-   "${FILESDIR}"/${PN}-1.12.0-install-dirs.patch
-   "${FILESDIR}"/${P}-glog-0.6.0.patch
-   "${FILESDIR}"/${P}-clang.patch
-)
-
-src_prepare() {
-   filter-lto #bug 862672
-   cmake_src_prepare
-   pushd torch/csrc/jit/serialization || die
-   flatc --cpp --gen-mutable --scoped-enums mobile_bytecode.fbs || die
-   popd
-}
-
-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 

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2023-01-12 Thread Alfredo Tupone
commit: 05b4eaf3a0b650d61c1ae0adbcc52a1717aa36d4
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Thu Jan 12 12:05:46 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Thu Jan 12 12:08:10 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05b4eaf3

sci-libs/caffe2: fix build with clang

Closes: https://bugs.gentoo.org/886273
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/caffe2-1.12.0-r1.ebuild |  2 ++
 sci-libs/caffe2/files/caffe2-1.12.0-clang.patch | 42 +
 2 files changed, 44 insertions(+)

diff --git a/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild 
b/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
index 8f6e1f87386f..3ed8c6670b1d 100644
--- a/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
+++ b/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
@@ -71,6 +71,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.11.0-gentoo.patch
"${FILESDIR}"/${PN}-1.12.0-install-dirs.patch
"${FILESDIR}"/${P}-glog-0.6.0.patch
+   "${FILESDIR}"/${P}-clang.patch
 )
 
 src_prepare() {
@@ -134,6 +135,7 @@ src_configure() {
-DUSE_SYSTEM_PTHREADPOOL=ON
-DUSE_SYSTEM_FXDIV=ON
-DUSE_SYSTEM_FP16=ON
+   -DUSE_SYSTEM_GLOO=ON
-DUSE_SYSTEM_ONNX=ON
-DUSE_SYSTEM_SLEEF=ON
-DUSE_TENSORPIPE=OFF

diff --git a/sci-libs/caffe2/files/caffe2-1.12.0-clang.patch 
b/sci-libs/caffe2/files/caffe2-1.12.0-clang.patch
new file mode 100644
index ..dd43b06a97a1
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-1.12.0-clang.patch
@@ -0,0 +1,42 @@
+From bfdc0358dc37c55af6118fe5d8b6ccd898e003fd Mon Sep 17 00:00:00 2001
+From: Kazuki Sakamoto 
+Date: Wed, 21 Dec 2022 11:19:58 +
+Subject: [PATCH] Compile fix for Clang + libc++ (#91212)
+
+Summary:
+LLVM 15 has a compile issue with the deprecated __has_trivial_copy. Update the 
GCC ifdef logic to exclude Clang + libc++.
+
+```
+caffe2/c10/util/Optional.h:536:13: error: builtin __has_trivial_copy is 
deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
+C10_IS_TRIVIALLY_COPYABLE(T) &&
+^
+caffe2/c10/macros/Macros.h:438:38: note: expanded from macro 
'C10_IS_TRIVIALLY_COPYABLE'
+#define C10_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
+```
+
+Test Plan: CI
+
+Reviewed By: kit1980
+
+Differential Revision: D42180203
+
+Pull Request resolved: https://github.com/pytorch/pytorch/pull/91212
+Approved by: https://github.com/kit1980, https://github.com/soumith
+---
+ c10/macros/Macros.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/c10/macros/Macros.h b/c10/macros/Macros.h
+index 9098a294228f4..09e57ca0a4d6a 100644
+--- a/c10/macros/Macros.h
 b/c10/macros/Macros.h
+@@ -434,7 +434,8 @@ __device__ __attribute__((noinline)) __attribute__((weak)) 
void __assert_fail(
+ // Warning: __has_trivial_copy for GCC may not always detect the non-POD
+ // correctly. For example, T = std::unique_ptr may evaluate to true and be
+ // treated as POD. This can cause unexpected behavior.
+-#if defined(__GNUG__) && __GNUC__ < 5
++#if defined(__GNUG__) && __GNUC__ < 5 && \
++!(defined(__clang__) && defined(_LIBCPP_VERSION))
+ #define C10_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
+ #else
+ #define C10_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable::value



[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/

2023-01-04 Thread Alfredo Tupone
commit: d63f5f531caa6c5a6cd5db49ba9efd96006a7325
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Wed Jan  4 14:00:46 2023 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Wed Jan  4 14:01:57 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d63f5f53

sci-libs/caffe2: remove last Werror

Closes: https://bugs.gentoo.org/889444
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch | 38 +---
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch 
b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
index 059bcc2b9705..67d4281c8b95 100644
--- a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
+++ b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
@@ -1,6 +1,6 @@
 --- a/cmake/Dependencies.cmake
 +++ b/cmake/Dependencies.cmake
-@@ -1512,7 +1512,6 @@
+@@ -1523,7 +1523,6 @@
if(NOT USE_SYSTEM_ONNX)
  add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/onnx 
EXCLUDE_FROM_ALL)
endif()
@@ -8,7 +8,7 @@
  
add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE})
if(NOT USE_SYSTEM_ONNX)
-@@ -1810,7 +1809,6 @@
+@@ -1821,7 +1820,6 @@
  #
  set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
  set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
@@ -16,7 +16,7 @@
  
  # Disable compiler feature checks for `fmt`.
  #
-@@ -1819,9 +1817,7 @@
+@@ -1830,9 +1828,7 @@
  # 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.
@@ -25,10 +25,10 @@
 -list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
  set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared 
libs" FORCE)
  
- if(USE_BREAKPAD)
+ # ---[ Kineto
 --- a/c10/CMakeLists.txt
 +++ b/c10/CMakeLists.txt
-@@ -59,7 +59,7 @@
+@@ -62,7 +62,7 @@
  if(${USE_GLOG})
  target_link_libraries(c10 PUBLIC glog::glog)
  endif()
@@ -39,9 +39,9 @@
  if(Backtrace_FOUND)
 --- a/torch/CMakeLists.txt
 +++ b/torch/CMakeLists.txt
-@@ -82,7 +82,6 @@
- 
- set(TORCH_PYTHON_LINK_LIBRARIES
+@@ -86,7 +86,6 @@
+ python::python
+ pybind::pybind11
  shm
 -fmt::fmt-header-only
  ATEN_CPU_FILES_GEN_LIB)
@@ -80,7 +80,7 @@
# This doesn't work globally so we use the test on specific
 --- a/cmake/public/utils.cmake
 +++ b/cmake/public/utils.cmake
-@@ -512,8 +512,6 @@
+@@ -510,8 +510,6 @@
endif()
  
# Use -O2 for release builds (-O3 doesn't improve perf, and -Os results in 
perf regression)
@@ -102,7 +102,7 @@
  endif()
 --- a/caffe2/CMakeLists.txt
 +++ b/caffe2/CMakeLists.txt
-@@ -109,7 +109,7 @@
+@@ -111,7 +111,7 @@
  # Note: the folders that are being commented out have not been properly
  # addressed yet.
  
@@ -111,7 +111,23 @@
if(NOT TARGET fxdiv)
  set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
  set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
-@@ -967,7 +967,6 @@
+@@ -557,7 +557,6 @@
+   if(NOT MSVC)
+ 
set_source_files_properties(${TORCH_SRC_DIR}/csrc/jit/tensorexpr/llvm_jit.cpp 
PROPERTIES COMPILE_FLAGS -Wno-noexcept-type)
+ # Force -Werror on several files
+-
set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/../aten/src/ATen/native/mkldnn/Pooling.cpp
 PROPERTIES COMPILE_FLAGS "-Werror")
+   endif()
+   # Disable certain warnings for GCC-9.X
+   if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 
9.0.0))
+@@ -825,7 +824,6 @@
+ torch_compile_options(torch_cpu)  # see cmake/public/utils.cmake
+ if(HAS_WERROR_SIGN_COMPARE AND WERROR)
+   # target_compile_options(torch_cpu PRIVATE "-Werror=sign-compare")
+-  set_property(SOURCE ${ATen_CORE_SRCS} ${ATen_CPU_SRCS} APPEND PROPERTY 
COMPILE_OPTIONS "-Werror=sign-compare")
+ endif()
+ 
+ set_property(SOURCE ${ATen_CORE_SRCS} APPEND
+@@ -1017,7 +1015,6 @@
  endif()
  
  if(NOT MSVC AND USE_XNNPACK)



[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/

2022-12-23 Thread Alfredo Tupone
commit: 4e35b1fd5cf76fe594ebc10a3a3d0e874cb78e75
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Fri Dec 23 11:05:52 2022 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Fri Dec 23 11:06:42 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e35b1fd

sci-libs/caffe2: remove -Werror

Closes: https://bugs.gentoo.org/886441
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch 
b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
index addf1eb0bfba..059bcc2b9705 100644
--- a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
+++ b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
@@ -49,7 +49,7 @@
  set(TORCH_PYTHON_COMPILE_DEFINITIONS)
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -750,7 +750,7 @@
+@@ -777,7 +777,7 @@
  
  # ---[ Build flags
  if(NOT MSVC)
@@ -58,6 +58,26 @@
string(APPEND CMAKE_CXX_FLAGS " -Wno-narrowing")
# 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
+@@ -783,7 +783,6 @@
+   # Details at http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1459
+   string(APPEND CMAKE_CXX_FLAGS " -Wall")
+   string(APPEND CMAKE_CXX_FLAGS " -Wextra")
+-  string(APPEND CMAKE_CXX_FLAGS " -Werror=return-type")
+   string(APPEND CMAKE_CXX_FLAGS " -Wno-missing-field-initializers")
+   string(APPEND CMAKE_CXX_FLAGS " -Wno-type-limits")
+   string(APPEND CMAKE_CXX_FLAGS " -Wno-array-bounds")
+@@ -883,11 +882,9 @@
+   string(APPEND CMAKE_CXX_FLAGS " -fno-trapping-math")
+   check_cxx_compiler_flag("-Werror=format" HAS_WERROR_FORMAT)
+   if(HAS_WERROR_FORMAT)
+-string(APPEND CMAKE_CXX_FLAGS " -Werror=format")
+   endif()
+   check_cxx_compiler_flag("-Werror=cast-function-type" 
HAS_WERROR_CAST_FUNCTION_TYPE)
+   if(HAS_WERROR_CAST_FUNCTION_TYPE)
+-string(APPEND CMAKE_CXX_FLAGS " -Werror=cast-function-type")
+   endif()
+   check_cxx_compiler_flag("-Werror=sign-compare" HAS_WERROR_SIGN_COMPARE)
+   # This doesn't work globally so we use the test on specific
 --- a/cmake/public/utils.cmake
 +++ b/cmake/public/utils.cmake
 @@ -512,8 +512,6 @@



[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/

2022-10-30 Thread David Seifert
commit: bdcc968d38d7f1a211f1a96830e2bdf32e7c8f55
Author: David Seifert  gentoo  org>
AuthorDate: Sun Oct 30 11:12:49 2022 +
Commit: David Seifert  gentoo  org>
CommitDate: Sun Oct 30 11:12:49 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdcc968d

sci-libs/caffe2/files: [QA] use git-format-patch style patches

Signed-off-by: David Seifert  gentoo.org>

 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch   | 32 +++---
 .../caffe2/files/caffe2-1.12.0-glog-0.6.0.patch|  4 +--
 .../caffe2/files/caffe2-1.12.0-install-dirs.patch  | 22 ++-
 3 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch 
b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
index 505af5e6695c..addf1eb0bfba 100644
--- a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
+++ b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
@@ -1,5 +1,5 @@
 a/cmake/Dependencies.cmake 2022-06-17 22:12:34.451841710 +0200
-+++ b/cmake/Dependencies.cmake 2022-06-17 22:12:48.302786501 +0200
+--- a/cmake/Dependencies.cmake
 b/cmake/Dependencies.cmake
 @@ -1512,7 +1512,6 @@
if(NOT USE_SYSTEM_ONNX)
  add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/onnx 
EXCLUDE_FROM_ALL)
@@ -26,8 +26,8 @@
  set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared 
libs" FORCE)
  
  if(USE_BREAKPAD)
 a/c10/CMakeLists.txt   2022-06-17 22:40:53.573306905 +0200
-+++ b/c10/CMakeLists.txt   2022-06-17 22:41:16.920219686 +0200
+--- a/c10/CMakeLists.txt
 b/c10/CMakeLists.txt
 @@ -59,7 +59,7 @@
  if(${USE_GLOG})
  target_link_libraries(c10 PUBLIC glog::glog)
@@ -37,8 +37,8 @@
  
  find_package(Backtrace)
  if(Backtrace_FOUND)
 a/torch/CMakeLists.txt 2022-06-17 22:42:20.396982644 +0200
-+++ b/torch/CMakeLists.txt 2022-06-17 22:43:20.214759326 +0200
+--- a/torch/CMakeLists.txt
 b/torch/CMakeLists.txt
 @@ -82,7 +82,6 @@
  
  set(TORCH_PYTHON_LINK_LIBRARIES
@@ -47,8 +47,8 @@
  ATEN_CPU_FILES_GEN_LIB)
  
  set(TORCH_PYTHON_COMPILE_DEFINITIONS)
 a/CMakeLists.txt   2022-06-18 20:35:01.451116185 +0200
-+++ b/CMakeLists.txt   2022-06-18 20:35:08.219023569 +0200
+--- a/CMakeLists.txt
 b/CMakeLists.txt
 @@ -750,7 +750,7 @@
  
  # ---[ Build flags
@@ -58,8 +58,8 @@
string(APPEND CMAKE_CXX_FLAGS " -Wno-narrowing")
# 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
 a/cmake/public/utils.cmake 2022-06-18 20:50:39.314263395 +0200
-+++ b/cmake/public/utils.cmake 2022-06-18 20:51:49.611291709 +0200
+--- a/cmake/public/utils.cmake
 b/cmake/public/utils.cmake
 @@ -512,8 +512,6 @@
endif()
  
@@ -69,8 +69,8 @@
  
  endfunction()
  
 a/cmake/Codegen.cmake  2022-06-18 21:33:13.366381817 +0200
-+++ b/cmake/Codegen.cmake  2022-06-18 21:33:30.249157610 +0200
+--- a/cmake/Codegen.cmake
 b/cmake/Codegen.cmake
 @@ -57,7 +57,7 @@
if(MSVC)
  set(OPT_FLAG "/fp:strict ")
@@ -80,8 +80,8 @@
  if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
set(OPT_FLAG " ")
  endif()
 a/caffe2/CMakeLists.txt2022-07-01 21:56:49.643490049 +0200
-+++ b/caffe2/CMakeLists.txt2022-07-01 21:57:17.091489479 +0200
+--- a/caffe2/CMakeLists.txt
 b/caffe2/CMakeLists.txt
 @@ -109,7 +109,7 @@
  # Note: the folders that are being commented out have not been properly
  # addressed yet.
@@ -99,8 +99,8 @@
  endif()
  
  # ==
 a/cmake/External/nnpack.cmake  2022-07-02 21:56:54.905696921 +0200
-+++ b/cmake/External/nnpack.cmake  2022-07-02 21:57:03.665696739 +0200
+--- a/cmake/External/nnpack.cmake
 b/cmake/External/nnpack.cmake
 @@ -58,7 +58,7 @@
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")

diff --git a/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch 
b/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
index a821ebedf7b7..6c06d2cca654 100644
--- a/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
+++ b/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
@@ -1,7 +1,7 @@
 https://github.com/pytorch/pytorch/issues/58054
 
 /c10/util/Logging.cpp
-+++ /c10/util/Logging.cpp
+--- 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.");

diff --git a/sci-libs/caffe2/files/caffe2-1.12.0-install-dirs.patch 
b/sci-libs/caffe2/files/caffe2-1.12.0-install-dirs.patch
index d9c403d5882e..078e33f45020 100644
--- a/sci-libs/caffe2/files/caffe2-1.12.0-install-dirs.patch
+++ b/sci-libs/caffe2/files/caffe2-1.12.0-install-dirs.patch
@@ -1,5 +1,5 @@
 a/c10/CMakeLists.txt   2022-06-19 09:57:16.776536871 +0200
-+++ 

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2022-09-05 Thread Alfredo Tupone
commit: 3f34c4d94727a44935b381b06d00367a2755930a
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Mon Sep  5 06:40:29 2022 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Mon Sep  5 06:40:29 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f34c4d9

sci-libs/caffe2: support glog-0.5.0

Closes: https://bugs.gentoo.org/865681
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/caffe2-1.12.0.ebuild   |  3 ++-
 .../caffe2/files/caffe2-1.12.0-glog-0.6.0.patch| 29 ++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/sci-libs/caffe2/caffe2-1.12.0.ebuild 
b/sci-libs/caffe2/caffe2-1.12.0.ebuild
index 08e81ce1c8ab..0a44b6824c3c 100644
--- a/sci-libs/caffe2/caffe2-1.12.0.ebuild
+++ b/sci-libs/caffe2/caffe2-1.12.0.ebuild
@@ -27,7 +27,7 @@ REQUIRED_USE="
 RDEPEND="
${PYTHON_DEPS}
dev-cpp/gflags:=
-   =dev-cpp/glog-0.5.0
dev-libs/cpuinfo
dev-libs/libfmt
dev-libs/protobuf
@@ -66,6 +66,7 @@ S="${WORKDIR}"/${MYP}
 PATCHES=(
"${FILESDIR}"/${PN}-1.11.0-gentoo.patch
"${FILESDIR}"/${PN}-1.12.0-install-dirs.patch
+   "${FILESDIR}"/${P}-glog-0.6.0.patch
 )
 
 src_prepare() {

diff --git a/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch 
b/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
new file mode 100644
index ..a821ebedf7b7
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-1.12.0-glog-0.6.0.patch
@@ -0,0 +1,29 @@
+https://github.com/pytorch/pytorch/issues/58054
+
+--- /c10/util/Logging.cpp
 /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);



[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2022-07-03 Thread Alfredo Tupone
commit: 7a3d0a4e3007f19ff60d86b8bcfbf40323c610aa
Author: James Beddek  posteo  de>
AuthorDate: Sun Jul  3 06:47:31 2022 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Sun Jul  3 09:56:50 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7a3d0a4e

sci-libs/caffe2: add 1.12.0

add support fot QNNPACK, dev-python/numpy, opencv, ffmpeg, openmp, opencl
add patch to fix install dirs

Signed-off-by: James Beddek  posteo.de>
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/Manifest   |   1 +
 sci-libs/caffe2/caffe2-1.11.0-r2.ebuild|  84 
 ...affe2-1.11.0-r2.ebuild => caffe2-1.12.0.ebuild} |  83 
 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch   |  31 +++--
 .../caffe2/files/caffe2-1.12.0-install-dirs.patch  | 147 +
 sci-libs/caffe2/metadata.xml   |   6 +
 6 files changed, 291 insertions(+), 61 deletions(-)

diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest
index ae4d5567b7fc..0d28654e641f 100644
--- a/sci-libs/caffe2/Manifest
+++ b/sci-libs/caffe2/Manifest
@@ -1 +1,2 @@
 DIST pytorch-1.11.0.tar.gz 20719323 BLAKE2B 
24e7aaa2c26821d36f8092542de9d8d5ac85a619fb9fffb5131987958842afb1cad395780662d15f3411a7cc6ff83a445871960eca1e469fcbf0b9895d83d6e0
 SHA512 
2342eb7a1a241f5855a7cf12e11f62bc4baaa78d1d0864e53bfc946e783eb4addd05ca154a814d2376cd602098b5547e61c158d6eddb7cad5a9f3b0c1357adca
+DIST pytorch-1.12.0.tar.gz 106286765 BLAKE2B 
ff9bafedb35f859f7dccb9b606299cf9c345bdaa0deb87ecfe0c0c30c3c828414d989e1d9a243d9b7cd3f376d56a2f81c241ca2e3c9a8a2b30cddcdeddd3a5c7
 SHA512 
c9c748a2e0047daaaf199a1ba3198d2d1aee47f664170a9b34ccacd3deeb95f2070e4035eeb900012ef48dc62cf6fb6806f1a1dfe22de8c94892963076e593b7

diff --git a/sci-libs/caffe2/caffe2-1.11.0-r2.ebuild 
b/sci-libs/caffe2/caffe2-1.11.0-r2.ebuild
index c59a498341cd..d45e26d90d6d 100644
--- a/sci-libs/caffe2/caffe2-1.11.0-r2.ebuild
+++ b/sci-libs/caffe2/caffe2-1.11.0-r2.ebuild
@@ -17,23 +17,35 @@ 
SRC_URI="https://github.com/pytorch/${MYPN}/archive/refs/tags/v${PV}.tar.gz
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~amd64"
+IUSE="ffmpeg nnpack +numpy opencl opencv openmp qnnpack xnnpack"
 RESTRICT="test"
-IUSE="nnpack xnnpack"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+REQUIRED_USE="
+   ${PYTHON_REQUIRED_USE}
+   ffmpeg? ( opencv )
+"
 
 RDEPEND="
${PYTHON_DEPS}
dev-libs/cpuinfo
dev-libs/libfmt
dev-libs/protobuf
+   dev-libs/pthreadpool
dev-libs/sleef
sci-libs/lapack
sci-libs/onnx
sci-libs/foxi
+   ffmpeg? ( media-video/ffmpeg:= )
nnpack? ( sci-libs/NNPACK )
+   numpy? ( dev-python/numpy[${PYTHON_USEDEP}] )
+   opencl? ( virtual/opencl )
+   opencv? ( media-libs/opencv:= )
+   qnnpack? ( sci-libs/QNNPACK )
xnnpack? ( sci-libs/XNNPACK )
 "
-DEPEND="${RDEPEND}
+DEPEND="
+   ${RDEPEND}
+   dev-cpp/eigen
+   dev-libs/psimd
dev-libs/FP16
dev-libs/pocketfft
dev-libs/flatbuffers
@@ -43,7 +55,10 @@ DEPEND="${RDEPEND}
 
 S="${WORKDIR}"/${MYP}
 
-PATCHES=( "${FILESDIR}"/${P}-gentoo.patch )
+PATCHES=(
+   "${FILESDIR}"/${PN}-1.11.0-gentoo.patch
+   "${FILESDIR}"/${PN}-1.12.0-install-dirs.patch
+)
 
 src_prepare() {
cmake_src_prepare
@@ -55,33 +70,52 @@ src_prepare() {
 src_configure() {
python_setup
local mycmakeargs=(
-   -DUSE_KINETO=OFF
-   -DUSE_SYSTEM_SLEEF=ON
-   -DUSE_BREAKPAD=OFF
-   -DUSE_SYSTEM_ONNX=ON
-   -DUSE_TENSORPIPE=OFF
+   -DBUILD_CUSTOM_PROTOBUF=OFF
+   -DBUILD_SHARED_LIBS=ON
+
+   -DUSE_CCACHE=OFF
+   -DUSE_CUDA=OFF # TODO
+   -DUSE_CUDNN=OFF # TODO
+   -DUSE_FAST_NVCC=OFF # TODO
+   #-DCUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-Auto}"
+   -DUSE_DISTRIBUTED=OFF
+   -DUSE_FAKELOWP=OFF
+   -DUSE_FBGEMM=OFF # TODO
+   -DUSE_FFMPEG=$(usex ffmpeg)
+   -DUSE_GFLAGS=OFF # TODO
+   -DUSE_GLOG=OFF # TODO
-DUSE_GLOO=OFF
-   -DUSE_SYSTEM_FP16=ON
-   -DUSE_FBGEMM=OFF
+   -DUSE_KINETO=OFF # TODO
+   -DUSE_LEVELDB=OFF
+   -DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma
+   -DUSE_MKLDNN=OFF
+   -DUSE_NCCL=OFF # TODO: NVIDIA Collective Communication Library
+   -DUSE_NNPACK=$(usex nnpack)
+   -DUSE_QNNPACK=$(usex qnnpack)
+   -DUSE_XNNPACK=$(usex xnnpack)
+   -DUSE_SYSTEM_XNNPACK=$(usex xnnpack)
-DUSE_PYTORCH_QNNPACK=OFF
-   -DUSE_QNNPACK=OFF
+   -DUSE_NUMPY=$(usex numpy)
+   -DUSE_OPENCL=$(usex opencl)
+   -DUSE_OPENCV=$(usex opencv)
+   -DUSE_OPENMP=$(usex openmp)
+   -DUSE_ROCM=OFF # TODO

[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2022-07-02 Thread Alfredo Tupone
commit: 0f9a010a044de133417cbd56f63c32692451732c
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Sat Jul  2 21:12:40 2022 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Sat Jul  2 21:12:40 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f9a010a

sci-libs/caffe2: add support for nnpack

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Alfredo Tupone  gentoo.org>

 .../{caffe2-1.11.0-r1.ebuild => caffe2-1.11.0-r2.ebuild}  |  5 +++--
 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch  | 11 +++
 sci-libs/caffe2/metadata.xml  |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/sci-libs/caffe2/caffe2-1.11.0-r1.ebuild 
b/sci-libs/caffe2/caffe2-1.11.0-r2.ebuild
similarity index 96%
rename from sci-libs/caffe2/caffe2-1.11.0-r1.ebuild
rename to sci-libs/caffe2/caffe2-1.11.0-r2.ebuild
index d48fb9082441..c59a498341cd 100644
--- a/sci-libs/caffe2/caffe2-1.11.0-r1.ebuild
+++ b/sci-libs/caffe2/caffe2-1.11.0-r2.ebuild
@@ -18,7 +18,7 @@ LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~amd64"
 RESTRICT="test"
-IUSE="xnnpack"
+IUSE="nnpack xnnpack"
 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 
 RDEPEND="
@@ -30,6 +30,7 @@ RDEPEND="
sci-libs/lapack
sci-libs/onnx
sci-libs/foxi
+   nnpack? ( sci-libs/NNPACK )
xnnpack? ( sci-libs/XNNPACK )
 "
 DEPEND="${RDEPEND}
@@ -62,7 +63,6 @@ src_configure() {
-DUSE_GLOO=OFF
-DUSE_SYSTEM_FP16=ON
-DUSE_FBGEMM=OFF
-   -DUSE_NNPACK=OFF
-DUSE_PYTORCH_QNNPACK=OFF
-DUSE_QNNPACK=OFF
-DUSE_SYSTEM_CPUINFO=ON
@@ -81,6 +81,7 @@ src_configure() {
-DUSE_SYSTEM_FXDIV=ON
-DUSE_XNNPACK=$(usex xnnpack ON OFF)
-DUSE_SYSTEM_XNNPACK=$(usex xnnpack ON OFF)
+   -DUSE_NNPACK=$(usex nnpack ON OFF)
)
cmake_src_configure
 }

diff --git a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch 
b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
index f34216ea0970..b6b35e2329e8 100644
--- a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
+++ b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
@@ -110,3 +110,14 @@
  endif()
  
  # ==
+--- a/cmake/External/nnpack.cmake  2022-07-02 21:56:54.905696921 +0200
 b/cmake/External/nnpack.cmake  2022-07-02 21:57:03.665696739 +0200
+@@ -58,7 +58,7 @@
+   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()

diff --git a/sci-libs/caffe2/metadata.xml b/sci-libs/caffe2/metadata.xml
index bdd5f0fe..da10df6e0739 100644
--- a/sci-libs/caffe2/metadata.xml
+++ b/sci-libs/caffe2/metadata.xml
@@ -6,6 +6,7 @@
Tupone Alfredo


+   Use NNPACK
Use XNNPACK





[gentoo-commits] repo/gentoo:master commit in: sci-libs/caffe2/files/, sci-libs/caffe2/

2022-06-26 Thread Alfredo Tupone
commit: 794186914f817e446782620d16d4f7eda5d8353c
Author: Alfredo Tupone  gentoo  org>
AuthorDate: Sat Jun 25 21:40:03 2022 +
Commit: Alfredo Tupone  gentoo  org>
CommitDate: Sun Jun 26 07:47:23 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79418691

sci-libs/caffe2: add to tree

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Alfredo Tupone  gentoo.org>

 sci-libs/caffe2/Manifest |  1 +
 sci-libs/caffe2/caffe2-1.11.0.ebuild | 96 
 sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch | 93 +++
 sci-libs/caffe2/metadata.xml | 11 +++
 4 files changed, 201 insertions(+)

diff --git a/sci-libs/caffe2/Manifest b/sci-libs/caffe2/Manifest
new file mode 100644
index ..ae4d5567b7fc
--- /dev/null
+++ b/sci-libs/caffe2/Manifest
@@ -0,0 +1 @@
+DIST pytorch-1.11.0.tar.gz 20719323 BLAKE2B 
24e7aaa2c26821d36f8092542de9d8d5ac85a619fb9fffb5131987958842afb1cad395780662d15f3411a7cc6ff83a445871960eca1e469fcbf0b9895d83d6e0
 SHA512 
2342eb7a1a241f5855a7cf12e11f62bc4baaa78d1d0864e53bfc946e783eb4addd05ca154a814d2376cd602098b5547e61c158d6eddb7cad5a9f3b0c1357adca

diff --git a/sci-libs/caffe2/caffe2-1.11.0.ebuild 
b/sci-libs/caffe2/caffe2-1.11.0.ebuild
new file mode 100644
index ..f8e9483bf74a
--- /dev/null
+++ b/sci-libs/caffe2/caffe2-1.11.0.ebuild
@@ -0,0 +1,96 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit python-r1 cmake
+
+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"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+RESTRICT="test"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="
+   ${PYTHON_DEPS}
+   dev-libs/cpuinfo
+   dev-libs/libfmt
+   dev-libs/protobuf
+   dev-libs/sleef
+   sci-libs/lapack
+   sci-libs/onnx
+   sci-libs/foxi
+"
+DEPEND="${RDEPEND}
+   dev-libs/FP16
+   dev-libs/pocketfft
+   dev-libs/flatbuffers
+"
+
+S="${WORKDIR}"/${MYP}
+
+PATCHES=( "${FILESDIR}"/${P}-gentoo.patch )
+
+src_prepare() {
+   cmake_src_prepare
+   pushd torch/csrc/jit/serialization || die
+   flatc --cpp --gen-mutable --scoped-enums mobile_bytecode.fbs || die
+   popd
+}
+
+src_configure() {
+   local mycmakeargs=(
+   -DUSE_KINETO=OFF
+   -DUSE_XNNPACK=OFF
+   -DUSE_SYSTEM_SLEEF=ON
+   -DUSE_BREAKPAD=OFF
+   -DUSE_SYSTEM_ONNX=ON
+   -DUSE_TENSORPIPE=OFF
+   -DUSE_GLOO=OFF
+   -DUSE_SYSTEM_FP16=ON
+   -DUSE_FBGEMM=OFF
+   -DUSE_NNPACK=OFF
+   -DUSE_PYTORCH_QNNPACK=OFF
+   -DUSE_QNNPACK=OFF
+   -DUSE_SYSTEM_CPUINFO=ON
+   -DBUILD_CUSTOM_PROTOBUF=OFF
+   -DUSE_MKLDNN=OFF
+   -DUSE_NUMPY=OFF
+   -DUSE_OPENMP=OFF
+   -DUSE_DISTRIBUTED=OFF
+   -DUSE_CUDA=OFF
+   -DUSE_NCCL=OFF
+   -Wno-dev
+   -DTORCH_INSTALL_LIB_DIR=/usr/$(get_libdir)
+   -DLIBSHM_INSTALL_LIB_SUBDIR=/usr/$(get_libdir)
+   -DUSE_CCACHE=OFF
+   )
+   cmake_src_configure
+}
+
+python_install() {
+   python_domodule python/caffe2
+   python_domodule python/torch
+}
+
+src_install() {
+   cmake_src_install
+
+   insinto "/var/lib/${PN}"
+   doins "${BUILD_DIR}"/CMakeCache.txt
+
+   rm -rf python
+   mkdir -p python/torch || die
+   mv "${D}"/usr/lib/python*/site-packages/caffe2 python/ || die
+   cp torch/version.py python/torch/ || die
+   python_foreach_impl python_install
+}

diff --git a/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch 
b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
new file mode 100644
index ..ac74edadab35
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-1.11.0-gentoo.patch
@@ -0,0 +1,93 @@
+--- a/cmake/Dependencies.cmake 2022-06-17 22:12:34.451841710 +0200
 b/cmake/Dependencies.cmake 2022-06-17 22:12:48.302786501 +0200
+@@ -1512,7 +1512,6 @@
+   if(NOT USE_SYSTEM_ONNX)
+ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/onnx 
EXCLUDE_FROM_ALL)
+   endif()
+-  add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi 
EXCLUDE_FROM_ALL)
+ 
+   add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE})
+   if(NOT USE_SYSTEM_ONNX)
+@@ -1810,7 +1809,6 @@
+ #
+ set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
+-add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)
+ 
+ # Disable compiler feature checks for `fmt`.
+ #
+@@ -1819,9 +1817,7 @@
+ # CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know
+ #