diff options
-rw-r--r-- | sci-physics/SU2/Manifest | 3 | ||||
-rw-r--r-- | sci-physics/SU2/SU2-7.5.1.ebuild | 253 |
2 files changed, 256 insertions, 0 deletions
diff --git a/sci-physics/SU2/Manifest b/sci-physics/SU2/Manifest index 128d0d5aa..ade030808 100644 --- a/sci-physics/SU2/Manifest +++ b/sci-physics/SU2/Manifest @@ -1,3 +1,6 @@ DIST SU2-7.2.0-TestCases.tar.gz 464156192 BLAKE2B 405a5ccdd13bc5109feca1462b6ac434a4d817adbaca964465678683d5593fa940579e364e33414da5f059a89b2919fbc0baed82967246356da49c87ac9ce63f SHA512 d75894c285ac7cb4c72eece10a02f014fb2d85b585c08d1a9bbf12ab51f6004be99c368bde98734891dc45446d0656b21317b50d7d14af95b6ce4bfe72871f11 DIST SU2-7.2.0-Tutorials.tar.gz 72845754 BLAKE2B ef670a77d0189e9fd8ad48d96bd4617de558311d0df0d81a10dd3cbf8b97b7fbcb0e6725746d8451ce12a923f6895a392582fa980f4054b3b1306609431900ff SHA512 c91cfbdfb26169fc36575f60ec3133ea4a6f39c8433e276840a0f96c7508f3ee898020179ac01d606da9c5e10ee2ad263a642ff6f6b7400d75f4eb03ee7e1cf8 DIST SU2-7.2.0.tar.gz 15356101 BLAKE2B e52f09d0451c200f6fd6874d55bedf7733f934cb2cee378ca286107960bd82332adc932cae57e9052654b34972717a4f8969db216acdcef8a6816b648119df94 SHA512 5600ebb97ef5939333907f75cda58a02810642439309fc8626ed974dfbfaffdf0cd7d9cc81de310cb12e6f92f98b64c58d607ad93095bd86cc583768947ccf6b +DIST SU2-7.5.1-TestCases.tar.gz 491384375 BLAKE2B f43b605a578cac948c95a35407de4f21a0acbb6befd93fc3f79fba6a3967b64500c7d8cf055051c67dac16176790ae7aca2064c6e24a9777131a6fd01783128a SHA512 e7b67d5ca3792133680828e243b19346ba4fdadb4bf599d76d25b6525e5262d7014dd28ed8dc7558c38534a78d40048269ef71882b0e6961be19b65a13135cab +DIST SU2-7.5.1-Tutorials.tar.gz 98615786 BLAKE2B 906934ada10f60c14aab6d78d742514f008ce833afc53bbd94ba833db6e4734b77d682ce927e989c80829f88858563cd07033e8cc5f80f73bd9bb8eeff4ebba6 SHA512 f59777bc4cecd4b6100bb42ab5f4f30c3119d626f47b0fe7d4c02268af5273ed1f0215a69b78579b5c8ea93d8f01b8533e96ee002c402ae4c0515861ee87dcac +DIST SU2-7.5.1.tar.gz 18894402 BLAKE2B a5e1be7e84765b1d4d3bfa05f60756ec0fb7f50be795836f2e37f83cbb6fd2304b5f572891e69be6e627b972e28fbd975a1cc6cfcf840acc975a02de672706b7 SHA512 863955d95d816fad551254e8d12d71baec771f28e0321705c4fe5f49b72890b079509b716e1274f28fcfaaba00c5d40a10d1cf5b910b71d7836d618fd770fec0 diff --git a/sci-physics/SU2/SU2-7.5.1.ebuild b/sci-physics/SU2/SU2-7.5.1.ebuild new file mode 100644 index 000000000..b46260f66 --- /dev/null +++ b/sci-physics/SU2/SU2-7.5.1.ebuild @@ -0,0 +1,253 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9..11} ) + +inherit meson python-single-r1 + +DESCRIPTION="SU2: An Open-Source Suite for Multiphysics Simulation and Design" +HOMEPAGE="https://su2code.github.io/" +SRC_URI=" + https://github.com/su2code/SU2/archive/v${PV}.tar.gz -> ${P}.tar.gz + test? ( https://github.com/su2code/TestCases/archive/v${PV}.tar.gz -> ${P}-TestCases.tar.gz ) + tutorials? ( https://github.com/su2code/Tutorials/archive/v${PV}.tar.gz -> ${P}-Tutorials.tar.gz ) +" + +LICENSE=" + LGPL-2.1 + tecio? ( tecio_license_agreement ) + parmetis? ( all-rights-reserved free-noncomm ) +" +SLOT="0" +KEYWORDS="~amd64" +IUSE="autodiff cgns directdiff librom mixed-precision mkl +mpi mpp openblas openmp parmetis pastix python tecio test tutorials" +# TODO: do not force openblas + +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + parmetis? ( mpi ) + pastix? ( + mpi + || ( openblas mkl ) + ) + test? ( mpi python tutorials ) + ?? ( openblas mkl ) + ?? ( directdiff pastix ) +" + +# Tests fail with FEATURES="network-sandbox" for most versions of openmpi and mpich it with error: +# "No network interfaces were found for out-of-band communications. +# We require at least one available network for out-of-band messaging." +PROPERTIES="test_network" +RESTRICT="!test? ( test )" + +RDEPEND=" + ${PYTHON_DEPS} + cgns? ( >=sci-libs/cgnslib-4 ) + librom? ( sci-libs/libROM ) + mkl? ( sci-libs/mkl ) + mpi? ( virtual/mpi[cxx] ) + mpp? ( sci-libs/Mutationpp:= ) + openblas? ( sci-libs/openblas ) + pastix? ( + <sci-libs/pastix-6[mpi?] + sci-libs/scotch + ) + python? ( $(python_gen_cond_dep ' + dev-python/mpi4py[${PYTHON_USEDEP}] + dev-python/xlwt[${PYTHON_USEDEP}] + dev-python/matplotlib[${PYTHON_USEDEP}] + dev-python/scipy[${PYTHON_USEDEP}] + dev-python/numpy[${PYTHON_USEDEP}] + ') + ) +" +DEPEND=" + ${RDEPEND} + dev-cpp/cli11:= + dev-cpp/MEL:= + autodiff? ( + sci-libs/CoDiPack:= + mpi? ( >sci-libs/MeDiPack-1.2:= ) + openmp? ( sci-libs/OpDiLib:= ) + ) + directdiff? ( + sci-libs/CoDiPack:= + mpi? ( >sci-libs/MeDiPack-1.2:= ) + ) + tecio? ( >=dev-libs/boost-1.76.0:= ) + test? ( <dev-cpp/catch-3:0 ) +" +BDEPEND=" + python? ( dev-lang/swig ) + virtual/pkgconfig +" + +DOCS=( "README.md" "SU2_PY/documentation.txt" ) + +PATCHES=( + "${FILESDIR}/${PN}-7.0.4-unbundle_boost.patch" + "${FILESDIR}/${PN}-7.1.0-fix-env.patch" + "${FILESDIR}/${P}-system-libraries.patch" + "${FILESDIR}/${PN}-7.2.0-DESTDIR.patch" + "${FILESDIR}/${PN}-7.2.0-fix-headers.patch" + +) + +src_unpack() { + unpack "${P}.tar.gz" + if use test ; then + einfo "Unpacking ${P}-TestCases.tar.gz to /var/tmp/portage/sci-physics/${P}/work/${P}/TestCases" + tar -C "${P}"/TestCases --strip-components=1 -xzf "${DISTDIR}/${P}-TestCases.tar.gz" || die + fi + if use tutorials ; then + einfo "Unpacking ${P}-Tutorials.tar.gz to /var/tmp/portage/sci-physics/${P}/work/${P}" + mkdir "${P}"/Tutorials || die + tar -C "${P}"/Tutorials --strip-components=1 -xzf "${DISTDIR}/${P}-Tutorials.tar.gz" || die + fi +} + +src_prepare(){ + rm -rf externals/{CLI11,autotools,catch2,cgns,codi,medi,mel,meson,ninja,opdi} || die + + default + # boost Geometry requires c++14 since >=boost-1.75 + sed -i -e 's:cpp_std=c++11:cpp_std=c++14:' meson.build || die + + # Force Disable parmetis support in meson.build (configure.ac has optional switch) + use !parmetis && { sed -i -e "/parmetis/Id" meson.build || die ; } + + # Replace platform.processor() with platform.machine() + # to get 'x86_64' in common case instead of full CPU name + sed -i "s/processor()/machine()/" TestCases/TestCase.py || die + + # Fix python3.11 test compatibility (drop universal newline parameter - it's used by default) + sed -i "s/'U'//g" TestCases/TestCase.py || die + + # Disable failed tests + sed -i "/append(tutorial_unst_naca0012)/s/./#&/" TestCases/tutorials.py || die # reasults sligtly differs + + sed -i "/append(turbmod_sa_neg_rae2822/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(dyn_fsi/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(fd_sp_pinArray_cht_2d_dp_hf/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(fd_sp_pinArray_cht_2d_dp_hf/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(coolprop_fluidModel/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(coolprop_transportModel/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(uniform_flow/s/./#&/" TestCases/parallel_regression.py || die + sed -i "/append(pywrapper_square_cylinder/s/./#&/" TestCases/parallel_regression.py || die + + sed -i "/append(discadj_fsi2/s/./#&/" TestCases/parallel_regression_AD.py || die + sed -i "/append(dyn_discadj_fsi/s/./#&/" TestCases/parallel_regression_AD.py || die +} + +src_configure() { + if use mpi ; then + export CC=mpicc + export CXX=mpicxx + fi + + local emesonargs=( + $(meson_feature mpi with-mpi) + $(meson_use autodiff enable-autodiff) + $(meson_use cgns enable-cgns) + $(meson_use directdiff enable-directdiff) + $(meson_use librom enable-librom) + $(meson_use mixed-precision enable-mixedprec) + $(meson_use mkl enable-mkl) + $(meson_use mpi custom-mpi) + $(meson_use mpp enable-mpp) + $(meson_use openblas enable-openblas) + $(meson_use openmp with-omp) + $(meson_use pastix enable-pastix) + $(meson_use python enable-pywrapper) + $(meson_use tecio enable-tecio) + $(meson_use test enable-tests) + ) + meson_src_configure +} + +src_test() { + ln -sf ../../${P}-build/SU2_CFD/src/SU2_CFD SU2_PY/SU2_CFD || die + ln -sf ../../${P}-build/SU2_DEF/src/SU2_DEF SU2_PY/SU2_DEF || die + ln -sf ../../${P}-build/SU2_DOT/src/SU2_DOT SU2_PY/SU2_DOT || die + ln -sf ../../${P}-build/SU2_GEO/src/SU2_GEO SU2_PY/SU2_GEO || die + ln -sf ../../${P}-build/SU2_SOL/src/SU2_SOL SU2_PY/SU2_SOL || die + ln -sf ../../${P}-build/SU2_PY/pySU2/pysu2.py SU2_PY/pysu2.py || die + ln -sf ../../${P}-build/SU2_PY/pySU2/_pysu2.so SU2_PY/_pysu2.so || die + if use autodiff ; then + ln -sf ../../${P}-build/SU2_CFD/src/SU2_CFD_AD SU2_PY/SU2_CFD_AD || die + ln -sf ../../${P}-build/SU2_DOT/src/SU2_DOT_AD SU2_PY/SU2_DOT_AD || die + ln -sf ../../${P}-build/SU2_PY/pySU2/pysu2ad.py SU2_PY/pysu2ad.py || die + ln -sf ../../${P}-build/SU2_PY/pySU2/_pysu2ad.so SU2_PY/_pysu2ad.so || die + if use directdiff ; then + ln -sf ../../${P}-build/SU2_CFD/src/SU2_CFD_DIRECTDIFF SU2_PY/SU2_CFD_DIRECTDIFF || die + fi + fi + + export SU2_RUN="${S}/SU2_PY" + export SU2_HOME="${S}" + export PATH="${PATH}:${SU2_RUN}" + export PYTHONPATH="${PYTHONPATH}:${SU2_RUN}" + + if use autodiff ; then + einfo "Running UnitTests ..." + ../${P}-build/UnitTests/test_driver_AD || die + ../${P}-build/UnitTests/test_driver_DD || die +# else + ## Failed for SU2-7.5.1 with error: + ## application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0 + ## [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=1 + ## system msg for write_line failure : Bad file descriptor +# ../${P}-build/UnitTests/test_driver || die + fi + + pushd TestCases/ || die + # Currently Tests always use mpi. + # Description on the page https://su2code.github.io/docs/Test-Cases/ states: + # "Note: While many of the cases are used for regression testing, the test case suite + # is provided without any guarantees on performance or expected results. + # Tutorials (which are more thoroughly checked for convergence and results) can be found here." + # Therefore bundled parmetis/metis are used otherwise it results in numerous Tutorials tests failures. + if use mpi ; then + # Running Tutorials tests is preferred than TestCases + if use tutorials ; then + ${EPYTHON} tutorials.py || die + fi + if use autodiff ; then + ${EPYTHON} parallel_regression_AD.py || die + fi + ${EPYTHON} parallel_regression.py || die + else + if use autodiff ; then + ${EPYTHON} serial_regression_AD.py || die + fi + ${EPYTHON} serial_regression.py || die + fi + popd || die +} + +src_install() { + DESTDIR="${D}" meson_src_install + + mkdir -p "${D}$(python_get_sitedir)/SU2_PY" || die + if use python; then + mv "${ED}"/usr/bin/*.so -t "${D}$(python_get_sitedir)/SU2_PY" || die + fi + mv "${ED}"/usr/bin/{FSI_tools,SU2,SU2_Nastran} -t "${D}$(python_get_sitedir)" || die + mv "${ED}"/usr/bin/*.py -t "${D}$(python_get_sitedir)/SU2_PY" || die + python_optimize "${D}/$(python_get_sitedir)" + + if use tutorials ; then + insinto "/usr/share/${PN}" + doins -r Tutorials + fi + + local SU2_RUN="$(python_get_sitedir)/SU2_PY" + echo SU2_RUN="${SU2_RUN}" > 99SU2 + echo PATH="${SU2_RUN}" >> 99SU2 + echo PYTHONPATH="${SU2_RUN}" >> 99SU2 + + doenvd 99SU2 +} |