diff --git a/.github/inactive_workflows/fesom2_icepack.yml b/.github/inactive_workflows/fesom2_icepack.yml index 9057057b1..9e295d101 100644 --- a/.github/inactive_workflows/fesom2_icepack.yml +++ b/.github/inactive_workflows/fesom2_icepack.yml @@ -21,14 +21,13 @@ jobs: - name: prepeare FESOM2_icepack run: | - sed -i 's/USE_ICEPACK OFF/USE_ICEPACK ON/g' CMakeLists.txt cd ./src/icepack_drivers/ ./download_icepack.sh cd ../../ - name: Compile model run: | - bash -l configure.sh ubuntu + bash -l configure.sh ubuntu -DUSE_ICEPACK=ON - name: Create global test run with ICEPACK run: | diff --git a/.github/workflows/fesom2.1.yml b/.github/workflows/fesom2.1.yml index 069a5a669..6c766ae43 100644 --- a/.github/workflows/fesom2.1.yml +++ b/.github/workflows/fesom2.1.yml @@ -18,18 +18,43 @@ jobs: steps: # NK: this changes working directory to fesom2 - uses: actions/checkout@v2 - + + - name: Git safe directory + run: | + git config --global --add safe.directory ${PWD} + - name: Compile model (binary) run: | - bash -l configure.sh ubuntu + ./configure.sh ubuntu + + - name: Compile model (ifs_interface) + run: | + export BUILD_DIR=$PWD/build.ifs_interface + ./configure.sh ubuntu -DENABLE_IFS_INTERFACE=ON -DCMAKE_INSTALL_PREFIX=$PWD/install.ifs_interface + + - name: Test downstream from current install-dir + run: | + rm -rf test_downstream/build + export fesom_ROOT=${PWD} + cmake -S test_downstream -B test_downstream/build -DASSERT_HAVE_IFS_INTERFACE=OFF -DASSERT_FESOM_DIR=${fesom_ROOT} + cmake --build test_downstream/build + test_downstream/build/main - - name: Compile model (library) + - name: Test downstream from ifs_interface build-dir run: | - bash ./test/ifs_interface/configure_lib.sh -l + export fesom_ROOT=$PWD/build.ifs_interface + rm -rf test_downstream/build + cmake -S test_downstream -B test_downstream/build -DASSERT_HAVE_IFS_INTERFACE=ON -DASSERT_FESOM_DIR=${fesom_ROOT} + cmake --build test_downstream/build + test_downstream/build/main - - name: Library exists + - name: Test downstream from ifs_interface install-dir run: | - bash ./test/ifs_interface/check_exist.sh + export fesom_ROOT=$PWD/install.ifs_interface + rm -rf test_downstream/build + cmake -S test_downstream -B test_downstream/build -DASSERT_HAVE_IFS_INTERFACE=ON -DASSERT_FESOM_DIR=${fesom_ROOT} + cmake --build test_downstream/build + test_downstream/build/main - name: Create global test run run: | diff --git a/.github/workflows/fesom2_openmp.yml b/.github/workflows/fesom2_openmp.yml index fd1e8cafa..f87229749 100644 --- a/.github/workflows/fesom2_openmp.yml +++ b/.github/workflows/fesom2_openmp.yml @@ -19,15 +19,13 @@ jobs: # NK: this changes working directory to fesom2 - uses: actions/checkout@v2 - - name: switch OpenMP ON + - name: Git safe directory run: | - cd ./src/ - sed -i 's/with OpenMP\" OFF/with OpenMP\" ON/g' CMakeLists.txt - cd ../ + git config --global --add safe.directory ${PWD} - name: Compile model run: | - bash -l configure.sh ubuntu + bash -l configure.sh ubuntu -DENABLE_OPENMP=ON - name: Create global test run with 4 OpenMP threads run: | diff --git a/.gitignore b/.gitignore index 7e9b58fcd..2a3bd44e4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ src/icepack_drivers/Icepack lib/*.a lib/*.so +lib64/* /work_* Makefile.in mesh_part/build diff --git a/configure.sh b/configure.sh index 86d7eb02a..482461832 100755 --- a/configure.sh +++ b/configure.sh @@ -1,11 +1,16 @@ #!/usr/bin/env bash set -e +HERE=$PWD + +SOURCE_DIR="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )" +BUILD_DIR=${BUILD_DIR:-build} source env.sh # source this from your run script too -mkdir build || true # make sure not to commit this to svn or git -cd build -cmake .. $@ -DCMAKE_BUILD_TYPE=Debug # not required when re-compiling - # additional cmake arguments can be passed to configure.sh - # this also includes fesom specific options in CMakeLists, can be used as -DFESOM_COUPLED=ON +mkdir -p ${BUILD_DIR} +cd ${BUILD_DIR} +cmake .. -DCMAKE_INSTALL_PREFIX=$HERE -DCMAKE_BUILD_TYPE=Debug ${CMAKE_ARGS} $@ + # not required when re-compiling + # additional cmake arguments can be passed to configure.sh + # this also includes fesom specific options in CMakeLists, can be used as -DFESOM_COUPLED=ON make install -j`nproc --all` diff --git a/env.sh b/env.sh index a073ad208..93ce4294e 100755 --- a/env.sh +++ b/env.sh @@ -37,7 +37,11 @@ else fi -if [[ $LOGINHOST =~ ^m[A-Za-z0-9]+\.hpc\.dkrz\.de$ ]]; then +if [[ "$LOGINHOST" == "local" ]]; then + echo "Using local environment $BEING_EXECUTED" + [ $BEING_EXECUTED = true ] && exit + return 0 # if we are being sourced, return from this script here +elif [[ $LOGINHOST =~ ^m[A-Za-z0-9]+\.hpc\.dkrz\.de$ ]]; then STRATEGY="mistral.dkrz.de" elif [[ $LOGINHOST =~ ^levante ]] || [[ $LOGINHOST =~ ^l[:alnum:]+\.lvt\.dkrz\.de$ ]]; then STRATEGY="levante.dkrz.de" @@ -85,7 +89,6 @@ else return # if we are being sourced, return from this script here fi - if [ $BEING_EXECUTED = true ]; then # file is being executed, why is this here? echo $DIR/env/$STRATEGY diff --git a/env/ubuntu/shell b/env/ubuntu/shell index 29fc59dbc..c391d6e04 100644 --- a/env/ubuntu/shell +++ b/env/ubuntu/shell @@ -1,5 +1,6 @@ export FC=mpifort CC=mpicc CXX=mpicxx -export BLAS_LIBRARIES=/usr/lib/x86_64-linux-gnu/blas/ -export UBUNTU_BLAS_LIBRARY="libblas.a" - +if [[ -f "/usr/lib/x86_64-linux-gnu/liblapack.so.3" ]]; then + export LAPACK_LIBRARIES=/usr/lib/x86_64-linux-gnu/liblapack.so.3 + export CMAKE_ARGS=-DLAPACK_LIBRARIES=${LAPACK_LIBRARIES} +fi diff --git a/test/ifs_interface/check_exist.sh b/test/ifs_interface/check_exist.sh index e89a674e1..7d80ec346 100755 --- a/test/ifs_interface/check_exist.sh +++ b/test/ifs_interface/check_exist.sh @@ -2,11 +2,21 @@ set -e -FILE=./lib/libfesom.a -if [ -f "$FILE" ]; then +LIB_NAMES=("libfesom.a" "libfesom.so" "libfesom.dylib") + +libfesom_exists=false +for LIB_NAME in ${LIB_NAMES[@]}; do + FILE=./lib/${LIB_NAME} + if [ -f "$FILE" ]; then echo "$FILE compiled and linked." + libfesom_exists=true + fi +done + +if ${libfesom_exists}; then exit 0 else - echo "$FILE does not exist." + echo "libfesom not found" exit 1 fi + diff --git a/test/ifs_interface/configure.sh b/test/ifs_interface/configure.sh new file mode 100755 index 000000000..40f268ead --- /dev/null +++ b/test/ifs_interface/configure.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# custom build script in use at ECMWF + +set -e + +#cd ../../ +source env.sh # source this from your run script too + +HERE=$PWD +echo "+ mkdir -p build" +mkdir -p build +echo "+ cd build" +cd build +echo + cmake .. -DCMAKE_INSTALL_PREFIX=$HERE -DBUILD_SHARED_LIBS=ON -DENABLE_IFS_INTERFACE=ON ${CMAKE_ARGS} $@ # not required when re-compiling +cmake .. -DCMAKE_INSTALL_PREFIX=$HERE -DBUILD_SHARED_LIBS=ON -DENABLE_IFS_INTERFACE=ON ${CMAKE_ARGS} $@ # not required when re-compiling +echo "+ make install -j`nproc --all`" +make install -j`nproc --all` + diff --git a/test/ifs_interface/configure_lib.sh b/test/ifs_interface/configure_lib.sh deleted file mode 100755 index cf1609bcb..000000000 --- a/test/ifs_interface/configure_lib.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# custom build script in use at ECMWF - -set -e - -LIB=no -while getopts "l" OPT -do - case "$OPT" in - l) LIB=yes;; - esac -done -shift $((OPTIND-1)) - -#cd ../../ -source env.sh ubuntu # source this from your run script too - -if [[ ${LIB} = yes ]]; then - mkdir build.lib || true # build dir for library - cd build.lib - cmake -DBUILD_FESOM_AS_LIBRARY=ON .. # not required when re-compiling -else - mkdir build || true # build dir for binary - cd build - cmake .. # not required when re-compiling -fi -make install -j`nproc --all`