diff options
-rw-r--r-- | profiles/features/musl/package.use.mask | 3 | ||||
-rw-r--r-- | sci-libs/caffe2/caffe2-2.1.2-r1.ebuild (renamed from sci-libs/caffe2/caffe2-2.1.2.ebuild) | 19 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.1.2-fix-openmp-link.patch | 15 | ||||
-rw-r--r-- | sci-libs/caffe2/files/caffe2-2.1.2-fix-rpath.patch | 12 | ||||
-rw-r--r-- | 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 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 <sci-libs/onnx-1.15.0 sci-libs/foxi @@ -60,10 +60,10 @@ RDEPEND=" qnnpack? ( sci-libs/QNNPACK ) tensorpipe? ( sci-libs/tensorpipe[cuda?] ) xnnpack? ( >=sci-libs/XNNPACK-2022.12.22 ) + mkl? ( sci-libs/mkl ) " DEPEND=" ${RDEPEND} - dev-cpp/eigen cuda? ( >=dev-libs/cutlass-3.1.0 ) dev-libs/psimd dev-libs/FP16 @@ -87,6 +87,8 @@ PATCHES=( "${FILESDIR}"/${PN}-2.0.0-gcc13.patch "${FILESDIR}"/${PN}-2.0.0-cudnn_include_fix.patch "${FILESDIR}"/${PN}-2.1.1-cudaExtra.patch + "${FILESDIR}"/${PN}-2.1.2-fix-rpath.patch + "${FILESDIR}"/${PN}-2.1.2-fix-openmp-link.patch ) src_prepare() { @@ -169,20 +171,25 @@ src_configure() { -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 -DUSE_SYSTEM_ONNX=ON -DUSE_SYSTEM_SLEEF=ON + -DUSE_METAL=OFF -Wno-dev -DTORCH_INSTALL_LIB_DIR="${EPREFIX}"/usr/$(get_libdir) -DLIBSHM_INSTALL_LIB_SUBDIR="${EPREFIX}"/usr/$(get_libdir) ) + if use mkl; then + mycmakeargs+=(-DBLAS=MKL) + else + mycmakeargs+=(-DBLAS=Generic -DBLAS_LIBRARIES=) + fi + if use cuda; then addpredict "/dev/nvidiactl" # bug 867706 addpredict "/dev/char" diff --git a/sci-libs/caffe2/files/caffe2-2.1.2-fix-openmp-link.patch b/sci-libs/caffe2/files/caffe2-2.1.2-fix-openmp-link.patch new file mode 100644 index 000000000000..3f2d0ae3c30a --- /dev/null +++ b/sci-libs/caffe2/files/caffe2-2.1.2-fix-openmp-link.patch @@ -0,0 +1,15 @@ +Fix "undefined symbol: omp_get_max_active_levels" in mkl + <nothing else> 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 000000000000..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 @@ <flag name="qnnpack">Use QNNPACK</flag> <flag name="tensorpipe">Use tensorpipe</flag> <flag name="xnnpack">Use XNNPACK</flag> + <flag name="mkl">Use <pkg>sci-libs/mkl</pkg> for blas, lapack and sparse blas routines</flag> </use> <upstream> <remote-id type="github">pytorch/pytorch</remote-id> |