Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ runs:
shell: bash
run: |
sudo apt-get -qq update
sudo apt-get -qq install gcc-11
sudo apt-get -qq -y install g++-11
sudo apt-get -qq -y install lcov
sudo apt-get -qq install gcc-13
sudo apt-get -qq -y install g++-13
sudo apt-get -qq -y install lcov
- name: Build
shell:
# ensure that the installed compiler version is used
run: |
export CC=/usr/bin/gcc-11
export CXX=/usr/bin/g++-11
export CC=/usr/bin/gcc-13
export CXX=/usr/bin/g++-13
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DGMGPOLAR_TEST_COVERAGE=ON ..
make -j4
Expand Down
44 changes: 22 additions & 22 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ runs:
cd build/tests
sudo chmod a+x gmgpolar_tests
./gmgpolar_tests --gtest_output="xml:testreport.xml"
- name: Compute code coverage
shell: bash
# compute code coverage
run: |
cd build
cmake --build . --target coverage/fast
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: build/tests/testreport.xml
if-no-files-found: error
retention-days: 3
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: test-coverage-reports
path: |
build/coverage.info
build/coverage
if-no-files-found: error
retention-days: 1
# - name: Compute code coverage
# shell: bash
# # compute code coverage
# run: |
# cd build
# cmake --build . --target coverage/fast
# - name: Upload test report
# uses: actions/upload-artifact@v4
# with:
# name: test-report
# path: build/tests/testreport.xml
# if-no-files-found: error
# retention-days: 3
# - name: Upload coverage reports
# uses: actions/upload-artifact@v4
# with:
# name: test-coverage-reports
# path: |
# build/coverage.info
# build/coverage
# if-no-files-found: error
# retention-days: 1
44 changes: 22 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/build

run-unit-test:
needs: install-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/test
with:
build-artifact: build-cpp-linux-gmgpolar

codecov:
if: github.event.pull_request.draft == false
needs: [run-unit-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq -y install git curl
- name: Download cpp coverage report
uses: actions/download-artifact@v3
with:
name: test-coverage-reports
- name: Deploy to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.info
verbose: true
# codecov:
# if: github.event.pull_request.draft == false
# needs: [run-unit-test]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install dependencies
# run: |
# sudo apt-get -qq update
# sudo apt-get -qq -y install git curl
# - name: Download cpp coverage report
# uses: actions/download-artifact@v4
# with:
# name: test-coverage-reports
# - name: Deploy to codecov.io
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage.info
# verbose: true
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

.vscode/

.github/

Output/

*.vtu
Expand Down
133 changes: 30 additions & 103 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,123 +8,50 @@ option(GMGPOLAR_USE_MUMPS "Use MUMPS to solve linear systems." OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -pedantic -Wno-unused")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -mtune=generic")

# # Mumps: Sparse Matrix Solver
# set(MUMPS_PREFIX_PATH "~/spack/opt/spack/linux-ubuntu20.04-icelake/gcc-9.4.0/mumps-5.6.2-m4xrhc4mshzrxmgptzbpult3nbf6qrzk")
# include_directories(${MUMPS_PREFIX_PATH}/include)
# link_directories(${MUMPS_PREFIX_PATH}/lib)

# # Metis: Matrix reordering for Mumps
# set(METIS_PREFIX_PATH "~/spack/opt/spack/linux-ubuntu20.04-icelake/gcc-9.4.0/metis-5.1.0-bgoncx22w55soviybggl5ydjakvkm34v")
# include_directories(${METIS_PREFIX_PATH}/include)
# link_directories(${METIS_PREFIX_PATH}/lib)

# # Likwid: Performance monitoring
# set(LIKWID_PREFIX_PATH "~/spack/opt/spack/linux-ubuntu20.04-icelake/gcc-9.4.0/likwid-5.3.0-6mvx2snsqnamuyhaqspd6gxkfuaso36g")
# include_directories(${LIKWID_PREFIX_PATH}/include)
# link_directories(${LIKWID_PREFIX_PATH}/lib)

# Include directories for the project
include_directories(include)

# 1. Create a library target for the PolarGrid module
file(GLOB_RECURSE POLAR_GRID_SOURCES "src/PolarGrid/*.cpp")
add_library(PolarGrid STATIC ${POLAR_GRID_SOURCES})
target_include_directories(PolarGrid PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/PolarGrid)

# 2. Create a library target for the InputFunctions module
file(GLOB_RECURSE INPUT_FUNCTIONS_SOURCES
"src/InputFunctions/DensityProfileCoefficients/*.cpp"
"src/InputFunctions/DomainGeometry/*.cpp"
"src/InputFunctions/ExactSolution/*.cpp"
"src/InputFunctions/BoundaryConditions/*.cpp"
"src/InputFunctions/SourceTerms/*.cpp"
)
add_library(InputFunctions STATIC ${INPUT_FUNCTIONS_SOURCES})
target_include_directories(InputFunctions PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/InputFunctions)

# 3. Collect all the common source files for GMGPolar into a library
file(GLOB_RECURSE GMG_POLAR_SOURCES "src/GMGPolar/*.cpp")
file(GLOB_RECURSE MULTIGRID_METHODS_SOURCES "src/GMGPolar/MultigridMethods/*.cpp")
file(GLOB_RECURSE LEVEL_SOURCES "src/Level/*.cpp")
file(GLOB_RECURSE STENCIL_SOURCES "src/Stencil/*.cpp")
file(GLOB_RECURSE INTERPOLATION_SOURCES "src/Interpolation/*.cpp")
file(GLOB_RECURSE DIRECT_SOLVER_SOURCES "src/DirectSolver/*.cpp" "src/DirectSolverGive/*.cpp" "src/DirectSolverTake/*.cpp" "src/DirectSolverGiveCustomLU/*.cpp" "src/DirectSolverTakeCustomLU/*.cpp")
file(GLOB_RECURSE RESIDUAL_SOURCES "src/Residual/*.cpp" "src/Residual/ResidualGive/*.cpp" "src/Residual/ResidualTake/*.cpp")
file(GLOB_RECURSE SMOOTHER_SOURCES "src/Smoother/*.cpp" "src/SmootherGive/*.cpp" "src/SmootherTake/*.cpp")
file(GLOB_RECURSE EXTRAPOLATED_SMOOTHER_SOURCES "src/ExtrapolatedSmoother/*.cpp" "src/ExtrapolatedSmoother/ExtrapolatedSmootherGive/*.cpp" "src/ExtrapolatedSmoother/ExtrapolatedSmootherTake/*.cpp")

# 4. Create the GMGPolarLib library and link PolarGrid and InputFunctions
add_library(GMGPolarLib STATIC
${GMG_POLAR_SOURCES}
${MULTIGRID_METHODS_SOURCES}
${LEVEL_SOURCES}
${STENCIL_SOURCES}
${INTERPOLATION_SOURCES}
${DIRECT_SOLVER_SOURCES}
${RESIDUAL_SOURCES}
${SMOOTHER_SOURCES}
${EXTRAPOLATED_SMOOTHER_SOURCES}
)
# Link PolarGrid and InputFunctions to GMGPolarLib
target_link_libraries(GMGPolarLib PUBLIC PolarGrid InputFunctions)

# Link Likwid to GMGPolarLib
if(GMGPOLAR_USE_LIKWID)
target_link_libraries(GMGPolarLib PUBLIC likwid)
target_compile_definitions(GMGPolarLib PUBLIC "-DLIKWID_PERFMON")
add_compile_definitions(GMGPOLAR_USE_LIKWID)
endif()

# Link Mumps to GMGPolarLib
if(GMGPOLAR_USE_MUMPS)
set(MUMPS_LIBRARIES
mumps_common
smumps
dmumps
mpiseq
metis
)
target_link_libraries(GMGPolarLib PUBLIC ${MUMPS_LIBRARIES})
add_compile_definitions(GMGPOLAR_USE_MUMPS)
endif()

# Add OpenMP flags if available and link to GMGPolarLib
find_package(OpenMP REQUIRED)
if(OpenMP_CXX_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
target_link_libraries(GMGPolarLib PUBLIC OpenMP::OpenMP_CXX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -pedantic -Wno-unused -Wno-psabi")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -mtune=generic -Wno-psabi")

# code coverage analysis
# Note: this only works under linux and with make
# Ninja creates different directory names which do not work together with this scrupt
# as STREQUAL is case-sensitive https://github.com/TriBITSPub/TriBITS/issues/131, also allow DEBUG as accepted input
option(GMGPOLAR_TEST_COVERAGE "Enable GCov coverage analysis (adds a 'coverage' target)" OFF)

if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG")
if(GMGPOLAR_TEST_COVERAGE)
message(STATUS "Coverage enabled")
include(CodeCoverage)
append_coverage_compiler_flags()
setup_target_for_coverage_lcov(
NAME coverage
EXECUTABLE tests/gmgpolar_tests
LCOV_ARGS --ignore-errors gcov,mismatch
EXCLUDE "${CMAKE_SOURCE_DIR}/tests*" "${CMAKE_SOURCE_DIR}/src/InputFunctions*" "${CMAKE_BINARY_DIR}/*" "/usr*"
)
endif()
endif()

# 5. Add the main executable target (gmgpolar)
set(MAIN_SOURCE "src/main.cpp")
add_executable(gmgpolar ${MAIN_SOURCE})

# 6. Add another executable target (convergence_order)
set(CONVERGENCE_ORDER_SOURCE "src/convergence_order.cpp")
add_executable(convergence_order ${CONVERGENCE_ORDER_SOURCE})

set(WEAK_SCALING_SOURCE "src/weak_scaling.cpp")
add_executable(weak_scaling ${WEAK_SCALING_SOURCE})
include_directories(include)
add_subdirectory(src)

set(STRONG_SCALING_SOURCE "src/strong_scaling.cpp")
add_executable(strong_scaling ${STRONG_SCALING_SOURCE})
add_executable(gmgpolar src/main.cpp)
add_executable(convergence_order src/convergence_order.cpp)
add_executable(weak_scaling src/weak_scaling.cpp)
add_executable(strong_scaling src/strong_scaling.cpp)

# 7. Link GMGPolarLib (which now includes PolarGrid and InputFunctions) to both executables
target_link_libraries(gmgpolar PRIVATE GMGPolarLib)
target_link_libraries(convergence_order PRIVATE GMGPolarLib)
target_link_libraries(weak_scaling PRIVATE GMGPolarLib)
target_link_libraries(strong_scaling PRIVATE GMGPolarLib)

# 9. Enable testing and include other directories
if(GMGPOLAR_BUILD_TESTS)
enable_testing()
add_subdirectory(third-party)
add_subdirectory(tests)
endif()
endif()
Loading