diff --git a/build_CUPyDO.sh b/build_CUPyDO.sh index a7f53de3ee2757ba9c01c622fc18f8c752a0f3fb..a30d5baa382230c8cdbfd4dd96946ef036cc0419 100755 --- a/build_CUPyDO.sh +++ b/build_CUPyDO.sh @@ -1,94 +1,354 @@ #!/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 CUPyDO ] ; then - git clone git@github.com:ulgltas/CUPyDO.git + if [ ! -d Gmsh ] ; then + echo "Gmsh: retrieving gmsh-git-Linux64-sdk.tgz" + 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 +} - cd CUPyDO - git pull - git checkout pfem_compatibility_update - git pull - if [ -d build ] ; then - rm -rf build +# geoGen (for VLM) +# https://github.com/acrovato/geoGen +# full python + +function get_geoGen() +{ + 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 - 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 waves ] ; then - git clone git@gitlab.uliege.be:am-dept/waves.git + if [ ! -d sol2 ] ; then + echo "sol2: retrieving sol2 ${SOL2_VERSION}" + + 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 +} + +# modali: Modal integrator for fluid-structure computations +# https://github.com/ulgltas/modali +# full python - no build - cd waves - if [ -d build ] ; then - rm -rf build +function build_modali() +{ + 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 - 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 PFEM ] ; then - git clone git@gitlab.uliege.be:am-dept/PFEM.git + if [ ! -d NativeSolid ] ; then + echo "NativeSolid: cloning NativeSolid ${NATIVESOLID_VERSION}" + git -c advice.detachedHead=false \ + clone --quiet git@github.com:ulgltas/NativeSolid.git \ + --branch ${NATIVESOLID_VERSION} + else + echo "NativeSolid: already cloned" fi - cd PFEM - git pull - git checkout reorganize_schemes_and_algos - git pull - if [ -d build ] ; then - rm -rf build + # requires lapacke/cblas + # lapacke: (sudo apt install liblapacke-dev) + # cblas/blas: (sudo apt-get install libopenblas-dev) + + if [ ! -f ./NativeSolid/bin/TestCVector ] ; then + 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 - 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 NativeSolid ] ; then - git clone git@github.com:ulgltas/NativeSolid.git + if [ ! -d pyBeam ] ; then + echo "pyBeam: cloning pyBeam" + 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 - cd NativeSolid - if [ -d build ] ; then - rm -rf build + if [ ! -f pyBeam/build/bin/pyBeam.py ] ; then + echo "pyBeam: building" + 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 - 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 modali ] ; then - git clone git@github.com:ulgltas/modali.git + if [ ! -d VLM ] ; then + echo "VLM: cloning VLM ${VLM_VERSION}" + 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 } +# 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() { if [ ! -d Metafor ] ; then @@ -98,86 +358,168 @@ function build_Metafor() # clone if [ ! -d linuxbin ] ; then + echo "Metafor/linuxbin: cloning linuxbin" git clone git@gitlab.uliege.be:am-dept/linuxbin.git - fi + else + echo "Metafor/linuxbin: already cloned" + fi + 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 # build - if [ -d oo_metaB ] ; then - rm -rf oo_metaB + if [ ! -f oo_metaB/bin/Metafor ] ; then + 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 - mkdir oo_metaB - cd oo_metaB - cmake -C ../oo_meta/CMake/ubuntu-CUPyDO.cmake ../oo_meta - make -j 12 - cd ../.. + + cd .. } -function build_SU2() +function build_CUPyDO() { - # clone/build SU2 - if [ ! -d SU2.src ] ; then - mkdir SU2.src + if [ ! -d CUPyDO ] ; then + echo "CUPyDO: cloning CUPyDO ${CUPYDO_VERSION}" + git clone --branch ${CUPYDO_VERSION} \ + git@github.com:ulgltas/CUPyDO.git + else + echo "CUPyDO: already cloned" fi - cd SU2.src - if [ ! -d SU2 ] ; then - git clone git@github.com:su2code/SU2.git + if [ ! -f CUPyDO/ccupydo/_CCupydo.so ] ; then + 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 - 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 - if [ ! -d VLM ] ; then - git clone git@github.com:ulgltas/VLM.git + # create CUPyDO main folder + if [ ! -d CUPyDO ] ; then + mkdir CUPyDO fi - cd VLM + cd CUPyDO - if [ -d build ] ; then - rm -rf build - fi - mkdir build - cd build - cmake .. - make -j 6 + # build codes + get_last_Gmsh + get_geoGen + build_sol2 + build_modali + build_NativeSolid + build_pyBeam + build_VLM + build_SU2 + build_PFEM3D + build_waves + build_PFEM + build_Metafor + build_CUPyDO - make install # is it required? - - cd ../.. + # leave CUPyDO main folder + 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." +} - -# create CUPyDO main folder -if [ ! -d CUPyDO ] ; then - mkdir CUPyDO -fi -cd CUPyDO +function usage() +{ + echo "usage: $0 -b -j 2 : build (using 2 cores)" + echo " $0 -b -t : build and test" + echo " $0 -b -t -q : build and test (batch mode)" + 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 -build_waves -build_PFEM -build_Metafor -build_SU2 -build_modali -build_NativeSolid -build_VLM +# -- args +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 -cd .. +if [ "$RUNBATCH" = true ] ; then + 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 diff --git a/cfg/gaston/gcc.profile b/cfg/gaston/gcc.profile new file mode 100644 index 0000000000000000000000000000000000000000..74e8226dec1f90211c190fc8e09bb61da76d7583 --- /dev/null +++ b/cfg/gaston/gcc.profile @@ -0,0 +1,6 @@ +add2env PATH "/opt/gcc-10.3.0/bin" front +add2env LD_LIBRARY_PATH "/opt/gcc-10.3.0/lib64" front +export CC=/opt/gcc-10.3.0/bin/gcc +export CXX=/opt/gcc-10.3.0/bin/g++ +export FC=/opt/gcc-10.3.0/bin/gfortran + diff --git a/cfg/loop.sh b/cfg/loop.sh index e3b00cae4a4951ae6e1a9f04452940204ccf2658..18b0d4f4ff2423f8feb8ada1019e167788a697f2 100755 --- a/cfg/loop.sh +++ b/cfg/loop.sh @@ -52,6 +52,7 @@ function fct_loop() { umask 007 + verb= #verb=1 #uncomment to debug script if [ -n "$verb" ] ; then @@ -64,6 +65,8 @@ function fct_loop() # echo "var=$var" #done + thisdir="$HOME/bin/cfg" + if [ "x$2" != "x" ] && [ -d "$thisdir/$2" ]; then myhost=$2 else @@ -71,8 +74,6 @@ function fct_loop() fi #echo "myhost=" $myhost - thisdir="$HOME/bin/cfg" - # default cfg for i in $thisdir/default/*.$1 ; do diff --git a/cfg/spirou/lam3.bashrc b/cfg/spirou/lam3.bashrc new file mode 100644 index 0000000000000000000000000000000000000000..081a4ec2b9c8ef65cc7ea69a9cc2d439f22bb0a7 --- /dev/null +++ b/cfg/spirou/lam3.bashrc @@ -0,0 +1,5 @@ +# LAM3 aliases + +alias tec3='/home/$USER/dev/LAM3/lam3/build/bin/Release/tec3' +alias lam3='/home/$USER/dev/LAM3/lam3/build/bin/Release/lam3' +alias profil='/home/$USER/dev/LAM3/lam3/build/bin/Release/profil' diff --git a/cfg/spirou/metafor.profile b/cfg/spirou/metafor.profile index 3fe8c1e1de6b4b0fa74cbb4791608142a0f3779f..e80383302c7cf283f3a7fa5fc2f5cbbe2ce22c82 100644 --- a/cfg/spirou/metafor.profile +++ b/cfg/spirou/metafor.profile @@ -1 +1,3 @@ -add2env PATH /home/$USER/dev/Metafor_master/oo_metaB/bin +# add2env PATH /home/$USER/dev/Metafor_master/oo_metaB/bin + +alias Metafor='/home/$USER/dev/Metafor_master/oo_metaB/bin/Metafor' diff --git a/cfg/vaillant/trilinos.profile b/cfg/vaillant/trilinos.profile new file mode 100644 index 0000000000000000000000000000000000000000..d3c8bc47e49d68d2e651d61b30a46ab28bcbc687 --- /dev/null +++ b/cfg/vaillant/trilinos.profile @@ -0,0 +1,4 @@ +# Trilinos custom compile localement +# (permet le FIND_PACKAGE(Trilinos) dans CMake) +add2env CMAKE_PREFIX_PATH "/opt/trilinos" front +add2env PYTHONPATH "/opt/trilinos/lib/python3.9/site-packages" front diff --git a/updatebin.sh b/updatebin.sh index 7912827c733c6faedb699e9d0f70aa4561eccb71..936a0755950ae07904470dff6555f502798df533 100755 --- a/updatebin.sh +++ b/updatebin.sh @@ -13,6 +13,6 @@ echo "===== updating gaston..." ssh gaston 'cd ~/bin ; git pull' echo "===== updating warson..." ssh warson 'cd ~/bin ; git pull' -echo "===== updating spirou..." -ssh spirou 'cd ~/bin ; git pull' +echo "===== updating vaillant..." +ssh vaillant 'cd ~/bin ; git pull' echo "===== done."