diff options
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 +} |