Skip to content

Commit

Permalink
Merge branch 'main' into nl-solver
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Oct 6, 2023
2 parents c09de43 + 7106470 commit 35d4091
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-${{ matrix.config }}-caceh
key: ${{ runner.os }}-${{ matrix.config }}-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.config }}-cache

- name: Prepare ccache
run: |
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Coverage

on:
push:
branches: [main]
pull_request:

env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2

jobs:
Linux:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
threading: [TBB]
include:
- os: ubuntu-latest
name: Linux
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10

- name: Dependencies
run: |
sudo apt-get update
sudo apt-get -o Acquire::Retries=3 install \
libblas-dev \
libglu1-mesa-dev \
xorg-dev \
mpi \
lcov \
ccache
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-Release-${{ matrix.threading }}-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-Release-${{ matrix.threading }}-cache

- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-stats && ccache --zero-stats
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=Release \
-DPOLYSOLVE_CODE_COVERAGE=ON
- name: Build
run: cd build; make -j2; ccache --show-stats

- name: Run Coverage
run: |
cd build
ctest --verbose --output-on-failure
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*.cpp' --output-file coverage.info
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
flags: polysolve # optional
files: coverage.info
name: polysolve # optional
fail_ci_if_error: false # optional (default = false)
verbose: true # optional (default = false)
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ option(POLYSOLVE_WITH_TESTS "Build unit-tests" ${POLYSOLVE_TOPLEV
include(CMakeDependentOption)
cmake_dependent_option(EIGEN_WITH_MKL "Use Eigen with MKL" ON "POLYSOLVE_WITH_MKL" OFF)

option(POLYSOLVE_CODE_COVERAGE "Enable coverage reporting" OFF)

add_library(polysolve_coverage_config INTERFACE)
if(POLYSOLVE_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Add required flags (GCC & LLVM/Clang)
target_compile_options(polysolve_coverage_config INTERFACE
-g # generate debug info
--coverage # sets all required flags
)
target_link_options(polysolve_coverage_config INTERFACE --coverage)
endif()

# Set default minimum C++ standard
if(POLYSOLVE_TOPLEVEL_PROJECT)
set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -141,6 +153,10 @@ add_library(polysolve)
add_library(polysolve::polysolve ALIAS polysolve)
add_subdirectory(src/polysolve/nonlinear)

target_link_libraries(polysolve_linear PUBLIC polysolve_coverage_config)
target_link_libraries(polysolve PUBLIC polysolve_coverage_config)



target_compile_features(polysolve_linear PUBLIC cxx_std_17)
target_compile_features(polysolve PUBLIC cxx_std_17)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# PolySolve

![Build](https://github.com/polyfem/polysolve/workflows/Build/badge.svg)
[![codecov](https://codecov.io/github/polyfem/polysolve/graph/badge.svg?token=9CTTZX9A2D)](https://codecov.io/github/polyfem/polysolve)

This library contains a cross-platform Eigen wrapper for many different external linear solvers including (but not limited to):

Expand Down
7 changes: 5 additions & 2 deletions cmake/recipes/blas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64" OR "${CMAKE_OSX_ARCHITECTURES}" M
# Use Accelerate on macOS M1
set(BLA_VENDOR Apple)
find_package(BLAS REQUIRED)
else()
# Use MKL on other platforms
elseif(POLYSOLVE_WITH_MKL)
# Use MKL if enabled
include(mkl)
add_library(BLAS::BLAS ALIAS mkl::mkl)
else()
# otherwise find system version
find_package(BLAS REQUIRED)
endif()
7 changes: 5 additions & 2 deletions cmake/recipes/lapack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64" OR "${CMAKE_OSX_ARCHITECTURES}" M
# Use Accelerate on macOS M1
set(BLA_VENDOR Apple)
find_package(LAPACK REQUIRED)
else()
# Use MKL on other platforms
elseif(POLYSOLVE_WITH_MKL)
# Use MKL if enabled
include(mkl)
add_library(LAPACK::LAPACK ALIAS mkl::mkl)
else()
# otherwise find system version
find_package(LAPACK REQUIRED)
endif()

0 comments on commit 35d4091

Please sign in to comment.