Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5463713
Update build-and-tests.yml
CINTROINI Apr 8, 2026
c109f8f
Update build-and-tests.yml
CINTROINI Apr 8, 2026
7194168
Update build-and-tests.yml
CINTROINI Apr 8, 2026
653adbf
Reactivate build on Mac OS with MFEM 4.9 and Hypre 3.1.0
CINTROINI Apr 8, 2026
66f8524
Fix code coverage target
CINTROINI Apr 8, 2026
322e76e
Try to use MFEM 4.9 and Hypre 3.1.0 for linux
CINTROINI Apr 8, 2026
2091b42
Update build-and-tests.yml
CINTROINI Apr 8, 2026
16ee2dc
Fix compiler options
CINTROINI Apr 8, 2026
6a5d14a
Update build-and-tests.yml
CINTROINI Apr 8, 2026
a10cdd1
Update build-and-tests.yml
CINTROINI Apr 8, 2026
bf13b43
Update build-and-tests.yml
CINTROINI Apr 8, 2026
2685272
Cpplint recomandations and CI actions
CINTROINI Apr 9, 2026
f847eff
CI tests
CINTROINI Apr 9, 2026
8260ee7
Update build-and-tests.yml
CINTROINI Apr 9, 2026
7825fc9
Update spack.yaml
CINTROINI Apr 9, 2026
1e9102d
Update spack.yaml
CINTROINI Apr 9, 2026
f96c980
Update build-and-tests.yml
CINTROINI Apr 9, 2026
147365c
CI tests
CINTROINI Apr 9, 2026
82a1854
Update spack.yaml
CINTROINI Apr 9, 2026
5de24fa
Update build-and-tests.yml
CINTROINI Apr 9, 2026
42a3ff8
CI tests
CINTROINI Apr 9, 2026
7266379
CI tests
CINTROINI Apr 9, 2026
c64da15
CI tests...
CINTROINI Apr 9, 2026
b688b66
update CI tests
CINTROINI Apr 9, 2026
12cbc9c
Update spack.yaml
CINTROINI Apr 9, 2026
a896fbc
Update build-and-tests.yml
CINTROINI Apr 9, 2026
1a1316e
update ci
CINTROINI Apr 9, 2026
ff8b74e
Update spack.yaml
CINTROINI Apr 9, 2026
61abe01
Update spack.yaml
CINTROINI Apr 9, 2026
26630d8
CI tests
CINTROINI Apr 9, 2026
40229f5
Update CMakeLists.txt
CINTROINI Apr 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 85 additions & 66 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
jobs:
build-linux:
runs-on: ${{ matrix.os }}
env:
CORES: $(nproc)

strategy:
matrix:
Expand All @@ -24,6 +22,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set number of cores
run: echo "CORES=$(nproc)" >> $GITHUB_ENV

- name: Set up Spack
uses: spack/setup-spack@v2
with:
Expand All @@ -35,20 +36,16 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y mpich wget unzip libboost-all-dev libopenblas-dev perl

sudo apt-get install -y mpich libmpich-dev wget unzip libncurses-dev libboost-all-dev libopenblas-dev perl
- name: Install MFEM
shell: spack-bash {0}
run: |
spack env activate .

spack mirror add ghcr oci://ghcr.io/spack/github-actions-buildcache || true
spack buildcache keys --install --trust

spack compiler find
spack external find openmpi mpich openblas perl

spack env activate .
spack concretize -f
spack install --fail-fast --use-buildcache auto

spack install -j $CORES --fail-fast

echo "ExprTk_INCLUDE_DIR=$(spack location -i exprtk)/include/exprtk" >> $GITHUB_ENV

Expand All @@ -58,27 +55,33 @@ jobs:
cache: 'pip'

- name: Install Python dependencies
run: python -m pip install --upgrade pip gcovr cpplint matplotlib pandas numpy scipy sympy vtk
run: |
python3 -m venv pysloth
source pysloth/bin/activate
python3 -m pip install --upgrade pip gcovr cpplint matplotlib pandas numpy scipy sympy vtk

- name: Build SLOTH
shell: spack-bash {0}
run: |
spack env activate .

source pysloth/bin/activate

mkdir -p ${{ github.workspace }}/build
cd ${{ github.workspace }}/build
bash ../envSloth.sh --coverage --exprtk=$ExprTk_INCLUDE_DIR --np=${{ env.CORES }}
make -j${{ env.CORES }} tests
bash ../envSloth.sh --coverage --exprtk=$ExprTk_INCLUDE_DIR --np=$CORES
make -j $CORES tests


- name: Test SLOTH
shell: spack-bash {0}
run: |
spack env activate .
source pysloth/bin/activate

cd ${{ github.workspace }}/build
find . -name "Save*" |xargs rm -fr
ctest -j${{ env.CORES }} --output-on-failure
find . -type d -name "Save*" -exec rm -rf {} +
ctest -j $CORES --output-on-failure

