diff options
author | Paul Zander <negril.nx+gentoo@gmail.com> | 2023-12-10 14:30:23 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-01-20 13:02:02 +0000 |
commit | b450729745055e29dd0a75346cf209a4a2e17a0b (patch) | |
tree | 787418867a2422806abb73bb17991c85c828bd0c /dev-cpp | |
parent | gui-libs/gtk-layer-shell: add 0.8.2 (diff) | |
download | gentoo-b450729745055e29dd0a75346cf209a4a2e17a0b.tar.gz gentoo-b450729745055e29dd0a75346cf209a4a2e17a0b.tar.bz2 gentoo-b450729745055e29dd0a75346cf209a4a2e17a0b.zip |
dev-cpp/eigen: add 3.4.0-r2, 3.4.9999, 9999 with fixed cuda tests
Automatically detects working compiler.
Automatically detects host CUDA arch, can be overriden by setting CUDAARCHS env var.
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/34547
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-cpp')
-rw-r--r-- | dev-cpp/eigen/Manifest | 2 | ||||
-rw-r--r-- | dev-cpp/eigen/eigen-3.4.0-r2.ebuild | 432 | ||||
-rw-r--r-- | dev-cpp/eigen/eigen-3.4.9999.ebuild | 409 | ||||
-rw-r--r-- | dev-cpp/eigen/eigen-9999.ebuild | 405 | ||||
-rw-r--r-- | dev-cpp/eigen/files/eigen-3.4.0-buildstring.patch | 27 | ||||
-rw-r--r-- | dev-cpp/eigen/files/eigen-3.4.0-cxxstandard.patch | 108 | ||||
-rw-r--r-- | dev-cpp/eigen/files/eigen-3.4.0-noansi.patch | 18 | ||||
-rw-r--r-- | dev-cpp/eigen/files/eigen-9999-please_protect_your_min_with_parentheses.patch | 54 | ||||
-rw-r--r-- | dev-cpp/eigen/metadata.xml | 17 |
9 files changed, 1472 insertions, 0 deletions
diff --git a/dev-cpp/eigen/Manifest b/dev-cpp/eigen/Manifest index 3955c4711b20..02571f1672eb 100644 --- a/dev-cpp/eigen/Manifest +++ b/dev-cpp/eigen/Manifest @@ -1 +1,3 @@ +DIST eigen-3.4.0.tar.bz2 2143091 BLAKE2B a32aac13cbab68cfaaa252d8a406e6a36ecfd1239361412b1f9baa08284a94467479c08ffae10cb847e9916472b46b1c1af4efbf81f957c8200a4379acd42c42 SHA512 cc488eb111e0e248744d2bc4475b345b5fb82361dff226a5b73a33bd0388de8c219cff8cffcf8f476b672fc0e223f339e8c6a1cfb6293840a4a6abf232438a89 DIST eigen-3.4.0.tar.gz 2705005 BLAKE2B ae5f774a6ed36f52cf9fc3206e50796abacbba69fd0f67cd5759b4e04d847aa656861d5e06e6cd0d798a17f2b06abdb70b16f795a626bdd29edcc872c33821f8 SHA512 ba75ecb760e32acf4ceaf27115468e65d4f77c44f8d519b5a13e7940af2c03a304ad433368cb6d55431f307c5c39e2666ab41d34442db3cf441638e51f5c3b6a +DIST eigen-lapack_addons-3.4.1.tgz 6215074 BLAKE2B 564c3398de1f4ea249b58957a482cda0b5eb99e5021e1f18abf3b4d2893fed48912bfa8386681fcae03dd933eea91644f7429d47a53684d64462209a6ae76f30 SHA512 5a827d0befb521cb430f0d63f5000e7955359bc637cdb7292d942712e98c0702570a5b650a72fc609bf5b43633661c0e51de7761ae892df6ff0aab667f436edf diff --git a/dev-cpp/eigen/eigen-3.4.0-r2.ebuild b/dev-cpp/eigen/eigen-3.4.0-r2.ebuild new file mode 100644 index 000000000000..a8b79d254d1b --- /dev/null +++ b/dev-cpp/eigen/eigen-3.4.0-r2.ebuild @@ -0,0 +1,432 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +FORTRAN_NEEDED="test" +inherit cmake cuda fortran-2 llvm toolchain-funcs + +DESCRIPTION="C++ template library for linear algebra" +HOMEPAGE="https://eigen.tuxfamily.org/index.php?title=Main_Page" + +if [[ ${PV} = *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.com/lib${PN}/${PN}.git" + if [[ ${PV} = 3.4.9999* ]] ; then + EGIT_COMMIT="3.4" + fi +else + SRC_URI=" + https://gitlab.com/lib${PN}/${PN}/-/archive/${PV}/${P}.tar.bz2 + test? ( lapack? ( https://downloads.tuxfamily.org/${PN}/lapack_addons_3.4.1.tgz -> ${PN}-lapack_addons-3.4.1.tgz ) ) + " + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos" +fi + +LICENSE="MPL-2.0" +SLOT="3" + +# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications +ARM_CPU_FEATURES=( + neon:NEON +) +PPC_CPU_FEATURES=( + altivec:ALTIVEC + vsx:VSX +) +X86_CPU_FEATURES=( + avx:AVX + avx2:AVX2 + avx512f:AVX512 + avx512dq:AVX512DQ + f16c:FP16C + fma3:FMA + popcnt:POPCNT + sse:SSE + sse2:SSE2 + sse3:SSE3 + ssse3:SSSE3 + sse4_1:SSE4_1 + sse4_2:SSE4_2 +) +# MIPS_CPU_FEATURES=( +# msa:MSA +# ) +# S390_CPU_FEATURES=( +# z13:Z13 +# z14:Z14 +# ) + +CPU_FEATURES_MAP=( + ${ARM_CPU_FEATURES[@]/#/cpu_flags_arm_} + ${PPC_CPU_FEATURES[@]/#/cpu_flags_ppc_} + ${X86_CPU_FEATURES[@]/#/cpu_flags_x86_} + # ${MIPS_CPU_FEATURES[@]/#/cpu_flags_mips_} + # ${S390_CPU_FEATURES[@]/#/cpu_flags_s390_} +) + +IUSE_TEST_BACKENDS=( + "adolc" + "boost" + "cholmod" + "fftw" + "klu" + "opengl" + "openmp" + "pastix" + "sparsehash" + "spqr" + "superlu" + "umfpack" +) + +IUSE="${CPU_FEATURES_MAP[*]%:*} clang cuda hip debug doc lapack test ${IUSE_TEST_BACKENDS[*]}" #zvector + +# Tests failing again because of compiler issues +RESTRICT="!test? ( test )" + +BDEPEND=" + doc? ( + app-doc/doxygen[dot] + dev-texlive/texlive-bibtexextra + dev-texlive/texlive-fontsextra + dev-texlive/texlive-fontutils + dev-texlive/texlive-latex + dev-texlive/texlive-latexextra + ) + test? ( virtual/pkgconfig ) +" + +# METIS +# MPREAL +# dev-libs/mpfr:0 +# dev-libs/gmp:0 + +TEST_BACKENDS=" + boost? ( dev-libs/boost ) + adolc? ( sci-libs/adolc[sparse] ) + cholmod? ( sci-libs/cholmod:= ) + fftw? ( sci-libs/fftw ) + spqr? ( sci-libs/spqr ) + klu? ( sci-libs/klu ) + opengl? ( + media-libs/freeglut + media-libs/glew + media-libs/libglvnd + ) + pastix? ( sci-libs/pastix[-mpi] ) + sparsehash? ( + amd64? ( dev-cpp/sparsehash ) + arm64? ( dev-cpp/sparsehash ) + ppc64? ( dev-cpp/sparsehash ) + x86? ( dev-cpp/sparsehash ) + ) + superlu? ( sci-libs/superlu ) + umfpack? ( sci-libs/umfpack ) +" +DEPEND=" + test? ( + cuda? ( + !clang? ( + dev-util/nvidia-cuda-toolkit + ) + clang? ( + sys-devel/clang[llvm_targets_NVPTX] + openmp? ( sys-libs/libomp[llvm_targets_NVPTX,offload] ) + ) + ) + hip? ( dev-util/hip ) + lapack? ( virtual/lapacke ) + ${TEST_BACKENDS} + ) +" + +REQUIRED_USE=" + test? ( !lapack ) + || ( ${IUSE_TEST_BACKENDS[*]} ) +" + +PATCHES=( + "${FILESDIR}/${PN}-3.3.9-max-macro.patch" + "${FILESDIR}/${PN}-3.4.0-doc-nocompress.patch" # bug 830064 + "${FILESDIR}/${PN}-3.4.0-buildstring.patch" + "${FILESDIR}/${PN}-3.4.0-noansi.patch" + "${FILESDIR}/${PN}-3.4.0-cxxstandard.patch" +) + +# TODO should be in cuda.eclass +cuda_set_CUDAHOSTCXX() { + local compiler + tc-is-gcc && compiler="gcc" + tc-is-clang && compiler="clang" + [[ -z "$compiler" ]] && die "no compiler specified" + + local package="sys-devel/${compiler}" + local version="${package}" + local CUDAHOSTCXX_test + while + CUDAHOSTCXX="${CUDAHOSTCXX_test}" + version=$(best_version "${version}") + if [[ -z "${version}" ]]; then + if [[ -z "${CUDAHOSTCXX}" ]]; then + die "could not find supported version of ${package}" + fi + break + fi + CUDAHOSTCXX_test="$( + dirname "$( + realpath "$( + which "${compiler}-$(echo "${version}" | grep -oP "(?<=${package}-)[0-9]*")" + )" + )" + )" + version="<${version}" + do ! echo "int main(){}" | nvcc "-ccbin ${CUDAHOSTCXX_test}" - -x cu &>/dev/null; done + + export CUDAHOSTCXX +} + +src_unpack() { + if [[ ${PV} = *9999* ]] ; then + git-r3_src_unpack + else + unpack "${P}.tar.bz2" + + if use test && use lapack; then + cd "${S}/lapack" || die + unpack "${PN}-lapack_addons-3.4.1.tgz" + fi + fi +} + +src_prepare() { + cmake_src_prepare + + cmake_comment_add_subdirectory demos + + if ! use test; then + sed -e "/add_subdirectory(test/s/^/#DONOTCOMPILE /g" \ + -e "/add_subdirectory(blas/s/^/#DONOTCOMPILE /g" \ + -e "/add_subdirectory(lapack/s/^/#DONOTCOMPILE /g" \ + -i CMakeLists.txt || die + fi + +} + +src_configure() { + if use test; then + mycmakeargs+=( + # the OpenGL testsuite is extremely brittle, bug #712808 + -DOpenGL_GL_PREFERENCE="GLVND" + -DEIGEN_TEST_OPENGL="$(usex opengl)" # Enable OpenGL support in unit tests + -DEIGEN_TEST_OPENMP="$(usex openmp)" # Enable/Disable OpenMP in tests/examples + + # needs Qt4 + -DEIGEN_TEST_NOQT=yes # Disable Qt support in unit tests + + -DCMAKE_DISABLE_FIND_PACKAGE_MPREAL=ON + + -DEIGEN_TEST_CXX11=yes + + # -DEIGEN_TEST_CUSTOM_CXX_FLAGS= # Additional compiler flags when compiling unit tests. + # -DEIGEN_TEST_CUSTOM_LINKER_FLAGS= # Additional linker flags when linking unit tests. + # -DEIGEN_TEST_BUILD_FLAGS= # Options passed to the build command of unit tests + + # -DEIGEN_BUILD_BTL=yes # Build benchmark suite + + # -DEIGEN_INTERNAL_DOCUMENTATION=no # Build internal documentation + # -DEIGEN_BUILD_DOC=yes # Enable creation of Eigen documentation + # -DEIGEN_BUILD_PKGCONFIG=yes # Build pkg-config .pc file for Eigen + # -DEIGEN_DOC_USE_MATHJAX=yes # Use MathJax for rendering math in HTML docs + + -DEIGEN_TEST_BUILD_DOCUMENTATION="$(usex doc)" # Test building the doxygen documentation + + # -DEIGEN_COVERAGE_TESTING=no # Enable/disable gcov + # -DEIGEN_CTEST_ERROR_EXCEPTION= # Regular expression for build error messages to be filtered out + # -DEIGEN_DEBUG_ASSERTS=no # Enable advanced debugging of assertions + # -DEIGEN_NO_ASSERTION_CHECKING=no # Disable checking of assertions using exceptions + # -DEIGEN_TEST_NO_EXCEPTIONS=no # Disables C++ exceptions + # -DEIGEN_TEST_NO_EXPLICIT_ALIGNMENT=no # Disable explicit alignment (hence vectorization) in tests/examples + # -DEIGEN_TEST_NO_EXPLICIT_VECTORIZATION=no # Disable explicit vectorization in tests/examples + + # -DEIGEN_DASHBOARD_BUILD_TARGET=buildtests # Target to be built in dashboard mode, default is buildtests + + # -DEIGEN_DEFAULT_TO_ROW_MAJOR=no # Use row-major as default matrix storage order + + # -DEIGEN_TEST_MATRIX_DIR=yes # Enable testing of realword sparse matrices contained in the specified path + # -DEIGEN_TEST_MAX_SIZE=320 # Maximal matrix/vector size, default is 320 + # -DEIGEN_SPLIT_LARGE_TESTS=no # Split large tests into smaller executables + ) + + use !adolc && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Adolc="TRUE" ) + use !boost && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Boost="TRUE" ) + use !cholmod && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_CHOLMOD="TRUE" ) + use !fftw && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_FFTW="TRUE" ) + use !sparsehash && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_GoogleHash="TRUE" ) + use !klu && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KLU="TRUE" ) + use !opengl && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_OpenGL="TRUE" ) + use !openmp && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_OpenMP="TRUE" ) + use !pastix && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_PASTIX="TRUE" ) + use !spqr && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_SPQR="TRUE" ) + use !superlu && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU="TRUE" ) + use !umfpack && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_UMFPACK="TRUE" ) + + if use lapack; then + mycmakeargs+=( + -DEIGEN_ENABLE_LAPACK_TESTS=yes + -DEIGEN_TEST_EXTERNAL_BLAS=yes # Use external BLAS library for testsuite + -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=ON + ) + fi + + if use arm; then + mycmakeargs+=( + -DEIGEN_TEST_NEON="$(usex cpu_flags_arm_neon)" + ) + fi + + if use arm64; then + mycmakeargs+=( + -DEIGEN_TEST_NEON64="$(usex cpu_flags_arm_neon)" + ) + fi + + if use ppc || use ppc64; then + mycmakeargs+=( + -DEIGEN_TEST_ALTIVEC="$(usex cpu_flags_ppc_altivec)" + -DEIGEN_TEST_VSX="$(usex cpu_flags_ppc_vsx)" + ) + fi + + if use amd64 || use x86; then + mycmakeargs+=( + # -DEIGEN_TEST_32BIT=no # Force generating 32bit code. + # -DEIGEN_TEST_X87=no # Force using X87 instructions. Implies no vectorization. + -DEIGEN_TEST_SSE2="$(usex cpu_flags_x86_sse2)" + -DEIGEN_TEST_SSE3="$(usex cpu_flags_x86_sse3)" + -DEIGEN_TEST_SSSE3="$(usex cpu_flags_x86_ssse3)" + -DEIGEN_TEST_FMA="$(usex cpu_flags_x86_fma3)" + -DEIGEN_TEST_SSE4_1="$(usex cpu_flags_x86_sse4_1)" + -DEIGEN_TEST_SSE4_2="$(usex cpu_flags_x86_sse4_2)" + -DEIGEN_TEST_AVX="$(usex cpu_flags_x86_avx)" + -DEIGEN_TEST_F16C="$(usex cpu_flags_x86_f16c)" + -DEIGEN_TEST_AVX2="$(usex cpu_flags_x86_avx2)" + -DEIGEN_TEST_AVX512="$(usex cpu_flags_x86_avx512f)" + -DEIGEN_TEST_AVX512DQ="$(usex cpu_flags_x86_avx512dq)" + ) + fi + + if use mips; then + mycmakeargs+=( + # -DEIGEN_TEST_MSA=no # Enable/Disable MSA in tests/examples + ) + fi + + if use s390; then + mycmakeargs+=( + # -DEIGEN_TEST_Z13=no # Enable/Disable S390X(zEC13) ZVECTOR in tests/examples + # -DEIGEN_TEST_Z14=no # Enable/Disable S390X(zEC14) ZVECTOR in tests/examples + ) + fi + + mycmakeargs+=( + -DEIGEN_TEST_CUDA="$(usex cuda)" # Enable CUDA support in unit tests + -DEIGEN_TEST_CUDA_CLANG="$(usex cuda "$(usex clang)")" # Use clang instead of nvcc to compile the CUDA tests + + -DEIGEN_TEST_HIP="$(usex hip)" # Add HIP support. + + # -DEIGEN_TEST_SYCL=no # Add Sycl support. + # -DEIGEN_SYCL_TRISYCL=no # Use the triSYCL Sycl implementation (ComputeCPP by default). + ) + + if use cuda; then + cuda_add_sandbox -w + export CUDAFLAGS="${NVCCFLAGS}" + if use clang; then + local llvm_prefix + llvm_prefix="$(get_llvm_prefix -b)" + export CC="${llvm_prefix}/bin/clang" + export CXX="${llvm_prefix}/bin/clang++" + else + cuda_set_CUDAHOSTCXX + mycmakeargs+=( + -DCUDA_HOST_COMPILER="${CUDAHOSTCXX}" + ) + fi + if [[ "${CUDA_VERBOSE}" == true ]]; then + mycmakeargs+=( + -DCUDA_VERBOSE_BUILD=yes + ) + NVCCFLAGS+=" -v" + fi + + [[ -z "${CUDAARCHS}" ]] && einfo "trying to determine host CUDAARCHS" + : "${CUDAARCHS:=$(__nvcc_device_query)}" + export CUDAARCHS + + mycmakeargs+=( + -DEIGEN_CUDA_COMPUTE_ARCH="${CUDAARCHS}" + ) + fi + fi + + cmake_src_configure +} + +src_compile() { + local targets=() + if use doc; then + targets+=( doc ) + HTML_DOCS=( "${BUILD_DIR}"/doc/html/. ) + fi + if use test; then + targets+=( buildtests ) + if ! use lapack; then + targets+=( blas ) + fi + # tests generate random data, which + # obviously fails for some seeds + export EIGEN_SEED=712808 + fi + + if use doc || use test; then + cmake_src_compile "${targets[@]}" + fi +} + +src_test() { + CMAKE_SKIP_TESTS=( + product_small_32 # 143 (Subprocess aborted) + product_small_33 # 144 (Subprocess aborted) + + eigensolver_selfadjoint_13 # 452 (Subprocess aborted) + + cholmod_support_21 # 726 (Subprocess aborted) + cholmod_support_22 # 727 (Subprocess aborted) + + NonLinearOptimization # 930 (Subprocess aborted) + openglsupport # 990 (Failed) + levenberg_marquardt # 1020 (Subprocess aborted) + ) + + if use cuda ; then + cuda_add_sandbox -w + + CMAKE_SKIP_TESTS+=( + cxx11_tensor_cast_float16_gpu + cxx11_tensor_gpu_5 + ) + fi + + if use lapack ; then + CMAKE_SKIP_TESTS+=( + "^LAPACK-.*$" + ) + fi + + local myctestargs=( + -j1 # otherwise breaks due to cmake reruns + ) + + cmake_src_test +} diff --git a/dev-cpp/eigen/eigen-3.4.9999.ebuild b/dev-cpp/eigen/eigen-3.4.9999.ebuild new file mode 100644 index 000000000000..d58e3b110010 --- /dev/null +++ b/dev-cpp/eigen/eigen-3.4.9999.ebuild @@ -0,0 +1,409 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +FORTRAN_NEEDED="test" +inherit cmake cuda fortran-2 llvm toolchain-funcs + +DESCRIPTION="C++ template library for linear algebra" +HOMEPAGE="https://eigen.tuxfamily.org/index.php?title=Main_Page" + +if [[ ${PV} = *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.com/lib${PN}/${PN}.git" + if [[ ${PV} = 3.4.9999* ]] ; then + EGIT_COMMIT="3.4" + fi +else + SRC_URI=" + https://gitlab.com/lib${PN}/${PN}/-/archive/${PV}/${P}.tar.bz2 + test? ( lapack? ( https://downloads.tuxfamily.org/${PN}/lapack_addons_3.4.1.tgz -> ${PN}-lapack_addons-3.4.1.tgz ) ) + " + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos" +fi + +LICENSE="MPL-2.0" +SLOT="3" + +# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications +ARM_CPU_FEATURES=( + neon:NEON +) +PPC_CPU_FEATURES=( + altivec:ALTIVEC + vsx:VSX +) +X86_CPU_FEATURES=( + avx:AVX + avx2:AVX2 + avx512f:AVX512 + avx512dq:AVX512DQ + f16c:FP16C + fma3:FMA + popcnt:POPCNT + sse:SSE + sse2:SSE2 + sse3:SSE3 + ssse3:SSSE3 + sse4_1:SSE4_1 + sse4_2:SSE4_2 +) +# MIPS_CPU_FEATURES=( +# msa:MSA +# ) +# S390_CPU_FEATURES=( +# z13:Z13 +# z14:Z14 +# ) + +CPU_FEATURES_MAP=( + ${ARM_CPU_FEATURES[@]/#/cpu_flags_arm_} + ${PPC_CPU_FEATURES[@]/#/cpu_flags_ppc_} + ${X86_CPU_FEATURES[@]/#/cpu_flags_x86_} + # ${MIPS_CPU_FEATURES[@]/#/cpu_flags_mips_} + # ${S390_CPU_FEATURES[@]/#/cpu_flags_s390_} +) + +IUSE_TEST_BACKENDS=( + "adolc" + "boost" + "cholmod" + "fftw" + "klu" + "opengl" + "openmp" + "pastix" + "sparsehash" + "spqr" + "superlu" + "umfpack" +) + +IUSE="benchmark ${CPU_FEATURES_MAP[*]%:*} clang cuda hip debug doc lapack test ${IUSE_TEST_BACKENDS[*]}" #zvector + +# Tests failing again because of compiler issues +RESTRICT="!test? ( test )" + +BDEPEND=" + doc? ( + app-doc/doxygen[dot] + dev-texlive/texlive-bibtexextra + dev-texlive/texlive-fontsextra + dev-texlive/texlive-fontutils + dev-texlive/texlive-latex + dev-texlive/texlive-latexextra + ) + test? ( virtual/pkgconfig ) +" + +# METIS +# MPREAL +# dev-libs/mpfr:0 +# dev-libs/gmp:0 + +TEST_BACKENDS=" + boost? ( dev-libs/boost ) + adolc? ( sci-libs/adolc[sparse] ) + cholmod? ( sci-libs/cholmod:= ) + fftw? ( sci-libs/fftw ) + spqr? ( sci-libs/spqr ) + klu? ( sci-libs/klu ) + opengl? ( + media-libs/freeglut + media-libs/glew + media-libs/libglvnd + ) + pastix? ( sci-libs/pastix[-mpi] ) + sparsehash? ( + amd64? ( dev-cpp/sparsehash ) + arm64? ( dev-cpp/sparsehash ) + ppc64? ( dev-cpp/sparsehash ) + x86? ( dev-cpp/sparsehash ) + ) + superlu? ( sci-libs/superlu ) + umfpack? ( sci-libs/umfpack ) +" +DEPEND=" + test? ( + cuda? ( + !clang? ( + dev-util/nvidia-cuda-toolkit + ) + clang? ( + sys-devel/clang[llvm_targets_NVPTX] + openmp? ( sys-libs/libomp[llvm_targets_NVPTX,offload] ) + ) + ) + hip? ( dev-util/hip ) + lapack? ( virtual/lapacke ) + ${TEST_BACKENDS} + ) +" + +REQUIRED_USE=" + || ( ${IUSE_TEST_BACKENDS[*]} ) +" + +PATCHES=( + "${FILESDIR}/${PN}-3.3.9-max-macro.patch" + "${FILESDIR}/${PN}-3.4.0-doc-nocompress.patch" # bug 830064 + "${FILESDIR}/${PN}-3.4.0-buildstring.patch" + "${FILESDIR}/${PN}-3.4.0-noansi.patch" + "${FILESDIR}/${PN}-3.4.0-cxxstandard.patch" +) + +# TODO should be in cuda.eclass +cuda_set_CUDAHOSTCXX() { + local compiler + tc-is-gcc && compiler="gcc" + tc-is-clang && compiler="clang" + [[ -z "$compiler" ]] && die "no compiler specified" + + local package="sys-devel/${compiler}" + local version="${package}" + local CUDAHOSTCXX_test + while + CUDAHOSTCXX="${CUDAHOSTCXX_test}" + version=$(best_version "${version}") + if [[ -z "${version}" ]]; then + if [[ -z "${CUDAHOSTCXX}" ]]; then + die "could not find supported version of ${package}" + fi + break + fi + CUDAHOSTCXX_test="$( + dirname "$( + realpath "$( + which "${compiler}-$(echo "${version}" | grep -oP "(?<=${package}-)[0-9]*")" + )" + )" + )" + version="<${version}" + do ! echo "int main(){}" | nvcc "-ccbin ${CUDAHOSTCXX_test}" - -x cu &>/dev/null; done + + export CUDAHOSTCXX +} + +src_unpack() { + if [[ ${PV} = *9999* ]] ; then + git-r3_src_unpack + else + unpack "${P}.tar.bz2" + + if use test && use lapack; then + cd "${S}/lapack" || die + unpack "${PN}-lapack_addons-3.4.1.tgz" + fi + fi +} + +src_prepare() { + cmake_src_prepare + + cmake_comment_add_subdirectory demos + + if ! use test; then + sed -e "/add_subdirectory(test/s/^/#DONOTCOMPILE /g" \ + -e "/add_subdirectory(blas/s/^/#DONOTCOMPILE /g" \ + -e "/add_subdirectory(lapack/s/^/#DONOTCOMPILE /g" \ + -i CMakeLists.txt || die + fi + +} + +src_configure() { + local mycmakeargs=( + -DEIGEN_BUILD_BTL="$(usex benchmark)" + ) + if use test; then + mycmakeargs+=( + # the OpenGL testsuite is extremely brittle, bug #712808 + -DOpenGL_GL_PREFERENCE="GLVND" + -DEIGEN_TEST_OPENGL="$(usex opengl)" # Enable OpenGL support in unit tests + -DEIGEN_TEST_OPENMP="$(usex openmp)" # Enable/Disable OpenMP in tests/examples + + # needs Qt4 + -DEIGEN_TEST_NOQT=yes # Disable Qt support in unit tests + + -DCMAKE_DISABLE_FIND_PACKAGE_MPREAL=ON + + -DEIGEN_TEST_CXX11=yes + + # -DEIGEN_TEST_CUSTOM_CXX_FLAGS= # Additional compiler flags when compiling unit tests. + # -DEIGEN_TEST_CUSTOM_LINKER_FLAGS= # Additional linker flags when linking unit tests. + # -DEIGEN_TEST_BUILD_FLAGS= # Options passed to the build command of unit tests + + # -DEIGEN_BUILD_BTL=yes # Build benchmark suite + + # -DEIGEN_INTERNAL_DOCUMENTATION=no # Build internal documentation + # -DEIGEN_BUILD_DOC=yes # Enable creation of Eigen documentation + # -DEIGEN_BUILD_PKGCONFIG=yes # Build pkg-config .pc file for Eigen + # -DEIGEN_DOC_USE_MATHJAX=yes # Use MathJax for rendering math in HTML docs + + -DEIGEN_TEST_BUILD_DOCUMENTATION="$(usex doc)" # Test building the doxygen documentation + + # -DEIGEN_COVERAGE_TESTING=no # Enable/disable gcov + # -DEIGEN_CTEST_ERROR_EXCEPTION= # Regular expression for build error messages to be filtered out + # -DEIGEN_DEBUG_ASSERTS=no # Enable advanced debugging of assertions + # -DEIGEN_NO_ASSERTION_CHECKING=no # Disable checking of assertions using exceptions + # -DEIGEN_TEST_NO_EXCEPTIONS=no # Disables C++ exceptions + # -DEIGEN_TEST_NO_EXPLICIT_ALIGNMENT=no # Disable explicit alignment (hence vectorization) in tests/examples + # -DEIGEN_TEST_NO_EXPLICIT_VECTORIZATION=no # Disable explicit vectorization in tests/examples + + # -DEIGEN_DASHBOARD_BUILD_TARGET=buildtests # Target to be built in dashboard mode, default is buildtests + + # -DEIGEN_DEFAULT_TO_ROW_MAJOR=no # Use row-major as default matrix storage order + + # -DEIGEN_TEST_MATRIX_DIR=yes # Enable testing of realword sparse matrices contained in the specified path + # -DEIGEN_TEST_MAX_SIZE=320 # Maximal matrix/vector size, default is 320 + # -DEIGEN_SPLIT_LARGE_TESTS=no # Split large tests into smaller executables + ) + + use !adolc && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Adolc="TRUE" ) + use !boost && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Boost="TRUE" ) + use !cholmod && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_CHOLMOD="TRUE" ) + use !fftw && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_FFTW="TRUE" ) + use !sparsehash && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_GoogleHash="TRUE" ) + use !klu && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KLU="TRUE" ) + use !opengl && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_OpenGL="TRUE" ) + use !openmp && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_OpenMP="TRUE" ) + use !pastix && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_PASTIX="TRUE" ) + use !spqr && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_SPQR="TRUE" ) + use !superlu && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU="TRUE" ) + use !umfpack && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_UMFPACK="TRUE" ) + + if use lapack; then + mycmakeargs+=( + -DEIGEN_ENABLE_LAPACK_TESTS=yes + -DEIGEN_TEST_EXTERNAL_BLAS=yes # Use external BLAS library for testsuite + -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=ON + ) + fi + + if use arm; then + mycmakeargs+=( + -DEIGEN_TEST_NEON="$(usex cpu_flags_arm_neon)" + ) + fi + + if use arm64; then + mycmakeargs+=( + -DEIGEN_TEST_NEON64="$(usex cpu_flags_arm_neon)" + ) + fi + + if use ppc || use ppc64; then + mycmakeargs+=( + -DEIGEN_TEST_ALTIVEC="$(usex cpu_flags_ppc_altivec)" + -DEIGEN_TEST_VSX="$(usex cpu_flags_ppc_vsx)" + ) + fi + + if use amd64 || use x86; then + mycmakeargs+=( + # -DEIGEN_TEST_32BIT=no # Force generating 32bit code. + # -DEIGEN_TEST_X87=no # Force using X87 instructions. Implies no vectorization. + -DEIGEN_TEST_SSE2="$(usex cpu_flags_x86_sse2)" + -DEIGEN_TEST_SSE3="$(usex cpu_flags_x86_sse3)" + -DEIGEN_TEST_SSSE3="$(usex cpu_flags_x86_ssse3)" + -DEIGEN_TEST_FMA="$(usex cpu_flags_x86_fma3)" + -DEIGEN_TEST_SSE4_1="$(usex cpu_flags_x86_sse4_1)" + -DEIGEN_TEST_SSE4_2="$(usex cpu_flags_x86_sse4_2)" + -DEIGEN_TEST_AVX="$(usex cpu_flags_x86_avx)" + -DEIGEN_TEST_F16C="$(usex cpu_flags_x86_f16c)" + -DEIGEN_TEST_AVX2="$(usex cpu_flags_x86_avx2)" + -DEIGEN_TEST_AVX512="$(usex cpu_flags_x86_avx512f)" + -DEIGEN_TEST_AVX512DQ="$(usex cpu_flags_x86_avx512dq)" + ) + fi + + if use mips; then + mycmakeargs+=( + # -DEIGEN_TEST_MSA=no # Enable/Disable MSA in tests/examples + ) + fi + + if use s390; then + mycmakeargs+=( + # -DEIGEN_TEST_Z13=no # Enable/Disable S390X(zEC13) ZVECTOR in tests/examples + # -DEIGEN_TEST_Z14=no # Enable/Disable S390X(zEC14) ZVECTOR in tests/examples + ) + fi + + mycmakeargs+=( + -DEIGEN_TEST_CUDA="$(usex cuda)" # Enable CUDA support in unit tests + -DEIGEN_TEST_CUDA_CLANG="$(usex cuda "$(usex clang)")" # Use clang instead of nvcc to compile the CUDA tests + + -DEIGEN_TEST_HIP="$(usex hip)" # Add HIP support. + + # -DEIGEN_TEST_SYCL=no # Add Sycl support. + # -DEIGEN_SYCL_TRISYCL=no # Use the triSYCL Sycl implementation (ComputeCPP by default). + ) + + if use cuda; then + cuda_add_sandbox -w + export CUDAFLAGS="${NVCCFLAGS}" + if use clang; then + local llvm_prefix + llvm_prefix="$(get_llvm_prefix -b)" + export CC="${llvm_prefix}/bin/clang" + export CXX="${llvm_prefix}/bin/clang++" + else + cuda_set_CUDAHOSTCXX + mycmakeargs+=( + -DCUDA_HOST_COMPILER="${CUDAHOSTCXX}" + ) + fi + if [[ "${CUDA_VERBOSE}" == true ]]; then + mycmakeargs+=( + -DCUDA_VERBOSE_BUILD=yes + ) + NVCCFLAGS+=" -v" + fi + + [[ -z "${CUDAARCHS}" ]] && einfo "trying to determine host CUDAARCHS" + : "${CUDAARCHS:=$(__nvcc_device_query)}" + export CUDAARCHS + + mycmakeargs+=( + -DEIGEN_CUDA_COMPUTE_ARCH="${CUDAARCHS}" + ) + fi + fi + + cmake_src_configure +} + +src_compile() { + local targets=() + if use doc; then + targets+=( doc ) + HTML_DOCS=( "${BUILD_DIR}"/doc/html/. ) + fi + if use test; then + targets+=( buildtests ) + if ! use lapack; then + targets+=( blas ) + fi + # tests generate random data, which + # obviously fails for some seeds + export EIGEN_SEED=712808 + fi + + if use doc || use test; then + cmake_src_compile "${targets[@]}" + fi +} + +src_test() { + if use cuda ; then + cuda_add_sandbox -w + fi + + local myctestargs=( + -j1 # otherwise breaks due to cmake reruns + ) + + cmake_src_test +} diff --git a/dev-cpp/eigen/eigen-9999.ebuild b/dev-cpp/eigen/eigen-9999.ebuild new file mode 100644 index 000000000000..c622dd3a94bf --- /dev/null +++ b/dev-cpp/eigen/eigen-9999.ebuild @@ -0,0 +1,405 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +FORTRAN_NEEDED="test" +inherit cmake cuda fortran-2 llvm toolchain-funcs + +DESCRIPTION="C++ template library for linear algebra" +HOMEPAGE="https://eigen.tuxfamily.org/index.php?title=Main_Page" + +if [[ ${PV} = *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.com/lib${PN}/${PN}.git" + if [[ ${PV} = 3.4.9999* ]] ; then + EGIT_COMMIT="3.4" + fi +else + SRC_URI=" + https://gitlab.com/lib${PN}/${PN}/-/archive/${PV}/${P}.tar.bz2 + test? ( lapack? ( https://downloads.tuxfamily.org/${PN}/lapack_addons_3.4.1.tgz -> ${PN}-lapack_addons-3.4.1.tgz ) ) + " + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos" +fi + +LICENSE="MPL-2.0" +SLOT="3" + +# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications +ARM_CPU_FEATURES=( + neon:NEON +) +PPC_CPU_FEATURES=( + altivec:ALTIVEC + vsx:VSX +) +X86_CPU_FEATURES=( + avx:AVX + avx2:AVX2 + avx512f:AVX512 + avx512dq:AVX512DQ + f16c:FP16C + fma3:FMA + popcnt:POPCNT + sse:SSE + sse2:SSE2 + sse3:SSE3 + ssse3:SSSE3 + sse4_1:SSE4_1 + sse4_2:SSE4_2 +) +# MIPS_CPU_FEATURES=( +# msa:MSA +# ) +# S390_CPU_FEATURES=( +# z13:Z13 +# z14:Z14 +# ) + +CPU_FEATURES_MAP=( + ${ARM_CPU_FEATURES[@]/#/cpu_flags_arm_} + ${PPC_CPU_FEATURES[@]/#/cpu_flags_ppc_} + ${X86_CPU_FEATURES[@]/#/cpu_flags_x86_} + # ${MIPS_CPU_FEATURES[@]/#/cpu_flags_mips_} + # ${S390_CPU_FEATURES[@]/#/cpu_flags_s390_} +) + +IUSE_TEST_BACKENDS=( + "adolc" + "boost" + "cholmod" + "fftw" + "klu" + "opengl" + "openmp" + "pastix" + "sparsehash" + "spqr" + "superlu" + "umfpack" +) + +IUSE="benchmark ${CPU_FEATURES_MAP[*]%:*} clang cuda hip debug doc lapack test ${IUSE_TEST_BACKENDS[*]}" #zvector + +# Tests failing again because of compiler issues +RESTRICT="!test? ( test )" + +BDEPEND=" + doc? ( + app-doc/doxygen[dot] + dev-texlive/texlive-bibtexextra + dev-texlive/texlive-fontsextra + dev-texlive/texlive-fontutils + dev-texlive/texlive-latex + dev-texlive/texlive-latexextra + ) + test? ( virtual/pkgconfig ) +" + +# METIS +# MPREAL +# dev-libs/mpfr:0 +# dev-libs/gmp:0 + +TEST_BACKENDS=" + boost? ( dev-libs/boost ) + adolc? ( sci-libs/adolc[sparse] ) + cholmod? ( sci-libs/cholmod:= ) + fftw? ( sci-libs/fftw ) + spqr? ( sci-libs/spqr ) + klu? ( sci-libs/klu ) + opengl? ( + media-libs/freeglut + media-libs/glew + media-libs/libglvnd + ) + pastix? ( sci-libs/pastix[-mpi] ) + sparsehash? ( + amd64? ( dev-cpp/sparsehash ) + arm64? ( dev-cpp/sparsehash ) + ppc64? ( dev-cpp/sparsehash ) + x86? ( dev-cpp/sparsehash ) + ) + superlu? ( sci-libs/superlu ) + umfpack? ( sci-libs/umfpack ) +" +DEPEND=" + test? ( + cuda? ( + !clang? ( + dev-util/nvidia-cuda-toolkit + ) + clang? ( + sys-devel/clang[llvm_targets_NVPTX] + openmp? ( sys-libs/libomp[llvm_targets_NVPTX,offload] ) + ) + ) + hip? ( dev-util/hip ) + lapack? ( virtual/lapacke ) + ${TEST_BACKENDS} + ) +" + +REQUIRED_USE=" + || ( ${IUSE_TEST_BACKENDS[*]} ) +" + +PATCHES=( + "${FILESDIR}/${PN}-3.4.0-doc-nocompress.patch" # bug 830064 + "${FILESDIR}/${PN}-3.4.0-buildstring.patch" + "${FILESDIR}/${PN}-9999-please_protect_your_min_with_parentheses.patch" +) + +# TODO should be in cuda.eclass +cuda_set_CUDAHOSTCXX() { + local compiler + tc-is-gcc && compiler="gcc" + tc-is-clang && compiler="clang" + [[ -z "$compiler" ]] && die "no compiler specified" + + local package="sys-devel/${compiler}" + local version="${package}" + local CUDAHOSTCXX_test + while + CUDAHOSTCXX="${CUDAHOSTCXX_test}" + version=$(best_version "${version}") + if [[ -z "${version}" ]]; then + if [[ -z "${CUDAHOSTCXX}" ]]; then + die "could not find supported version of ${package}" + fi + break + fi + CUDAHOSTCXX_test="$( + dirname "$( + realpath "$( + which "${compiler}-$(echo "${version}" | grep -oP "(?<=${package}-)[0-9]*")" + )" + )" + )" + version="<${version}" + do ! echo "int main(){}" | nvcc "-ccbin ${CUDAHOSTCXX_test}" - -x cu &>/dev/null; done + + export CUDAHOSTCXX +} + +src_unpack() { + if [[ ${PV} = *9999* ]] ; then + git-r3_src_unpack + else + unpack "${P}.tar.bz2" + + if use test && use lapack; then + cd "${S}/lapack" || die + unpack "${PN}-lapack_addons-3.4.1.tgz" + fi + fi +} + +src_prepare() { + cmake_src_prepare + + cmake_comment_add_subdirectory demos + + if ! use test; then + sed -e "/add_subdirectory(test/s/^/#DONOTCOMPILE /g" \ + -e "/add_subdirectory(blas/s/^/#DONOTCOMPILE /g" \ + -e "/add_subdirectory(lapack/s/^/#DONOTCOMPILE /g" \ + -i CMakeLists.txt || die + fi + +} + +src_configure() { + local mycmakeargs=( + -DEIGEN_BUILD_BTL="$(usex benchmark)" + ) + if use test; then + mycmakeargs+=( + # the OpenGL testsuite is extremely brittle, bug #712808 + -DOpenGL_GL_PREFERENCE="GLVND" + -DEIGEN_TEST_OPENGL="$(usex opengl)" # Enable OpenGL support in unit tests + -DEIGEN_TEST_OPENMP="$(usex openmp)" # Enable/Disable OpenMP in tests/examples + + # needs Qt4 + -DEIGEN_TEST_NOQT=yes # Disable Qt support in unit tests + + -DCMAKE_DISABLE_FIND_PACKAGE_MPREAL=ON + + # -DEIGEN_TEST_CUSTOM_CXX_FLAGS= # Additional compiler flags when compiling unit tests. + # -DEIGEN_TEST_CUSTOM_LINKER_FLAGS= # Additional linker flags when linking unit tests. + # -DEIGEN_TEST_BUILD_FLAGS= # Options passed to the build command of unit tests + + # -DEIGEN_BUILD_BTL=yes # Build benchmark suite + + # -DEIGEN_INTERNAL_DOCUMENTATION=no # Build internal documentation + # -DEIGEN_BUILD_DOC=yes # Enable creation of Eigen documentation + # -DEIGEN_BUILD_PKGCONFIG=yes # Build pkg-config .pc file for Eigen + # -DEIGEN_DOC_USE_MATHJAX=yes # Use MathJax for rendering math in HTML docs + + -DEIGEN_TEST_BUILD_DOCUMENTATION="$(usex doc)" # Test building the doxygen documentation + + # -DEIGEN_COVERAGE_TESTING=no # Enable/disable gcov + # -DEIGEN_CTEST_ERROR_EXCEPTION= # Regular expression for build error messages to be filtered out + # -DEIGEN_DEBUG_ASSERTS=no # Enable advanced debugging of assertions + # -DEIGEN_NO_ASSERTION_CHECKING=no # Disable checking of assertions using exceptions + # -DEIGEN_TEST_NO_EXCEPTIONS=no # Disables C++ exceptions + # -DEIGEN_TEST_NO_EXPLICIT_ALIGNMENT=no # Disable explicit alignment (hence vectorization) in tests/examples + # -DEIGEN_TEST_NO_EXPLICIT_VECTORIZATION=no # Disable explicit vectorization in tests/examples + + # -DEIGEN_DASHBOARD_BUILD_TARGET=buildtests # Target to be built in dashboard mode, default is buildtests + + # -DEIGEN_DEFAULT_TO_ROW_MAJOR=no # Use row-major as default matrix storage order + + # -DEIGEN_TEST_MATRIX_DIR=yes # Enable testing of realword sparse matrices contained in the specified path + # -DEIGEN_TEST_MAX_SIZE=320 # Maximal matrix/vector size, default is 320 + # -DEIGEN_SPLIT_LARGE_TESTS=no # Split large tests into smaller executables + ) + + use !adolc && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Adolc="TRUE" ) + use !boost && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Boost="TRUE" ) + use !cholmod && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_CHOLMOD="TRUE" ) + use !fftw && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_FFTW="TRUE" ) + use !sparsehash && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_GoogleHash="TRUE" ) + use !klu && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KLU="TRUE" ) + use !opengl && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_OpenGL="TRUE" ) + use !openmp && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_OpenMP="TRUE" ) + use !pastix && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_PASTIX="TRUE" ) + use !spqr && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_SPQR="TRUE" ) + use !superlu && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU="TRUE" ) + use !umfpack && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_UMFPACK="TRUE" ) + + if use lapack; then + mycmakeargs+=( + -DEIGEN_ENABLE_LAPACK_TESTS=yes + -DEIGEN_TEST_EXTERNAL_BLAS=yes # Use external BLAS library for testsuite + -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=ON + ) + fi + + if use arm; then + mycmakeargs+=( + -DEIGEN_TEST_NEON="$(usex cpu_flags_arm_neon)" + ) + fi + + if use arm64; then + mycmakeargs+=( + -DEIGEN_TEST_NEON64="$(usex cpu_flags_arm_neon)" + ) + fi + + if use ppc || use ppc64; then + mycmakeargs+=( + -DEIGEN_TEST_ALTIVEC="$(usex cpu_flags_ppc_altivec)" + -DEIGEN_TEST_VSX="$(usex cpu_flags_ppc_vsx)" + ) + fi + + if use amd64 || use x86; then + mycmakeargs+=( + # -DEIGEN_TEST_32BIT=no # Force generating 32bit code. + # -DEIGEN_TEST_X87=no # Force using X87 instructions. Implies no vectorization. + -DEIGEN_TEST_SSE2="$(usex cpu_flags_x86_sse2)" + -DEIGEN_TEST_SSE3="$(usex cpu_flags_x86_sse3)" + -DEIGEN_TEST_SSSE3="$(usex cpu_flags_x86_ssse3)" + -DEIGEN_TEST_FMA="$(usex cpu_flags_x86_fma3)" + -DEIGEN_TEST_SSE4_1="$(usex cpu_flags_x86_sse4_1)" + -DEIGEN_TEST_SSE4_2="$(usex cpu_flags_x86_sse4_2)" + -DEIGEN_TEST_AVX="$(usex cpu_flags_x86_avx)" + -DEIGEN_TEST_F16C="$(usex cpu_flags_x86_f16c)" + -DEIGEN_TEST_AVX2="$(usex cpu_flags_x86_avx2)" + -DEIGEN_TEST_AVX512="$(usex cpu_flags_x86_avx512f)" + -DEIGEN_TEST_AVX512DQ="$(usex cpu_flags_x86_avx512dq)" + ) + fi + + if use mips; then + mycmakeargs+=( + # -DEIGEN_TEST_MSA=no # Enable/Disable MSA in tests/examples + ) + fi + + if use s390; then + mycmakeargs+=( + # -DEIGEN_TEST_Z13=no # Enable/Disable S390X(zEC13) ZVECTOR in tests/examples + # -DEIGEN_TEST_Z14=no # Enable/Disable S390X(zEC14) ZVECTOR in tests/examples + ) + fi + + mycmakeargs+=( + -DEIGEN_TEST_CUDA="$(usex cuda)" # Enable CUDA support in unit tests + -DEIGEN_TEST_CUDA_CLANG="$(usex cuda "$(usex clang)")" # Use clang instead of nvcc to compile the CUDA tests + + -DEIGEN_TEST_HIP="$(usex hip)" # Add HIP support. + + # -DEIGEN_TEST_SYCL=no # Add Sycl support. + # -DEIGEN_SYCL_TRISYCL=no # Use the triSYCL Sycl implementation (ComputeCPP by default). + ) + + if use cuda; then + cuda_add_sandbox -w + export CUDAFLAGS="${NVCCFLAGS}" + if use clang; then + local llvm_prefix + llvm_prefix="$(get_llvm_prefix -b)" + export CC="${llvm_prefix}/bin/clang" + export CXX="${llvm_prefix}/bin/clang++" + else + cuda_set_CUDAHOSTCXX + mycmakeargs+=( + -DCUDA_HOST_COMPILER="${CUDAHOSTCXX}" + ) + fi + if [[ "${CUDA_VERBOSE}" == true ]]; then + mycmakeargs+=( + -DCUDA_VERBOSE_BUILD=yes + ) + NVCCFLAGS+=" -v" + fi + + [[ -z "${CUDAARCHS}" ]] && einfo "trying to determine host CUDAARCHS" + : "${CUDAARCHS:=$(__nvcc_device_query)}" + export CUDAARCHS + + mycmakeargs+=( + -DEIGEN_CUDA_COMPUTE_ARCH="${CUDAARCHS}" + ) + fi + fi + + cmake_src_configure +} + +src_compile() { + local targets=() + if use doc; then + targets+=( doc ) + HTML_DOCS=( "${BUILD_DIR}"/doc/html/. ) + fi + if use test; then + targets+=( buildtests ) + # if ! use lapack; then + # targets+=( blas ) + # fi + # tests generate random data, which + # obviously fails for some seeds + export EIGEN_SEED=712808 + fi + + if use doc || use test; then + cmake_src_compile "${targets[@]}" + fi +} + +src_test() { + if use cuda ; then + cuda_add_sandbox -w + fi + + local myctestargs=( + -j1 # otherwise breaks due to cmake reruns + ) + + cmake_src_test +} diff --git a/dev-cpp/eigen/files/eigen-3.4.0-buildstring.patch b/dev-cpp/eigen/files/eigen-3.4.0-buildstring.patch new file mode 100644 index 000000000000..cb3671dc0100 --- /dev/null +++ b/dev-cpp/eigen/files/eigen-3.4.0-buildstring.patch @@ -0,0 +1,27 @@ +--- a/cmake/EigenTesting.cmake ++++ b/cmake/EigenTesting.cmake +@@ -559,14 +559,22 @@ macro(ei_get_cxxflags VAR) + set(${VAR} VSX) + elseif(EIGEN_TEST_ALTIVEC) + set(${VAR} ALVEC) +- elseif(EIGEN_TEST_FMA) +- set(${VAR} FMA) ++ elseif(EIGEN_TEST_AVX512DQ) ++ set(${VAR} AVX512DQ) ++ elseif(EIGEN_TEST_AVX512) ++ set(${VAR} AVX512) ++ elseif(EIGEN_TEST_AVX2) ++ set(${VAR} AVX2) ++ elseif(EIGEN_TEST_F16C) ++ set(${VAR} F16C) + elseif(EIGEN_TEST_AVX) + set(${VAR} AVX) + elseif(EIGEN_TEST_SSE4_2) + set(${VAR} SSE42) + elseif(EIGEN_TEST_SSE4_1) + set(${VAR} SSE41) ++ elseif(EIGEN_TEST_FMA) ++ set(${VAR} FMA) + elseif(EIGEN_TEST_SSSE3) + set(${VAR} SSSE3) + elseif(EIGEN_TEST_SSE3) diff --git a/dev-cpp/eigen/files/eigen-3.4.0-cxxstandard.patch b/dev-cpp/eigen/files/eigen-3.4.0-cxxstandard.patch new file mode 100644 index 000000000000..826aa78d05aa --- /dev/null +++ b/dev-cpp/eigen/files/eigen-3.4.0-cxxstandard.patch @@ -0,0 +1,108 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -74,19 +74,9 @@ macro(ei_add_cxx_compiler_flag FLAG) + endif() + endmacro() + +-check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11) +- +-if(EIGEN_TEST_CXX11) +- set(CMAKE_CXX_STANDARD 11) +- set(CMAKE_CXX_EXTENSIONS OFF) +- if(EIGEN_COMPILER_SUPPORT_CPP11) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +- endif() +-else() +- #set(CMAKE_CXX_STANDARD 03) +- #set(CMAKE_CXX_EXTENSIONS OFF) +- ei_add_cxx_compiler_flag("-std=c++03") +-endif() ++set(CMAKE_CXX_STANDARD 14) ++set(CMAKE_CXX_STANDARD_REQUIRED TRUE) ++set(CMAKE_CXX_EXTENSIONS OFF) + + # Determine if we should build shared libraries on this platform. + get_cmake_property(EIGEN_BUILD_SHARED_LIBS TARGET_SUPPORTS_SHARED_LIBS) +@@ -157,7 +157,6 @@ if(NOT MSVC) + ei_add_cxx_compiler_flag("-Wshorten-64-to-32") + ei_add_cxx_compiler_flag("-Wlogical-op") + ei_add_cxx_compiler_flag("-Wenum-conversion") +- ei_add_cxx_compiler_flag("-Wc++11-extensions") + ei_add_cxx_compiler_flag("-Wdouble-promotion") + # ei_add_cxx_compiler_flag("-Wconversion") + +--- a/Eigen/src/Core/util/Macros.h ++++ b/Eigen/src/Core/util/Macros.h +@@ -37,7 +37,7 @@ + // Expected values are 03, 11, 14, 17, etc. + // By default, let's use an arbitrarily large C++ version. + #ifndef EIGEN_MAX_CPP_VER +-#define EIGEN_MAX_CPP_VER 99 ++#define EIGEN_MAX_CPP_VER 14 + #endif + + /** Allows to disable some optimizations which might affect the accuracy of the result. +--- a/doc/examples/CMakeLists.txt ++++ b/doc/examples/CMakeLists.txt +@@ -14,7 +14,3 @@ foreach(example_src ${examples_SRCS}) + ) + add_dependencies(all_examples ${example}) + endforeach() +- +-if(EIGEN_COMPILER_SUPPORT_CPP11) +-ei_add_target_property(nullary_indexing COMPILE_FLAGS "-std=c++11") +-endif() +\ No newline at end of file +diff --git a/doc/snippets/CMakeLists.txt b/doc/snippets/CMakeLists.txt +index 65f195a..4cb18c8 100644 +--- a/doc/snippets/CMakeLists.txt ++++ b/doc/snippets/CMakeLists.txt +@@ -15,9 +15,6 @@ foreach(snippet_src ${snippets_SRCS}) + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + endif() +- if(${snippet_src} MATCHES "cxx11") +- set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-std=c++11") +- endif() + if(${snippet_src} MATCHES "deprecated") + set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-DEIGEN_NO_DEPRECATED_WARNING") + endif() +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -399,7 +399,6 @@ if(CUDA_FOUND) + set(CUDA_NVCC_FLAGS "-ccbin ${CMAKE_C_COMPILER}" CACHE STRING "nvcc flags" FORCE) + endif() + if(EIGEN_TEST_CUDA_CLANG) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + string(APPEND CMAKE_CXX_FLAGS " --cuda-path=${CUDA_TOOLKIT_ROOT_DIR}") + foreach(GPU IN LISTS EIGEN_CUDA_COMPUTE_ARCH) + string(APPEND CMAKE_CXX_FLAGS " --cuda-gpu-arch=sm_${GPU}") +--- a/unsupported/test/CMakeLists.txt ++++ b/unsupported/test/CMakeLists.txt +@@ -59,7 +59,7 @@ find_package(MPREAL) + if(MPREAL_FOUND AND EIGEN_COMPILER_SUPPORT_CPP11) + ei_add_property(EIGEN_TESTED_BACKENDS "MPFR C++, ") + include_directories(${MPREAL_INCLUDES}) +- ei_add_test(mpreal_support "-std=c++11" "${MPREAL_LIBRARIES}" ) ++ ei_add_test(mpreal_support "-std=c++14" "${MPREAL_LIBRARIES}" ) + else() + ei_add_property(EIGEN_MISSING_BACKENDS "MPFR C++, ") + endif() +@@ -308,7 +308,6 @@ if(CUDA_FOUND AND EIGEN_TEST_CUDA) + set(CUDA_NVCC_FLAGS "-ccbin ${CMAKE_C_COMPILER}" CACHE STRING "nvcc flags" FORCE) + endif() + if(EIGEN_TEST_CUDA_CLANG) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + string(APPEND CMAKE_CXX_FLAGS " --cuda-path=${CUDA_TOOLKIT_ROOT_DIR}") + foreach(ARCH IN LISTS EIGEN_CUDA_COMPUTE_ARCH) + string(APPEND CMAKE_CXX_FLAGS " --cuda-gpu-arch=sm_${ARCH}") +--- a/doc/special_examples/CMakeLists.txt ++++ b/doc/special_examples/CMakeLists.txt +@@ -23,7 +23,6 @@ if(EIGEN_COMPILER_SUPPORT_CPP11) + add_executable(random_cpp11 random_cpp11.cpp) + target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) + add_dependencies(all_examples random_cpp11) +- ei_add_target_property(random_cpp11 COMPILE_FLAGS "-std=c++11") + + add_custom_command( + TARGET random_cpp11 diff --git a/dev-cpp/eigen/files/eigen-3.4.0-noansi.patch b/dev-cpp/eigen/files/eigen-3.4.0-noansi.patch new file mode 100644 index 000000000000..c0ce44445c1d --- /dev/null +++ b/dev-cpp/eigen/files/eigen-3.4.0-noansi.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -184,6 +184,7 @@ if(NOT MSVC) + ei_add_cxx_compiler_flag("-wd2304") # disable ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor + + ++ if(NOT EIGEN_TEST_CXX11) + # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails + # Moreover we should not set both -strict-ansi and -ansi + check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI) +@@ -194,6 +195,7 @@ if(NOT MSVC) + else() + ei_add_cxx_compiler_flag("-ansi") + endif() ++ endif() + + if(ANDROID_NDK) + ei_add_cxx_compiler_flag("-pie") diff --git a/dev-cpp/eigen/files/eigen-9999-please_protect_your_min_with_parentheses.patch b/dev-cpp/eigen/files/eigen-9999-please_protect_your_min_with_parentheses.patch new file mode 100644 index 000000000000..0453fd33a8ae --- /dev/null +++ b/dev-cpp/eigen/files/eigen-9999-please_protect_your_min_with_parentheses.patch @@ -0,0 +1,54 @@ +diff --git a/test/main.h b/test/main.h +index 771725f06..df22e12f6 100644 +--- a/test/main.h ++++ b/test/main.h +@@ -86,32 +86,6 @@ + #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int + #endif + +-// To test that all calls from Eigen code to std::min() and std::max() are +-// protected by parenthesis against macro expansion, the min()/max() macros +-// are defined here and any not-parenthesized min/max call will cause a +-// compiler error. +-#if !defined(__HIPCC__) && !defined(EIGEN_USE_SYCL) && !defined(EIGEN_POCKETFFT_DEFAULT) +-// +-// HIP header files include the following files +-// <thread> +-// <regex> +-// <unordered_map> +-// which seem to contain not-parenthesized calls to "max"/"min", triggering the following check and causing the compile +-// to fail +-// +-// Including those header files before the following macro definition for "min" / "max", only partially resolves the +-// issue This is because other HIP header files also define "isnan" / "isinf" / "isfinite" functions, which are needed +-// in other headers. +-// +-// So instead choosing to simply disable this check for HIP +-// +-#define min(A, B) please_protect_your_min_with_parentheses +-#define max(A, B) please_protect_your_max_with_parentheses +-#define isnan(X) please_protect_your_isnan_with_parentheses +-#define isinf(X) please_protect_your_isinf_with_parentheses +-#define isfinite(X) please_protect_your_isfinite_with_parentheses +-#endif +- + // test possible conflicts + struct real {}; + struct imag {}; +diff --git a/test/main.h b/test/main.h +index df22e12f6..5ca40424e 100644 +--- a/test/main.h ++++ b/test/main.h +@@ -95,12 +95,6 @@ struct imag {}; + #endif + #define M_PI please_use_EIGEN_PI_instead_of_M_PI + +-#define FORBIDDEN_IDENTIFIER \ +- (this_identifier_is_forbidden_to_avoid_clashes) this_identifier_is_forbidden_to_avoid_clashes +-// B0 is defined in POSIX header termios.h +-#define B0 FORBIDDEN_IDENTIFIER +-#define I FORBIDDEN_IDENTIFIER +- + // _res is defined by resolv.h + #define _res FORBIDDEN_IDENTIFIER + diff --git a/dev-cpp/eigen/metadata.xml b/dev-cpp/eigen/metadata.xml index 65119626c2f1..57571f41d055 100644 --- a/dev-cpp/eigen/metadata.xml +++ b/dev-cpp/eigen/metadata.xml @@ -16,6 +16,23 @@ OpenGL apps, spreadsheets and other office apps, etc. Eigen is dedicated to providing optimal speed with GCC. </longdescription> + <use> + <flag name="benchmark">Build benchmark suite</flag> + <flag name="clang">Use clang for cuda units compilation</flag> + <flag name="hip">Enable HIP GPU computing support</flag> + <flag name="adolc">Add test support for Adolc (<pkg>sci-libs/adolc</pkg>)</flag> + <flag name="boost">Add test support for Boost.Multiprecision (<pkg>dev-libs/boost</pkg>)</flag> + <flag name="cholmod">Add test support for CHOLMOD (<pkg>sci-libs/cholmod</pkg>)</flag> + <flag name="fftw">Add test support for fftw (<pkg>sci-libs/fftw</pkg>)</flag> + <flag name="klu">Add test support for KLU (<pkg>sci-libs/klu</pkg>)</flag> + <flag name="opengl">Add test support for OpenGL</flag> + <flag name="openmp">Add test support for the OpenMP (support parallel computing)</flag> + <flag name="pastix">Add test support for PaStiX (<pkg>sci-libs/pastix</pkg>)</flag> + <flag name="sparsehash">Add test support for GoogleHash (<pkg>dev-cpp/sparsehash</pkg>)</flag> + <flag name="spqr">Add test support for SPQR (<pkg>sci-libs/spqr</pkg>)</flag> + <flag name="superlu">Add test support for SuperLU (<pkg>sci-libs/superlu</pkg>)</flag> + <flag name="umfpack">Add test support for UMFPACK (<pkg>sci-libs/umfpack</pkg>)</flag> + </use> <upstream> <remote-id type="gitlab">libeigen/eigen</remote-id> </upstream> |