mirror of
https://github.com/gentoo-mirror/guru.git
synced 2025-04-20 00:08:58 -04:00
sci-physics/SU2: unbundle everything
Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
parent
708e6f9ec8
commit
b220eda93c
196
sci-physics/SU2/SU2-7.2.0-r1.ebuild
Normal file
196
sci-physics/SU2/SU2-7.2.0-r1.ebuild
Normal file
@ -0,0 +1,196 @@
|
||||
# Copyright 1999-2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{8..9} )
|
||||
|
||||
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 )
|
||||
"
|
||||
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
|
||||
|
||||
RDEPEND="
|
||||
${PYTHON_DEPS}
|
||||
cgns? ( sci-libs/cgnslib:= )
|
||||
librom? ( sci-libs/libROM )
|
||||
mkl? ( sci-libs/mkl )
|
||||
mpi? (
|
||||
sci-libs/metis
|
||||
virtual/mpi[cxx]
|
||||
)
|
||||
mpp? ( sci-libs/Mutationpp )
|
||||
openblas? ( sci-libs/openblas )
|
||||
parmetis? ( sci-libs/parmetis )
|
||||
pastix? (
|
||||
<sci-libs/pastix-6[mpi?]
|
||||
sci-libs/scotch
|
||||
)
|
||||
python? ( $(python_gen_cond_dep 'dev-python/mpi4py[${PYTHON_USEDEP}]') )
|
||||
"
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
dev-cpp/cli11
|
||||
|
||||
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:0 )
|
||||
"
|
||||
BDEPEND="
|
||||
python? ( dev-lang/swig )
|
||||
virtual/pkgconfig
|
||||
"
|
||||
|
||||
# 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 )"
|
||||
DOCS=( "README.md" "SU2_PY/documentation.txt" )
|
||||
REQUIRED_USE="
|
||||
${PYTHON_REQUIRED_USE}
|
||||
parmetis? ( mpi )
|
||||
pastix? (
|
||||
mpi
|
||||
|| ( openblas mkl )
|
||||
)
|
||||
?? ( openblas mkl )
|
||||
?? ( directdiff pastix )
|
||||
"
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-7.0.4-unbundle_boost.patch"
|
||||
"${FILESDIR}/${PN}-7.1.0-fix-env.patch"
|
||||
"${FILESDIR}/${PN}-7.2.0-system-libraries.patch"
|
||||
"${FILESDIR}/${PN}-7.2.0-DESTDIR.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,meson,metis,ninja,parmetis} || 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 ; }
|
||||
|
||||
# Disable python-wrapper tests
|
||||
sed -i "/append(pywrapper_/s/./#&/" TestCases/parallel_regression.py || die
|
||||
|
||||
# Copy absence mesh file
|
||||
if use test ; then
|
||||
cp "${S}/TestCases/nonequilibrium/viscwedge/viscwedge.su2" "${S}/TestCases/nonequilibrium/axi_visccone/" || die
|
||||
fi
|
||||
}
|
||||
|
||||
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 -s ../../${P}-build/SU2_CFD/src/SU2_CFD SU2_PY/SU2_CFD || die
|
||||
ln -s ../../${P}-build/SU2_DEF/src/SU2_DEF SU2_PY/SU2_DEF || die
|
||||
ln -s ../../${P}-build/SU2_DOT/src/SU2_DOT SU2_PY/SU2_DOT || die
|
||||
ln -s ../../${P}-build/SU2_GEO/src/SU2_GEO SU2_PY/SU2_GEO || die
|
||||
ln -s ../../${P}-build/SU2_SOL/src/SU2_SOL SU2_PY/SU2_SOL || die
|
||||
|
||||
export SU2_RUN="${S}/SU2_PY"
|
||||
export SU2_HOME="${S}"
|
||||
export PATH="${PATH}:${SU2_RUN}"
|
||||
export PYTHONPATH="${PYTHONPATH}:${SU2_RUN}"
|
||||
|
||||
einfo "Running UnitTests ..."
|
||||
../${P}-build/UnitTests/test_driver || die
|
||||
|
||||
pushd TestCases/ || die
|
||||
if use mpi ; then
|
||||
if use tutorials ; then
|
||||
${EPYTHON} tutorials.py || die
|
||||
fi
|
||||
${EPYTHON} parallel_regression.py || die
|
||||
else
|
||||
${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/{pysu2.py,_pysu2.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}" > 99_SU2
|
||||
echo PATH="${SU2_RUN}" >> 99_SU2
|
||||
echo PYTHONPATH="${SU2_RUN}" >> 99_SU2
|
||||
|
||||
doenvd 99_SU2
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
diff -Naur old_static/externals/tecio/meson.build new_shared/externals/tecio/meson.build
|
||||
--- old_static/externals/tecio/meson.build 2020-05-09 16:35:10.000000000 +0300
|
||||
+++ new_shared/externals/tecio/meson.build 2020-05-10 11:52:36.000000000 +0300
|
||||
--- a/externals/tecio/meson.build
|
||||
+++ b/externals/tecio/meson.build
|
||||
@@ -1,15 +1,15 @@
|
||||
-check_dir = run_command(python,
|
||||
- script_path / 'check_dir.py',
|
||||
|
@ -1,6 +1,5 @@
|
||||
diff -Naur old_env/UnitTests/meson.build new_env/UnitTests/meson.build
|
||||
--- old_env/UnitTests/meson.build 2020-06-15 17:03:43.000000000 +0300
|
||||
+++ new_env/UnitTests/meson.build 2020-06-15 17:04:35.000000000 +0300
|
||||
--- a/UnitTests/meson.build
|
||||
+++ b/UnitTests/meson.build
|
||||
@@ -26,7 +26,7 @@
|
||||
test_driver = executable(
|
||||
'test_driver',
|
||||
|
6
sci-physics/SU2/files/SU2-7.2.0-DESTDIR.patch
Normal file
6
sci-physics/SU2/files/SU2-7.2.0-DESTDIR.patch
Normal file
@ -0,0 +1,6 @@
|
||||
--- a/SU2_PY/pySU2/install.sh
|
||||
+++ b/SU2_PY/pySU2/install.sh
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
-cp "$1/$2" "${MESON_INSTALL_PREFIX}/bin/$2"
|
||||
+cp "$1/$2" "${DESTDIR}/${MESON_INSTALL_PREFIX}/bin/$2"
|
165
sci-physics/SU2/files/SU2-7.2.0-system-libraries.patch
Normal file
165
sci-physics/SU2/files/SU2-7.2.0-system-libraries.patch
Normal file
@ -0,0 +1,165 @@
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -10,7 +10,7 @@
|
||||
python = pymod.find_installation()
|
||||
|
||||
su2_cpp_args = []
|
||||
-su2_deps = [declare_dependency(include_directories: 'externals/CLI11')]
|
||||
+su2_deps = [declare_dependency(include_directories: '/usr/include/CLI')]
|
||||
|
||||
default_warning_flags = []
|
||||
if build_machine.system() != 'windows'
|
||||
@@ -52,7 +52,7 @@
|
||||
endif
|
||||
|
||||
if get_option('enable-autodiff') or get_option('enable-directdiff')
|
||||
- codi_dep = [declare_dependency(include_directories: 'externals/codi/include')]
|
||||
+ codi_dep = [declare_dependency(include_directories: '/usr/include/codi')]
|
||||
codi_rev_args = ['-DCODI_REVERSE_TYPE']
|
||||
codi_for_args = ['-DCODI_FORWARD_TYPE']
|
||||
endif
|
||||
@@ -69,7 +69,8 @@
|
||||
|
||||
# add cgns library
|
||||
if get_option('enable-cgns')
|
||||
- subdir('externals/cgns')
|
||||
+ cpp = meson.get_compiler('cpp')
|
||||
+ cgns_dep = cpp.find_library('cgns')
|
||||
su2_deps += cgns_dep
|
||||
su2_cpp_args += '-DHAVE_CGNS'
|
||||
endif
|
||||
@@ -91,23 +92,19 @@
|
||||
su2_deps += mpi_dep
|
||||
su2_cpp_args += '-DHAVE_MPI'
|
||||
|
||||
- # compile metis
|
||||
- subdir('externals/metis')
|
||||
-
|
||||
# add metis dependency
|
||||
+ metis_dep = dependency('metis')
|
||||
su2_deps += metis_dep
|
||||
su2_cpp_args += '-DHAVE_METIS'
|
||||
|
||||
- # compile parmetis
|
||||
- subdir('externals/parmetis')
|
||||
-
|
||||
# add parmetis dependency
|
||||
+ parmetis_dep = dependency('parmetis')
|
||||
su2_deps += parmetis_dep
|
||||
su2_cpp_args += '-DHAVE_PARMETIS'
|
||||
|
||||
# add medi dependency
|
||||
if get_option('enable-autodiff') or get_option('enable-directdiff')
|
||||
- codi_dep += declare_dependency(include_directories: ['externals/medi/include', 'externals/medi/src'])
|
||||
+ codi_dep += declare_dependency(include_directories: ['/usr/share/MeDiPack/include', '/usr/share/MeDiPack/src'])
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -117,7 +114,7 @@
|
||||
|
||||
# add opdi dependency
|
||||
if get_option('enable-autodiff')
|
||||
- codi_dep += declare_dependency(include_directories: 'externals/opdi/include')
|
||||
+ codi_dep += declare_dependency(include_directories: '/usr/include/opdi')
|
||||
|
||||
if get_option('opdi-backend') == 'macro'
|
||||
su2_cpp_args += '-DFORCE_OPDI_MACRO_BACKEND'
|
||||
@@ -185,14 +182,10 @@
|
||||
|
||||
if get_option('enable-librom')
|
||||
|
||||
- assert(get_option('librom_root')!='',
|
||||
- 'Must specify librom folder (-Dlibrom_root=path/to/libROM)')
|
||||
-
|
||||
su2_cpp_args += '-DHAVE_LIBROM'
|
||||
|
||||
- librom_root = get_option('librom_root')
|
||||
- librom_dep = declare_dependency(include_directories: librom_root,
|
||||
- link_args: ['-L'+librom_root+'/build', '-lROM'])
|
||||
+ librom_dep = declare_dependency(include_directories: '/usr/include/libROM',
|
||||
+ link_args: ['-lROM'])
|
||||
|
||||
su2_deps += librom_dep
|
||||
|
||||
@@ -205,19 +198,17 @@
|
||||
endif
|
||||
endforeach
|
||||
|
||||
-catch2_dep = declare_dependency(include_directories: 'externals/catch2/')
|
||||
+catch2_dep = declare_dependency(include_directories: '/usr/include/catch2/')
|
||||
|
||||
if get_option('enable-mpp')
|
||||
- cmake = import('cmake')
|
||||
- mpp_subproj = cmake.subproject('Mutationpp')
|
||||
- mpp_dep = mpp_subproj.dependency('mutation++')
|
||||
+ mpp_dep = dependency('mutation++')
|
||||
su2_deps += mpp_dep
|
||||
su2_cpp_args += '-DHAVE_MPP'
|
||||
endif
|
||||
|
||||
if omp and get_option('enable-autodiff')
|
||||
py = find_program('python3','python')
|
||||
- p = run_command(py, 'externals/opdi/syntax/check.py', 'su2omp.syntax.json', 'Common', 'SU2_CFD', '-p', '*.hpp', '*.cpp', '*.inl', '-r', '-q')
|
||||
+ p = run_command(py, '/usr/share/OpDiLib/syntax/check.py', 'su2omp.syntax.json', 'Common', 'SU2_CFD', '-p', '*.hpp', '*.cpp', '*.inl', '-r', '-q')
|
||||
if p.returncode() != 0
|
||||
error(p.stdout())
|
||||
endif
|
||||
@@ -280,20 +271,4 @@
|
||||
get_option('enable-autodiff'), get_option('enable-directdiff'), get_option('enable-pywrapper'), get_option('enable-mkl'),
|
||||
get_option('enable-openblas'), get_option('enable-pastix'), get_option('enable-mixedprec'), get_option('enable-librom'), meson.build_root().split('/')[-1]))
|
||||
|
||||
-if get_option('enable-mpp')
|
||||
- message(''' To run SU2 with Mutation++ library, add these lines to your .bashrc file:
|
||||
-
|
||||
- export MPP_DATA_DIRECTORY=$SU2_HOME/subprojects/Mutationpp/data
|
||||
- export LD_LIBRARY_PATH=$SU2_HOME/<build_dir>/subprojects/Mutationpp
|
||||
-
|
||||
- ''')
|
||||
-endif
|
||||
-
|
||||
-if get_option('enable-librom')
|
||||
- message(''' To run SU2 with libROM library, add this line to your .bashrc file:
|
||||
-
|
||||
- export LD_LIBRARY_PATH=@0@/build/:$LD_LIBRARY_PATH
|
||||
-
|
||||
- '''.format(get_option('librom_root')))
|
||||
-
|
||||
endif
|
||||
--- a/SU2_CFD/include/solvers/CSolver.hpp
|
||||
+++ b/SU2_CFD/include/solvers/CSolver.hpp
|
||||
@@ -57,9 +57,9 @@
|
||||
#include "../variables/CVariable.hpp"
|
||||
|
||||
#ifdef HAVE_LIBROM
|
||||
-#include "BasisGenerator.h"
|
||||
-#include "QDEIM.h"
|
||||
-#include "DEIM.h"
|
||||
+#include "linalg/BasisGenerator.h"
|
||||
+#include "hyperreduction/QDEIM.h"
|
||||
+#include "hyperreduction/DEIM.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
--- a/SU2_CFD/include/SU2_CFD.hpp
|
||||
+++ b/SU2_CFD/include/SU2_CFD.hpp
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../../Common/include/parallelization/mpi_structure.hpp"
|
||||
#include "../../Common/include/parallelization/omp_structure.hpp"
|
||||
-#include "CLI11.hpp"
|
||||
+#include "CLI.hpp"
|
||||
|
||||
#include "drivers/CDriver.hpp"
|
||||
#include "drivers/CSinglezoneDriver.hpp"
|
||||
--- a/SU2_GEO/include/SU2_GEO.hpp
|
||||
+++ b/SU2_GEO/include/SU2_GEO.hpp
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include "../../Common/include/geometry/CPhysicalGeometry.hpp"
|
||||
#include "../../Common/include/CConfig.hpp"
|
||||
-#include "../../../Common/include/grid_movement/CSurfaceMovement.hpp"
|
||||
-#include "../../../Common/include/grid_movement/CFreeFormDefBox.hpp"
|
||||
+#include "../../Common/include/grid_movement/CSurfaceMovement.hpp"
|
||||
+#include "../../Common/include/grid_movement/CFreeFormDefBox.hpp"
|
||||
|
||||
using namespace std;
|
@ -6,11 +6,16 @@
|
||||
<name>Sergey Torokhov</name>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="cgns">Build with CGNS support (bundled)</flag>
|
||||
<flag name="autodiff">Enable support for reverse automatic differentiation</flag>
|
||||
<flag name="cgns">Build with CGNS support</flag>
|
||||
<flag name="directdiff">Enable support for forward automatic differentiation</flag>
|
||||
<flag name="librom">Enable LLNL libROM support</flag>
|
||||
<flag name="mixed-precision">Use single precision floating point arithmetic for sparse algebra</flag>
|
||||
<flag name="mkl">Enable Intel MKL support</flag>
|
||||
<flag name="mpp">Enable Mutation++ library support</flag>
|
||||
<flag name="openblas">Enable OpenBLAS support</flag>
|
||||
<flag name="parmetis">Enable Parmetis support (Metis support is always on)</flag>
|
||||
<flag name="openblas">Enable BLAS and LAPACK support via OpenBLAS</flag>
|
||||
<flag name="parmetis">Enable Parmetis support</flag>
|
||||
<flag name="pastix">Enable PaStiX support</flag>
|
||||
<flag name="tecio">Enable TECIO support</flag>
|
||||
<flag name="tutorials">Install Tutorials files</flag>
|
||||
</use>
|
||||
|
Loading…
x
Reference in New Issue
Block a user