- name: Save Tests on Failure
if: ${{ failure() }}
Expand All @@ -88,67 +91,83 @@ jobs:
path: ${{ github.workspace }}/build/tests
retention-days: 1

# build-MacOS:
# runs-on: macos-latest
# env:
# CORES: $(sysctl -n hw.ncpu)
# steps:
# - uses: actions/checkout@v4
build-MacOS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Set number of cores
run: echo "CORES=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV

- name: Install MFEM
run: brew install mfem

- name: Setup Python
uses: actions/setup-python@v5
with:
cache: 'pip'

# - name: Install MFEM
# run: brew install mfem
- name: Install Python dependencies
run: |
python3 -m venv pysloth
source pysloth/bin/activate
python3 -m pip install --upgrade pip gcovr cpplint matplotlib pandas numpy scipy sympy vtk

# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'

# - name: Install Python dependencies
# run: python -m pip install --upgrade pip gcovr cpplint matplotlib pandas numpy scipy

# - name: Build SLOTH
# run: |
# mkdir -p ${{ github.workspace }}/build
# cd ${{ github.workspace }}/build
# bash ../envSloth.sh --coverage
# make -j${{ env.CORES }}

# - name: Test SLOTH
# run: |
# cd ${{ github.workspace }}/build
# ctest -j${{ env.CORES }} --output-on-failure

# - name: Save Tests on Failure
# if: ${{ failure() }}
# uses: actions/upload-artifact@v4
# with:
# name: test-reports-macos
# path: ${{ github.workspace }}/build/tests
# retention-days: 1

# - name: Code Coverage Analysis
# if: ${{ always() }}
# run: |
# cd ${{ github.workspace }}/build
# make cc

# - name: Save Code Coverage Analysis
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report
# path: ${{ github.workspace }}/build/Coverage
# retention-days: 1
- name: Install ExprTk
run: |
git clone https://github.com/ArashPartow/exprtk.git

- name: Set ExprTk path
run: echo "ExprTk_INCLUDE_DIR=${{ github.workspace }}/exprtk" >> $GITHUB_ENV

- name: Build SLOTH
run: |
source pysloth/bin/activate
mkdir -p ${{ github.workspace }}/build
cd ${{ github.workspace }}/build
bash ../envSloth.sh --coverage --exprtk=$ExprTk_INCLUDE_DIR
make -j $CORES tests

- name: Test SLOTH
run: |
source pysloth/bin/activate
cd ${{ github.workspace }}/build
find . -type d -name "Save*" -exec rm -rf {} +
ctest -j $CORES --output-on-failure

- name: Save Tests on Failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-reports-macos
path: ${{ github.workspace }}/build/tests
retention-days: 1

- name: Code Coverage Analysis
if: ${{ always() }}
run: |
source pysloth/bin/activate
cd ${{ github.workspace }}/build
make cc

- name: Save Code Coverage Analysis
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ${{ github.workspace }}/build/Coverage
retention-days: 1

- name: CppLint
if: ${{ always() }}
continue-on-error: true
run: |
cd ${{ github.workspace }}/build
cpplint \
--filter=-runtime/references,-build/header_guard,-runtime/string \
--filter=-runtime/references,-build/header_guard,-runtime/string,-build/include \
--counting=total \
--extensions=cpp,cxx,hpp,h,hxx \
--extensions=cpp,cxx,hpp,h,hxx,tpp \
--linelength=100 \
--recursive ../kernel ../tests \
COMMENT "Linting source files"
Expand Down
15 changes: 8 additions & 7 deletions CMakeLists.txt
Comment thread
CINTROINI marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ endif()
# ########################
include(MFEM4SLOTH)

# ########################
# # Compiler options
# ########################
include(COMPILE4SLOTH)

# ########################
# # Sloth header's only
# # library (interface)
Expand All @@ -64,10 +69,6 @@ if(NOT TARGET doc)
add_subdirectory(doc)
endif(NOT TARGET doc)

# ########################
# # Test Configuration
# ########################
include(COMPILE4SLOTH)

# ########################
# LibTorch API ??
Expand Down Expand Up @@ -109,7 +110,7 @@ IF(CMAKE_BUILD_TYPE MATCHES Coverage)
# Collect CodeCoverage analysis with gcovr
add_custom_target(cc
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/Coverage
COMMAND gcovr -r ${CMAKE_SOURCE_DIR} --exclude '${CMAKE_SOURCE_DIR}/kernel/MAToolsProfiling/.*' --sort-uncovered --exclude-unreachable-branches --xml=${CMAKE_BINARY_DIR}/Coverage/coverage.xml --html --html-details -o ${CMAKE_BINARY_DIR}/Coverage/coverage.html
COMMAND gcovr -r ${CMAKE_BINARY_DIR}/kernel --filter ${CMAKE_SOURCE_DIR}/kernel/src --filter ${CMAKE_SOURCE_DIR}/kernel/include --exclude '${CMAKE_SOURCE_DIR}/kernel/include/MAToolsProfiling/.*' --exclude-unreachable-branches --xml=${CMAKE_BINARY_DIR}/Coverage/coverage.xml --html --html-details -o ${CMAKE_BINARY_DIR}/Coverage/coverage.html
COMMENT "Generate Html report for code coverage analysis (see Coverage/coverage.html)"
)
ENDIF()
Expand All @@ -124,9 +125,9 @@ if(NOT TARGET lint)
# Add a custom target for linting
add_custom_target(lint
COMMAND ${CPP_LINT}
--filter=-runtime/references,-build/header_guard,-runtime/string
--filter=-runtime/references,-build/header_guard,-runtime/string,-build/include
--counting=total
--extensions=cpp,cxx,hpp,h,hxx
--extensions=cpp,cxx,hpp,h,hxx,tpp
--linelength=100
--exclude ${CMAKE_SOURCE_DIR}/kernel/MAToolsProfiling
--recursive ${CMAKE_SOURCE_DIR}/kernel ${CMAKE_SOURCE_DIR}/tests
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/COMPILE4SLOTH.cmake
Comment thread
CINTROINI marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(COVERAGE_OPTIONS -g -O0 --coverage)
set(COVERAGE_LINK_OPTIONS --coverage)

# Function called at each build
function(set_compile_options target)
function(set_compile_options CURRENT_EXE)
if(CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_options(${CURRENT_EXE} PRIVATE ${DEBUG_OPTIONS})

Expand Down
2 changes: 1 addition & 1 deletion kernel/CMakeLists.txt
Comment thread
CINTROINI marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ else()
add_library(Sloth STATIC)
endif(SLOTH_USE_SHARED)


# Get all cpp files
file(GLOB_RECURSE SLOTH_SRC CONFIGURE_DEPENDS
${CMAKE_SOURCE_DIR}/kernel/src/*.cpp
Expand All @@ -18,6 +17,7 @@ if(NOT SLOTH_USE_EXPRTK)
endif()

target_sources(Sloth PRIVATE ${SLOTH_SRC})
set_compile_options(Sloth)

set_target_properties(Sloth PROPERTIES
CXX_STANDARD 20
Expand Down
1 change: 0 additions & 1 deletion kernel/include/BCs/Boundary.hpp
Comment thread
CINTROINI marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Boundary {
std::string boundary_name_;
BoundaryConditionType::value boundary_type_;
int boundary_index_;
bool is_essential_boundary_{false};
bool is_periodic_boundary_{false};
double boundary_value_{0.};

Expand Down
2 changes: 1 addition & 1 deletion kernel/include/Convergence/Convergence.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
template <class... Args>
Convergence::Convergence(Args... args) {
this->vect_convergence_ = std::vector<PhysicalConvergence>{args...};
}
}
2 changes: 1 addition & 1 deletion kernel/include/Parameters/Parameters.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ T Parameters::get_param_value(const std::string& name) const {
" Not Found. Please check the data.\n##############";
mfem::mfem_error(error_mess.c_str());
}
}
}
8 changes: 4 additions & 4 deletions kernel/src/BCs/Boundary.cpp
Comment thread
CINTROINI marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
Boundary::Boundary(const std::string& boundary_name, int boundary_index,
const std::string& boundary_type)
: boundary_name_(boundary_name),
boundary_index_(boundary_index),
boundary_type_(BoundaryConditionType::from(boundary_type)) {
boundary_type_(BoundaryConditionType::from(boundary_type)),
boundary_index_(boundary_index) {
switch (boundary_type_) {
case BoundaryConditionType::Dirichlet:
case BoundaryConditionType::Neumann:
Expand Down Expand Up @@ -76,9 +76,9 @@ Boundary::Boundary(const std::string& boundary_name, int boundary_index,
Boundary::Boundary(const std::string& boundary_name, int boundary_index,
const std::string& boundary_type, double boundary_value)
: boundary_name_(boundary_name),
boundary_type_(BoundaryConditionType::from(boundary_type)),
boundary_index_(boundary_index),
boundary_value_(boundary_value),
boundary_type_(BoundaryConditionType::from(boundary_type)) {
boundary_value_(boundary_value) {
this->is_periodic_boundary_ = false;
if (boundary_type_ != BoundaryConditionType::Dirichlet) {
mfem::mfem_error(
Expand Down
16 changes: 10 additions & 6 deletions spack.yaml
Comment thread
CINTROINI marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
spack:

specs:
- hypre@2.33.0 +shared
- mfem@4.8.0 +mpi +suite-sparse +sundials +superlu-dist
- hypre@3.1.0 +shared %gcc@14
- mfem@4.9.0 +mpi +suite-sparse +sundials +superlu-dist %gcc@14
- exprtk

concretizer:
unify: true


packages:
mpi:
buildable: true
buildable: false
openblas:
buildable: true
buildable: false
perl:
buildable: true
buildable: false
ncurses:
buildable: false
intel-oneapi-mkl:
buildable: false
Loading