Skip to content
Snippets Groups Projects
Commit 3cd7609a authored by Boman Romain's avatar Boman Romain
Browse files

update CUPyDO script

parent 43eaaf6a
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
# build CUPyDO and all related solvers / run ctest
#
# usage: build_CUPyDO.sh -b -j 2 : build (using 2 cores)
# build_CUPyDO.sh -b -t : build and test
# build_CUPyDO.sh -b -t -q : build and test (batch mode)
function build_CUPyDO() # profile should be sourced if in batch mode
source ~/.profile
# bash: enable more errors
set -eu
GEOGEN_VERSION=2.0.0
SOL2_VERSION=3.2.2
MODALI_VERSION=v2.0
NATIVESOLID_VERSION=romain # v1.1
PYBEAM_VERSION=master
VLM_VERSION=v2.0
SU2_VERSION=fix_wrap_strong
PFEM3D_VERSION=v2.0.0
# WAVES_VERSION=v2.2.2 # AttributeError: module 'flow' has no attribute 'F0PsPhiInf'
WAVES_VERSION=v2.1.1
PFEM_VERSION=v1.19
METAFOR_VERSION=v3492
CUPYDO_VERSION=lacroix
# Gmsh
# https://gmsh.info/
function get_last_Gmsh()
{ {
# clone/build CUPyDO if [ ! -d Gmsh ] ; then
if [ ! -d CUPyDO ] ; then echo "Gmsh: retrieving gmsh-git-Linux64-sdk.tgz"
git clone git@github.com:ulgltas/CUPyDO.git wget -q https://gmsh.info/bin/Linux/gmsh-git-Linux64-sdk.tgz
tar -xzf gmsh-git-Linux64-sdk.tgz
mv gmsh-git-Linux64-sdk Gmsh
rm gmsh-git-Linux64-sdk.tgz
else
echo "Gmsh: found"
fi fi
}
cd CUPyDO # geoGen (for VLM)
git pull # https://github.com/acrovato/geoGen
git checkout pfem_compatibility_update # full python
git pull
if [ -d build ] ; then function get_geoGen()
rm -rf build {
if [ ! -d geoGen ] ; then
echo "geoGen: retrieving geoGen ${GEOGEN_VERSION}"
wget -q https://github.com/acrovato/geoGen/archive/refs/tags/v${GEOGEN_VERSION}.tar.gz
tar -xf v${GEOGEN_VERSION}.tar.gz
mv geoGen-${GEOGEN_VERSION} geoGen
rm v${GEOGEN_VERSION}.tar.gz
else
echo "geoGen: found"
fi fi
mkdir build
cd build
cmake ..
make -j 6
make install
cd ../..
} }
function build_waves() # sol2 (for PFEM3D)
# https://github.com/ThePhD/sol2
function build_sol2() #
{ {
# clone/build waves if [ ! -d sol2 ] ; then
if [ ! -d waves ] ; then echo "sol2: retrieving sol2 ${SOL2_VERSION}"
git clone git@gitlab.uliege.be:am-dept/waves.git
SOL2_INSTALL_PREFIX=`pwd`/sol2
wget -q https://github.com/ThePhD/sol2/archive/refs/tags/v${SOL2_VERSION}.tar.gz
tar -xf v${SOL2_VERSION}.tar.gz
rm v${SOL2_VERSION}.tar.gz
echo "sol2: building"
cd sol2-${SOL2_VERSION}
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${SOL2_INSTALL_PREFIX} #>sol2.cmake.log
cmake --build . --target install -- -j ${NCORES} #>sol2.build.log
cd ../..
rm -rf sol2-${SOL2_VERSION}
else
echo "sol2: found"
fi fi
}
# modali: Modal integrator for fluid-structure computations
# https://github.com/ulgltas/modali
# full python - no build
cd waves function build_modali()
if [ -d build ] ; then {
rm -rf build if [ ! -d modali ] ; then
echo "modali: cloning modali ${MODALI_VERSION}"
git -c advice.detachedHead=false \
clone --quiet \
--branch ${MODALI_VERSION} \
git@github.com:ulgltas/modali.git
else
echo "modali: already cloned"
fi fi
mkdir build
cd build
cmake -DUSE_PY3=OFF -C../CMake/disable-trilinos.cmake ..
make -j 6
cd ../..
} }
function build_PFEM() # NativeSolid (RBM?)
# https://github.com/ulgltas/NativeSolid
function build_NativeSolid()
{ {
# clone/build PFEM if [ ! -d NativeSolid ] ; then
if [ ! -d PFEM ] ; then echo "NativeSolid: cloning NativeSolid ${NATIVESOLID_VERSION}"
git clone git@gitlab.uliege.be:am-dept/PFEM.git git -c advice.detachedHead=false \
clone --quiet git@github.com:ulgltas/NativeSolid.git \
--branch ${NATIVESOLID_VERSION}
else
echo "NativeSolid: already cloned"
fi fi
cd PFEM # requires lapacke/cblas
git pull # lapacke: (sudo apt install liblapacke-dev)
git checkout reorganize_schemes_and_algos # cblas/blas: (sudo apt-get install libopenblas-dev)
git pull
if [ -d build ] ; then if [ ! -f ./NativeSolid/bin/TestCVector ] ; then
rm -rf build echo "NativeSolid: building"
cd NativeSolid
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -Wno-dev .. #>NativeSolid.cmake.log
make -j ${NCORES} #>NativeSolid.make.log
cd ../..
else
echo "NativeSolid: already built"
fi fi
mkdir build
cd build
cmake ..
make -j 6
cd ../..
} }
# pyBeam:
# https://github.com/pyBeam/pyBeam
# requires meson/ninja: sudo apt install meson
function build_NativeSolid() function build_pyBeam()
{ {
# clone/build NativeSolid if [ ! -d pyBeam ] ; then
if [ ! -d NativeSolid ] ; then echo "pyBeam: cloning pyBeam"
git clone git@github.com:ulgltas/NativeSolid.git git -c advice.detachedHead=false \
clone --depth 1 --recursive \
git@github.com:pyBeam/pyBeam.git \
--branch ${PYBEAM_VERSION}
ver=$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/')
if [ "$ver" -gt "37" ]; then
# fix meson build file for python3.8
# see https://github.com/mesonbuild/meson/issues/5629
sed -i "s/dependency('python3')/dependency('python3-embed')/g" \
pyBeam/meson.build
fi
else
echo "pyBeam: already cloned"
fi fi
cd NativeSolid if [ ! -f pyBeam/build/bin/pyBeam.py ] ; then
if [ -d build ] ; then echo "pyBeam: building"
rm -rf build cd pyBeam
if [ -d build ] ; then
rm -rf build
fi
mkdir build
meson build --prefix=$PWD/build
ninja -C build install
cd ..
else
echo "pyBeam: already installed"
fi fi
mkdir build
cd build
cmake ..
make -j 6
cd ../..
} }
# VLM
# https://github.com/ulgltas/VLM
function build_modali() function build_VLM()
{ {
# clone modali if [ ! -d VLM ] ; then
if [ ! -d modali ] ; then echo "VLM: cloning VLM ${VLM_VERSION}"
git clone git@github.com:ulgltas/modali.git git -c advice.detachedHead=false \
clone --quiet \
--branch ${VLM_VERSION} \
git@github.com:ulgltas/VLM.git
else
echo "VLM: already cloned"
fi
if [ ! -f VLM/bin/VLM ] ; then
echo "VLM: building"
cd VLM
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release -DPYTHON_WRAPPER=ON ..
make -j ${NCORES}
make install
cd ../..
else
echo "VLM: already built"
fi fi
} }
# SU2
# https://github.com/ulgltas/SU2
function build_SU2()
{
if [ ! -d SU2 ] ; then
echo "SU2: cloning SU2"
git clone --depth 1 git@github.com:ulgltas/SU2.git \
--branch ${SU2_VERSION}
else
echo "SU2: srcs found"
fi
if [ ! -f SU2/build/bin/SU2_CFD ] ; then
echo "SU2: building"
cd SU2
export CXXFLAGS="-O3"
python3 meson.py setup build \
-Denable-pywrapper=true \
-Denable-cgns=false \
-Denable-tecio=false \
-Dwith-mpi=disabled \
-Denable-tests=false \
-Denable-autodiff=true \
--prefix=$PWD/build
./ninja -C build install
cd ..
else
echo "SU2: already installed"
fi
}
# PFEM3D
# https://github.com/ImperatorS79/PFEM3D
# sudo apt install libcgal-dev liblua5.3-dev
#
# ctest runtime: needs slpp (lua parser for python)
# https://github.com/SirAnthony/slpp
# https://pypi.org/project/SLPP/
# => sudo pip3 install slpp
function build_PFEM3D()
{
if [ ! -d PFEM3D ] ; then
echo "PFEM3D: cloning PFEM3D ${PFEM3D_VERSION}"
git -c advice.detachedHead=false \
clone --quiet \
--branch ${PFEM3D_VERSION} \
git@github.com:ImperatorS79/PFEM3D.git
else
echo "PFEM3D: already cloned"
fi
if [ ! -f PFEM3D/build/bin/pfem ] ; then
echo "PFEM3D: building"
BASE=`pwd`
export GMSH=${BASE}/Gmsh
export Sol2_DIR=${BASE}/sol2/lib/cmake/sol2/
export PATH=${GMSH}/bin:${GMSH}/lib:${PATH}
export INCLUDE=${GMSH}/include:${INCLUDE}
export LIB=${GMSH}/lib:${LIB}
cd PFEM3D
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release \
-DUSE_SWIG=1 -DBUILD_TESTING=1 ..
make -j ${NCORES}
cp ${BASE}/Gmsh/lib/libgmsh.so bin/
cd ../..
else
echo "PFEM3D: already built"
fi
}
# Waves
# https://gitlab.uliege.be/am-dept/waves
function build_waves()
{
if [ ! -d waves ] ; then
echo "waves: cloning waves ${WAVES_VERSION}"
git -c advice.detachedHead=false \
clone --quiet \
--branch ${WAVES_VERSION} \
git@gitlab.uliege.be:am-dept/waves.git
else
echo "waves: already cloned"
fi
if [ ! -f waves/build/bin/libwaves.so ] ; then
echo "waves: building"
cd waves
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake -Wno-dev -C../CMake/disable-trilinos.cmake ..
make -j ${NCORES}
cd ../..
else
echo "waves: already built"
fi
}
# PFEM:
# https://gitlab.uliege.be/am-dept/PFEM
function build_PFEM()
{
if [ ! -d PFEM ] ; then
echo "PFEM: cloning PFEM ${PFEM_VERSION}"
git -c advice.detachedHead=false \
clone --quiet \
--branch ${PFEM_VERSION} \
git@gitlab.uliege.be:am-dept/PFEM.git
else
echo "PFEM: already cloned"
fi
if [ ! -f PFEM/build/bin/libpfem.so ] ; then
echo "PFEM: building"
cd PFEM
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake -Wno-dev ..
make -j ${NCORES}
cd ../..
else
echo "PFEM: already built"
fi
}
# Metafor
function build_Metafor() function build_Metafor()
{ {
if [ ! -d Metafor ] ; then if [ ! -d Metafor ] ; then
...@@ -98,86 +358,168 @@ function build_Metafor() ...@@ -98,86 +358,168 @@ function build_Metafor()
# clone # clone
if [ ! -d linuxbin ] ; then if [ ! -d linuxbin ] ; then
echo "Metafor/linuxbin: cloning linuxbin"
git clone git@gitlab.uliege.be:am-dept/linuxbin.git git clone git@gitlab.uliege.be:am-dept/linuxbin.git
fi else
echo "Metafor/linuxbin: already cloned"
fi
if [ ! -d oo_meta ] ; then if [ ! -d oo_meta ] ; then
git clone --depth=10 git@gitlab.uliege.be:am-dept/MN2L/oo_meta.git echo "Metafor/oo_meta: cloning oo_meta ${METAFOR_VERSION}"
git -c advice.detachedHead=false \
clone --recursive --depth=1 \
--branch ${METAFOR_VERSION} \
git@gitlab.uliege.be:am-dept/MN2L/oo_meta.git
else
echo "Metafor/oo_meta: already cloned"
fi fi
# build # build
if [ -d oo_metaB ] ; then if [ ! -f oo_metaB/bin/Metafor ] ; then
rm -rf oo_metaB echo "Metafor/oo_meta: building"
if [ -d oo_metaB ] ; then
rm -rf oo_metaB
fi
mkdir oo_metaB
cd oo_metaB
cmake -Wno-dev -C ../oo_meta/CMake/ubuntu-CUPyDO.cmake ../oo_meta
make -j ${NCORES}
cd ..
else
echo "Metafor/oo_meta: already built"
fi fi
mkdir oo_metaB
cd oo_metaB cd ..
cmake -C ../oo_meta/CMake/ubuntu-CUPyDO.cmake ../oo_meta
make -j 12
cd ../..
} }
function build_SU2() function build_CUPyDO()
{ {
# clone/build SU2 if [ ! -d CUPyDO ] ; then
if [ ! -d SU2.src ] ; then echo "CUPyDO: cloning CUPyDO ${CUPYDO_VERSION}"
mkdir SU2.src git clone --branch ${CUPYDO_VERSION} \
git@github.com:ulgltas/CUPyDO.git
else
echo "CUPyDO: already cloned"
fi fi
cd SU2.src
if [ ! -d SU2 ] ; then if [ ! -f CUPyDO/ccupydo/_CCupydo.so ] ; then
git clone git@github.com:su2code/SU2.git echo "CUPyDO: building"
cd CUPyDO
if [ -d build ] ; then
rm -rf build
fi
mkdir build
cd build
cmake -Wno-dev -DWITH_MPI=OFF ..
make -j ${NCORES}
make install
cd ../..
else
echo "CUPyDO: already built"
fi fi
cd SU2
git checkout tags/v6.2.0
unset MKLROOT # <= MKL should be disabled
./bootstrap
./configure --prefix=`readlink -f ../../SU2` \
CXXFLAGS="-O3" \
--enable-PY_WRAPPER
make -j 12
make install
cd ../..
} }
function build_VLM() function do_build()
{ {
# clone/build VLM # create CUPyDO main folder
if [ ! -d VLM ] ; then if [ ! -d CUPyDO ] ; then
git clone git@github.com:ulgltas/VLM.git mkdir CUPyDO
fi fi
cd VLM cd CUPyDO
if [ -d build ] ; then # build codes
rm -rf build get_last_Gmsh
fi get_geoGen
mkdir build build_sol2
cd build build_modali
cmake .. build_NativeSolid
make -j 6 build_pyBeam
build_VLM
build_SU2
build_PFEM3D
build_waves
build_PFEM
build_Metafor
build_CUPyDO
make install # is it required? # leave CUPyDO main folder
cd ..
cd ../..
} }
function do_tests()
{
echo "do_tests()..."
cd CUPyDO
cd CUPyDO/build
ctest -j ${NCORES} #2>&1 > ctest_stdout.txt
# output the last lines to stdout (useful for shortening mails)
#tail -n 50 ctest_stdout.txt
cd ../../..
echo "done."
}
function usage()
# create CUPyDO main folder {
if [ ! -d CUPyDO ] ; then echo "usage: $0 -b -j 2 : build (using 2 cores)"
mkdir CUPyDO echo " $0 -b -t : build and test"
fi echo " $0 -b -t -q : build and test (batch mode)"
cd CUPyDO exit 1
}
# build codes function go_batch()
{
CMD_TXT="$0 -j ${NCORES}"
if [ "$DO_BUILD" = true ] ; then
CMD_TXT="$CMD_TXT -b"
fi
if [ "$DO_TESTS" = true ] ; then
CMD_TXT="$CMD_TXT -t"
fi
echo "starting script in batch mode:"
echo " $CMD_TXT"
echo $CMD_TXT | at now -m
exit 0
}
NCORES=`nproc --all`
RUNBATCH=false
DO_BUILD=false
DO_TESTS=false
DISPLAY_USAGE=true
build_CUPyDO # -- args
build_waves
build_PFEM
build_Metafor
build_SU2
build_modali
build_NativeSolid
build_VLM
while getopts "j:hbtq" option
do
case $option in
j )
NCORES=$OPTARG ;;
h )
usage ;;
q )
RUNBATCH=true ;;
b )
DO_BUILD=true ;
DISPLAY_USAGE=false ;;
t )
DO_TESTS=true ;
DISPLAY_USAGE=false ;;
* )
echo "[getopts] Bad option: $option" ; exit 1 ;;
esac
done
shift $(($OPTIND - 1))
# leave CUPyDO main folder if [ "$RUNBATCH" = true ] ; then
cd .. go_batch
else
if [ "$DISPLAY_USAGE" = true ] ; then
usage
fi
if [ "$DO_BUILD" = true ] ; then
do_build
fi
if [ "$DO_TESTS" = true ] ; then
do_tests
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment