diff options
author | Sv. Lockal <lockalsash@gmail.com> | 2024-02-05 16:59:06 +0000 |
---|---|---|
committer | Alfredo Tupone <tupone@gentoo.org> | 2024-02-16 18:52:53 +0100 |
commit | 48801f123fe359bcd78f27ce33d827e62e9ea1e3 (patch) | |
tree | 0739bb8d06bd37327a525d810ea0c886e2953601 /dev-libs/oneDNN | |
parent | www-apps/liquid_feedback_frontend: add 4.0.0 (diff) | |
download | gentoo-48801f123fe359bcd78f27ce33d827e62e9ea1e3.tar.gz gentoo-48801f123fe359bcd78f27ce33d827e62e9ea1e3.tar.bz2 gentoo-48801f123fe359bcd78f27ce33d827e62e9ea1e3.zip |
dev-libs/oneDNN: improve handling of multiple USE flags
Disable test_graph_unit_cpu (#922886) and improve performance for openmp tests.
Remove cpu_* flags: ISA cmake settings set upper level of JIT code, not active instruction set, so using cpu_* flags was misleading.
Improve check for openmp. Allow to builds without openmp (with warning) - #922886
Fix compilation with sci-libs/mkl-2020.4.304, which is installed into /usr, not /opt.
Closes: https://bugs.gentoo.org/922886
Closes: https://bugs.gentoo.org/923109
Closes: https://bugs.gentoo.org/923407
Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
Diffstat (limited to 'dev-libs/oneDNN')
-rw-r--r-- | dev-libs/oneDNN/oneDNN-3.3.3-r1.ebuild (renamed from dev-libs/oneDNN/oneDNN-3.3.3.ebuild) | 76 |
1 files changed, 50 insertions, 26 deletions
diff --git a/dev-libs/oneDNN/oneDNN-3.3.3.ebuild b/dev-libs/oneDNN/oneDNN-3.3.3-r1.ebuild index 6ce3ea96e786..f67b93c73e22 100644 --- a/dev-libs/oneDNN/oneDNN-3.3.3.ebuild +++ b/dev-libs/oneDNN/oneDNN-3.3.3-r1.ebuild @@ -11,7 +11,7 @@ DOCS_DIR="${WORKDIR}/${P}_build" CMAKE_REMOVE_MODULES_LIST=( none ) # There is additional sphinx documentation but we are missing dependency doxyrest. -inherit cmake docs +inherit cmake docs multiprocessing toolchain-funcs DESCRIPTION="oneAPI Deep Neural Network Library" HOMEPAGE="https://github.com/oneapi-src/oneDNN" @@ -21,7 +21,7 @@ LICENSE="Apache-2.0" SLOT="0" KEYWORDS="~amd64" -IUSE="test cpu_flags_x86_avx512f cpu_flags_x86_avx2 cpu_flags_x86_sse4_1 mkl cblas static-libs" +IUSE="test mkl cblas static-libs +openmp" RESTRICT="!test? ( test )" @@ -30,15 +30,37 @@ DEPEND=" cblas? ( !mkl? ( virtual/cblas ) ) " RDEPEND="${DEPEND}" +BDEPEND=" + openmp? ( + || ( + sys-devel/gcc[openmp] + sys-devel/clang-runtime[openmp] + ) + ) +" PATCHES=( "${FILESDIR}/${PN}-3.3.3-include-cstdint.patch" ) +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + src_configure() { + if ! use openmp ; then + ewarn "WARNING: oneDNN is being built with sequential runtime." + ewarn "Proceeding might lead to highly sub-optimal performance." + ewarn "Conside enabling \"openmp\" USE flag." + fi + local mycmakeargs=( -DDNNL_LIBRARY_TYPE=$(usex static-libs STATIC SHARED) - -DDNNL_CPU_RUNTIME=OMP + -DDNNL_CPU_RUNTIME=$(usex openmp OMP SEQ) -DDNNL_GPU_RUNTIME=NONE -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS="$(usex test)" @@ -60,33 +82,20 @@ src_configure() { -DONEDNN_BUILD_GRAPH=ON -DONEDNN_ENABLE_GRAPH_DUMP=OFF -DONEDNN_EXPERIMENTAL_GRAPH_COMPILER_BACKEND=OFF + -DDNNL_ENABLE_PRIMITIVE_CPU_ISA=ALL + -DONEDNN_ENABLE_GEMM_KERNELS_ISA=ALL -Wno-dev ) - local isa="ALL" - - if use cpu_flags_x86_avx512f ; then - isa="AVX512" - elif use cpu_flags_x86_avx2; then - isa="AVX2" - elif use cpu_flags_x86_sse4_1; then - isa="SSE41" - else - ewarn "WARNING: oneDNN is being built with for all ISA." - ewarn "These may cause runtime issues CPUs that are not supported by oneDNN." - ewarn "" - ewarn "To configure oneDNN with ISA that is optimal for your CPU," - ewarn "set CPU_FLAGS_X86 in your make.conf, and re-emerge oneDNN." - ewarn "" - ewarn "See the list of supported CPUs at" - ewarn "https://github.com/oneapi-src/oneDNN?tab=readme-ov-file#system-requirements" - ewarn "For CPU_FLAGS_X86 documentation visit https://wiki.gentoo.org/wiki/CPU_FLAGS_*" - fi - - mycmakeargs+=( -DDNNL_ENABLE_PRIMITIVE_CPU_ISA="${isa}" -DONEDNN_ENABLE_GEMM_KERNELS_ISA="${isa}" ) - if use mkl ; then - source /opt/intel/oneapi/mkl/latest/env/vars.sh + if [ -e "${EPREFIX}"/opt/intel/oneapi/mkl/latest/env/vars.sh ]; then + source "${EPREFIX}"/opt/intel/oneapi/mkl/latest/env/vars.sh || die + else + # bug 923109: sci-libs/mkl-2020.4.304 has no vars.sh, configure it manually + export CPATH="${EPREFIX}"/usr/include/mkl + export MKLROOT="${EPREFIX}"/usr + fi + mycmakeargs+=( -DDNNL_BLAS_VENDOR=MKL ) elif use cblas; then mycmakeargs+=( -DDNNL_BLAS_VENDOR=ANY -DBLA_VENDOR=Generic -DBLAS_LIBRARIES=-lcblas ) @@ -108,3 +117,18 @@ src_install() { # Correct docdir mv "${ED}/usr/share/doc/dnnl"* "${ED}/usr/share/doc/${PF}" || die } + +src_test() { + local CMAKE_SKIP_TESTS=( + # Crashes in sandbox (see #922886 and #923013); + # waits for sys-apps/sandbox-2.39 release and stabilization. + test_graph_unit_cpu + ) + + if use openmp ; then + # Don't run tests in parallel, each test is already parallelized + OMP_NUM_THREADS=$(makeopts_jobs) cmake_src_test -j1 + else + cmake_src_test + fi +} |