Skip to content

Commit

Permalink
Merge pull request #11790 from KratosMultiphysics/core/new-compile-pi…
Browse files Browse the repository at this point in the history
…peline

[CORE] [Do not merge] Testing new compilation options
  • Loading branch information
roigcarlo committed Mar 18, 2024
2 parents 9bc21c6 + 321b0d9 commit 3052722
Show file tree
Hide file tree
Showing 22 changed files with 615 additions and 387 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/ci-dummy.yml

This file was deleted.

114 changes: 77 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,8 @@ name: CI

on:
pull_request:
merge_group:
branches:
- master
paths-ignore: # This must be the same as .github/workflows/ci_dummy.yml - "paths" !
- '**.md'
- 'documents/**'
- 'scripts/**' # Docker builds will be triggered by `build_docker_image_****.yml` workflows.
- '.github/workflows/ci-dummy.yml'
- '.github/workflows/build_docker_image*.yml'
- '.github/workflows/nightly_build.yml'
- 'kratos/templates/**'
- 'kratos/python_scripts/application_generator/**'
- 'docs/**'
- '.github/workflows/jekyll-gh-pages.yml'

workflow_dispatch:

Expand Down Expand Up @@ -56,8 +44,9 @@ jobs:
KRATOS_BUILD_TYPE: ${{ matrix.build-type }}
KRATOS_CI_CHANGED_FILES: ${{needs.changed-files.outputs.files}}
KRATOS_CI_APPLICATIONS: ".github/workflows/ci_apps_linux.json"
OMPI_MCA_rmaps_base_oversubscribe: 1 # Allow oversubscription for MPI (needed for OpenMPI >= 3.0)
OMPI_MCA_btl_vader_single_copy_mechanism: none # suppressing some annoying OpenMPI messages
KRATOS_CI_CORES: 4 # Current limits are 4 CPU and 16 GB Ram
OMPI_MCA_rmaps_base_oversubscribe: 1 # Allow oversubscription for MPI (needed for OpenMPI >= 3.0)
OMPI_MCA_btl_vader_single_copy_mechanism: none # Suppressing some annoying OpenMPI messages

container:
image: kratosmultiphysics/kratos-image-ci-ubuntu-22-04:latest
Expand All @@ -79,21 +68,88 @@ jobs:
if [ ${{ matrix.compiler }} = gcc ]; then
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export KRATOS_CMAKE_OPTIONS_FLAGS="-DUSE_EIGEN_MKL=ON -DUSE_EIGEN_FEAST=ON -DTRILINOS_EXCLUDE_AMESOS2_SOLVER=OFF -DMMG_ROOT=/external_libraries/mmg/mmg_5_5_1/ -DPMMG_ROOT=/external_libraries/ParMmg_5ffc6ad -DINCLUDE_PMMG=ON"
export KRATOS_CMAKE_OPTIONS_FLAGS="-DUSE_EIGEN_MKL=ON -DUSE_EIGEN_FEAST=ON -DTRILINOS_EXCLUDE_AMESOS2_SOLVER=OFF"
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations -Wignored-qualifiers"
elif [ ${{ matrix.compiler }} = clang ]; then
export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations"
export KRATOS_CMAKE_OPTIONS_FLAGS="-DTRILINOS_EXCLUDE_AMESOS2_SOLVER=OFF -DMMG_ROOT=/external_libraries/mmg/mmg_5_5_1/"
export KRATOS_CMAKE_OPTIONS_FLAGS="-DTRILINOS_EXCLUDE_AMESOS2_SOLVER=OFF"
else
echo 'Unsupported compiler: ${{ matrix.compiler }}'
exit 1
fi
source /opt/intel/oneapi/setvars.sh
cp .github/workflows/configure.sh configure.sh
cp .github/workflows/configure_core.sh configure.sh
python3 kratos/python_scripts/testing/ci_utilities.py
bash configure.sh
rm -r ${GITHUB_WORKSPACE}/build
- name: Build Dependencies
shell: bash
run: |
if [ ${{ matrix.compiler }} = gcc ]; then
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export KRATOS_CMAKE_OPTIONS_FLAGS="-DMMG_ROOT=/external_libraries/mmg/mmg_5_5_1/ -DPMMG_ROOT=/external_libraries/ParMmg_5ffc6ad -DINCLUDE_PMMG=ON"
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations -Wignored-qualifiers"
elif [ ${{ matrix.compiler }} = clang ]; then
export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations"
export KRATOS_CMAKE_OPTIONS_FLAGS="-DMMG_ROOT=/external_libraries/mmg/mmg_5_5_1/"
else
echo 'Unsupported compiler: ${{ matrix.compiler }}'
exit 1
fi
source /opt/intel/oneapi/setvars.sh
cp .github/workflows/configure_dependencies.sh configure.sh
bash configure.sh
rm -r ${GITHUB_WORKSPACE}/build
- name: Build Core Apps
shell: bash
run: |
if [ ${{ matrix.compiler }} = gcc ]; then
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export KRATOS_CMAKE_OPTIONS_FLAGS=""
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations -Wignored-qualifiers"
elif [ ${{ matrix.compiler }} = clang ]; then
export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations"
export KRATOS_CMAKE_OPTIONS_FLAGS=""
else
echo 'Unsupported compiler: ${{ matrix.compiler }}'
exit 1
fi
source /opt/intel/oneapi/setvars.sh
cp .github/workflows/configure_core_applications.sh configure.sh
bash configure.sh
rm -r ${GITHUB_WORKSPACE}/build
- name: Build Research Apps
shell: bash
run: |
if [ ${{ matrix.compiler }} = gcc ]; then
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export KRATOS_CMAKE_OPTIONS_FLAGS=""
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations -Wignored-qualifiers"
elif [ ${{ matrix.compiler }} = clang ]; then
export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations"
export KRATOS_CMAKE_OPTIONS_FLAGS=""
else
echo 'Unsupported compiler: ${{ matrix.compiler }}'
exit 1
fi
source /opt/intel/oneapi/setvars.sh
cp .github/workflows/configure_research_applications.sh configure.sh
bash configure.sh
rm -r ${GITHUB_WORKSPACE}/build
- name: Running python tests
shell: bash
Expand Down Expand Up @@ -244,7 +300,6 @@ jobs:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GITHUB_WORKSPACE}/bin/Custom/libs
python3.8 kratos/python_scripts/testing/run_tests.py -l nightly -c python3.8
ubuntu-core-without-unity:
runs-on: ubuntu-latest
needs: changed-files
Expand All @@ -257,12 +312,6 @@ jobs:
container:
image: kratosmultiphysics/kratos-image-ci-ubuntu-22-04:latest
options: --user 1001
env:
CCACHE_SLOPPINESS: pch_defines,time_macros
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: true
CCACHE_NODISABLE: true
CCACHE_MAXSIZE: 500M

steps:
- uses: actions/checkout@v4
Expand All @@ -271,24 +320,16 @@ jobs:
shell: bash
run: python3 kratos/python_scripts/testing/ci_utilities.py

- name: Cache Build
id: cache-build
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ runner.os }}-no-unity-ccache-${{ github.sha }}
restore-keys: ${{ runner.os }}-no-unity-ccache-

- name: Build
shell: bash
run: |
export CC=/usr/lib/ccache/clang-14
export CXX=/usr/lib/ccache/clang++-14
export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14
export KRATOS_SOURCE="${KRATOS_SOURCE:-${PWD}}"
export KRATOS_BUILD="${KRATOS_SOURCE}/build"
export KRATOS_APP_DIR="${KRATOS_SOURCE}/applications"
export PYTHON_EXECUTABLE="/usr/bin/python3.10"
export PYTHON_EXECUTABLE="/usr/bin/python3"
export KRATOS_INSTALL_PYTHON_USING_LINKS=ON
add_app () {
Expand All @@ -310,10 +351,9 @@ jobs:
-DKRATOS_USE_PCH=ON
# Build
# Please do not use more than 2 cores or it will produce an out of heap memory error
cmake --build "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" --target install -- -j2
ccache -s
- name: Running python tests
shell: bash
run: |
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/configure_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# You can use your interpreter of choice (bash, sh, zsh, ...)

# For any question please contact with us in:
# - https://github.com/KratosMultiphysics/Kratos

# Optional parameters:
# You can find a list with all the compilation options in INSTALL.md or here:
# - https://github.com/KratosMultiphysics/Kratos/wiki/Compilation-options

add_app () {
export KRATOS_APPLICATIONS="${KRATOS_APPLICATIONS}$1;"
}

# Set variables
export KRATOS_SOURCE="${KRATOS_SOURCE:-${PWD}}"
export KRATOS_BUILD="${KRATOS_SOURCE}/build"
export KRATOS_APP_DIR="${KRATOS_SOURCE}/applications"
export PYTHON_EXECUTABLE="/usr/bin/python3.10"
export KRATOS_INSTALL_PYTHON_USING_LINKS=ON

# Set applications to compile
add_app ${KRATOS_APP_DIR}/LinearSolversApplication;
add_app ${KRATOS_APP_DIR}/MetisApplication;
add_app ${KRATOS_APP_DIR}/TrilinosApplication;

# Clean
clear
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/cmake_install.cmake"
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/CMakeCache.txt"
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/CMakeFiles"

echo "Kratos build type is ${KRATOS_BUILD_TYPE}"

# Configure
cmake -H"${KRATOS_SOURCE}" -B"${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" \
${KRATOS_CMAKE_OPTIONS_FLAGS} \
-DUSE_MPI=ON \
-DCMAKE_CXX_FLAGS="${KRATOS_CMAKE_CXX_FLAGS} -O0 -Wall" \
-DTRILINOS_INCLUDE_DIR="/usr/include/trilinos" \
-DTRILINOS_LIBRARY_DIR="/usr/lib/x86_64-linux-gnu" \
-DTRILINOS_LIBRARY_PREFIX="trilinos_" \
-DCMAKE_UNITY_BUILD=ON

# Build
cmake --build "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" --target install -- -j${KRATOS_CI_CORES}
52 changes: 52 additions & 0 deletions .github/workflows/configure_core_applications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
# You can use your interpreter of choice (bash, sh, zsh, ...)

# For any question please contact with us in:
# - https://github.com/KratosMultiphysics/Kratos

# Optional parameters:
# You can find a list with all the compilation options in INSTALL.md or here:
# - https://github.com/KratosMultiphysics/Kratos/wiki/Compilation-options

add_app () {
export KRATOS_APPLICATIONS="${KRATOS_APPLICATIONS}$1;"
}

# Set variables
export KRATOS_SOURCE="${KRATOS_SOURCE:-${PWD}}"
export KRATOS_BUILD="${KRATOS_SOURCE}/build"
export KRATOS_APP_DIR="${KRATOS_SOURCE}/applications"
export PYTHON_EXECUTABLE="/usr/bin/python3.10"
export KRATOS_INSTALL_PYTHON_USING_LINKS=ON

# Set applications to compile
add_app ${KRATOS_APP_DIR}/FluidDynamicsApplication;
add_app ${KRATOS_APP_DIR}/StructuralMechanicsApplication;
add_app ${KRATOS_APP_DIR}/ConstitutiveLawsApplication;
add_app ${KRATOS_APP_DIR}/GeoMechanicsApplication;
add_app ${KRATOS_APP_DIR}/ConvectionDiffusionApplication;
add_app ${KRATOS_APP_DIR}/RomApplication;

# Clean
clear
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/cmake_install.cmake"
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/CMakeCache.txt"
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/CMakeFiles"

echo "Kratos build type is ${KRATOS_BUILD_TYPE}"

# Configure
cmake -H"${KRATOS_SOURCE}" -B"${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" \
${KRATOS_CMAKE_OPTIONS_FLAGS} \
-DUSE_MPI=ON \
-DEXCLUDE_KRATOS_CORE=ON \
-DEXCLUDE_AUTOMATIC_DEPENDENCIES=ON \
-DREMOVE_INSTALL_DIRECTORIES=OFF \
-DCMAKE_CXX_FLAGS="${KRATOS_CMAKE_CXX_FLAGS} -O0 -Wall" \
-DTRILINOS_INCLUDE_DIR="/usr/include/trilinos" \
-DTRILINOS_LIBRARY_DIR="/usr/lib/x86_64-linux-gnu" \
-DTRILINOS_LIBRARY_PREFIX="trilinos_" \
-DCMAKE_UNITY_BUILD=ON

# Build
cmake --build "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" --target install -- -j${KRATOS_CI_CORES}
54 changes: 54 additions & 0 deletions .github/workflows/configure_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# You can use your interpreter of choice (bash, sh, zsh, ...)

# For any question please contact with us in:
# - https://github.com/KratosMultiphysics/Kratos

# Optional parameters:
# You can find a list with all the compilation options in INSTALL.md or here:
# - https://github.com/KratosMultiphysics/Kratos/wiki/Compilation-options

add_app () {
export KRATOS_APPLICATIONS="${KRATOS_APPLICATIONS}$1;"
}

# Set variables
export KRATOS_SOURCE="${KRATOS_SOURCE:-${PWD}}"
export KRATOS_BUILD="${KRATOS_SOURCE}/build"
export KRATOS_APP_DIR="${KRATOS_SOURCE}/applications"
export PYTHON_EXECUTABLE="/usr/bin/python3.10"
export KRATOS_INSTALL_PYTHON_USING_LINKS=ON

# Set applications to compile
add_app ${KRATOS_APP_DIR}/HDF5Application;
add_app ${KRATOS_APP_DIR}/MedApplication;
add_app ${KRATOS_APP_DIR}/MappingApplication;
add_app ${KRATOS_APP_DIR}/MeshMovingApplication;
add_app ${KRATOS_APP_DIR}/MeshingApplication;
add_app ${KRATOS_APP_DIR}/StatisticsApplication;


# Clean
clear
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/cmake_install.cmake"
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/CMakeCache.txt"
rm -rf "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}/CMakeFiles"

echo "Kratos build type is ${KRATOS_BUILD_TYPE}"

# Configure
cmake -H"${KRATOS_SOURCE}" -B"${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" \
${KRATOS_CMAKE_OPTIONS_FLAGS} \
-DUSE_MPI=ON \
-DEXCLUDE_KRATOS_CORE=ON \
-DEXCLUDE_AUTOMATIC_DEPENDENCIES=ON \
-DREMOVE_INSTALL_DIRECTORIES=OFF \
-DCMAKE_CXX_FLAGS="${KRATOS_CMAKE_CXX_FLAGS} -O0 -Wall" \
-DTRILINOS_INCLUDE_DIR="/usr/include/trilinos" \
-DTRILINOS_LIBRARY_DIR="/usr/lib/x86_64-linux-gnu" \
-DTRILINOS_LIBRARY_PREFIX="trilinos_" \
-DCMAKE_UNITY_BUILD=ON \
-DINCLUDE_MMG=ON \

# Build
cmake --build "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" --target install -- -j${KRATOS_CI_CORES}

0 comments on commit 3052722

Please sign in to comment.