Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7eb9e54
Use directory agnostic imports
EmilyBourne Apr 20, 2026
ed53411
Move package searches to root. InputFunctions only needs to be linked…
EmilyBourne Apr 20, 2026
ec909eb
Link includes cleanly
EmilyBourne Apr 20, 2026
1351a29
All tests use input
EmilyBourne Apr 20, 2026
18a3cbe
Set C++ standard globally
EmilyBourne Apr 20, 2026
4e46726
Move LIKWID and MUMPS target definition to cmake/FindX.cmake files
EmilyBourne Apr 20, 2026
08d6ffb
Try for a local version of GTest
EmilyBourne Apr 20, 2026
ed80423
Prefer project paths
EmilyBourne Apr 20, 2026
bdd3cd2
Add an install target
EmilyBourne Apr 20, 2026
7d43a70
Add GMGPolarTargets to ensure we can do find_package(GMGPolar)
EmilyBourne Apr 20, 2026
a01d03e
Use different include paths for local build vs installed library
EmilyBourne Apr 20, 2026
7392ea6
Clang format
EmilyBourne Apr 21, 2026
7a1850f
Merge remote-tracking branch 'GMGPolar/main' into ebourne_cleanup_cmake
EmilyBourne Apr 21, 2026
6e94e02
Fix merge
EmilyBourne Apr 21, 2026
2106436
Merge remote-tracking branch 'GMGPolar/main' into ebourne_cleanup_cmake
EmilyBourne Apr 21, 2026
edaf7d4
Create GMGPolarInterface to hold all CLI/testing interface objects
EmilyBourne Apr 21, 2026
adaca6d
MUMPS dependencies
EmilyBourne Apr 21, 2026
4ee7dbb
Add target aliases
EmilyBourne Apr 22, 2026
c2da216
Can't export aliases
EmilyBourne Apr 22, 2026
3678f5c
Only C++ component required
EmilyBourne Apr 23, 2026
0bacedc
Tests should not be its own project
EmilyBourne Apr 24, 2026
063b52c
Add QUIET to find_package(GTest)
EmilyBourne Apr 24, 2026
f33f81d
Version already set
EmilyBourne Apr 24, 2026
b101c71
Duplicate C++ version specification
EmilyBourne Apr 24, 2026
e1ca3ba
Enable Fortran instead of choosing project languages based on USE_MUMPS
EmilyBourne Apr 27, 2026
0ba4a9e
Clear duplicate project declaration
EmilyBourne Apr 27, 2026
6971888
Review ebourne cleanup cmake (#234)
tpadioleau Apr 30, 2026
924e13f
Merge branch 'main' into ebourne_cleanup_cmake
EmilyBourne May 1, 2026
626bd01
Merge branch 'main' into ebourne_cleanup_cmake
EmilyBourne May 1, 2026
6a9c5da
Fix merge
EmilyBourne May 1, 2026
3c70848
Merge remote-tracking branch 'GMGPolar/main' into ebourne_cleanup_cmake
EmilyBourne May 21, 2026
b55dc96
Use cmake path
EmilyBourne May 21, 2026
53168fe
Fix merge
EmilyBourne May 26, 2026
195f0eb
Merge remote-tracking branch 'GMGPolar/main' into ebourne_cleanup_cmake
EmilyBourne Jun 17, 2026
3846939
Add comment
EmilyBourne Jun 17, 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
7 changes: 3 additions & 4 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ runs:
run: |
apt-get -qq update
apt-get -qq -y install lcov
- name: Install MUMPS Dependencies
shell: bash
run: |
apt-get -qq -y install gfortran
- name: Install additional dependencies to use MUMPS
if: inputs.use-mumps == 'true'
uses: ./.github/actions/install-dependencies
- name: Download build test directory
uses: actions/download-artifact@v7
with:
Expand Down
78 changes: 68 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
cmake_minimum_required(VERSION 3.12)

# Ensure custom cmake modules can be found
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Options should be defined before they're used
option(GMGPOLAR_BUILD_TESTS "Build GMGPolar unit tests." ON)
option(GMGPOLAR_USE_LIKWID "Use LIKWID to measure code (regions)." OFF)
option(GMGPOLAR_USE_MUMPS "Use MUMPS to solve linear systems." OFF)
option(GMGPOLAR_ENABLE_COVERAGE "Enable code coverage reporting (requires GCC/Clang)" OFF)

project(GMGPolar VERSION 2.1.0 LANGUAGES CXX)
# MUMPS does not automatically provide Fortran libraries
if (${GMGPOLAR_USE_MUMPS})
# MUMPS does not automatically provide Fortran libraries
project(GMGPolar VERSION 2.0.0 LANGUAGES CXX Fortran)
else()
project(GMGPolar VERSION 2.0.0 LANGUAGES CXX)
enable_language(Fortran)
endif()

set(CMAKE_CXX_STANDARD 20)
Expand All @@ -23,6 +25,12 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Release")
# If using GNU increase maximum number of instructions considered for inlining
# in Release mode in this folder and sub-folders
add_compile_options(--param max-inline-insns-single=1500)
endif()

# Set coverage compiler flags - must come before any targets are defined
if(GMGPOLAR_ENABLE_COVERAGE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
Expand All @@ -40,14 +48,61 @@ if(GMGPOLAR_ENABLE_COVERAGE)
endif()
endif()

find_package(Kokkos 4.4.1...<5.1 QUIET REQUIRED)
include_directories(include)
find_package(OpenMP REQUIRED COMPONENTS CXX)
find_package(Kokkos 4.4.1...<6 QUIET REQUIRED)

if(GMGPOLAR_USE_MUMPS)
find_package(MUMPS REQUIRED COMPONENTS OpenMP METIS)
endif()

if(GMGPOLAR_USE_LIKWID)
find_package(LIKWID REQUIRED)
endif()

set(GMGPOLAR_INCLUDE_DIRS
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)

include(CMakePackageConfigHelpers)

configure_package_config_file(
cmake/GMGPolarConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/GMGPolarConfig.cmake
INSTALL_DESTINATION lib/cmake/GMGPolar
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/GMGPolarConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/GMGPolarConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/GMGPolarConfigVersion.cmake
cmake/FindMUMPS.cmake
cmake/FindLIKWID.cmake
cmake/FindMetis.cmake
DESTINATION lib/cmake/GMGPolar
)

install(EXPORT GMGPolarTargets
NAMESPACE GMGPolar::
DESTINATION lib/cmake/GMGPolar
)

add_subdirectory(src)

# Create the executables. These test specific cases and are not very useful
# without access to the source code so they are not installed with the
# library
add_executable(gmgpolar src/main.cpp)
add_executable(convergence_order src/convergence_order.cpp)
target_link_libraries(gmgpolar PRIVATE GMGPolarLib)
target_link_libraries(convergence_order PRIVATE GMGPolarLib)
target_link_libraries(gmgpolar PRIVATE GMGPolarLib GMGPolarInterface)
Comment thread
EmilyBourne marked this conversation as resolved.
target_link_libraries(convergence_order PRIVATE GMGPolarLib GMGPolarInterface)

# Builds a single-run inner executable (NAME_run) from SOURCE and generates a
# bash wrapper script NAME that owns the loop over configurations, calling the
Expand All @@ -56,7 +111,7 @@ target_link_libraries(convergence_order PRIVATE GMGPolarLib)
function(add_scaling_wrapper NAME SOURCE SCRIPT_BODY)
set(runner_target ${NAME}_run)
add_executable(${runner_target} ${SOURCE})
target_link_libraries(${runner_target} PRIVATE GMGPolarLib)
target_link_libraries(${runner_target} PRIVATE GMGPolarLib GMGPolarInterface)

set(script "${CMAKE_BINARY_DIR}/${NAME}")
file(GENERATE
Expand Down Expand Up @@ -93,7 +148,10 @@ add_scaling_wrapper(strong_scaling src/strong_scaling.cpp "${STRONG_SCALING_BODY

if(GMGPOLAR_BUILD_TESTS)
enable_testing()
add_subdirectory(third-party)
find_package(GTest 1.17 QUIET)
if (NOT GTest_FOUND)
add_subdirectory(third-party)
endif()
add_subdirectory(tests)

# Add coverage target - moved after test configuration
Expand Down
33 changes: 33 additions & 0 deletions cmake/FindLIKWID.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

if(DEFINED ENV{LIKWID_DIR} AND NOT LIKWID_DIR)
set(LIKWID_DIR "$ENV{LIKWID_DIR}" CACHE PATH "LIKWID installation directory")
endif()

find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIKWID_PC QUIET likwid)
endif()

find_path(LIKWID_INCLUDE_DIR
NAMES likwid.h
HINTS ${LIKWID_DIR}/include ${LIKWID_PC_INCLUDE_DIRS}
)

find_library(LIKWID_LIBRARY
NAMES likwid
HINTS ${LIKWID_DIR}/lib ${LIKWID_DIR}/lib64 ${LIKWID_PC_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIKWID
REQUIRED_VARS LIKWID_INCLUDE_DIR LIKWID_LIBRARY
)

if(LIKWID_FOUND AND NOT TARGET LIKWID::LIKWID)
add_library(LIKWID::LIKWID INTERFACE IMPORTED)
set_target_properties(LIKWID::LIKWID PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIKWID_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${LIKWID_LIBRARY}"
INTERFACE_COMPILE_DEFINITIONS "LIKWID_PERFMON"
)
endif()
56 changes: 56 additions & 0 deletions cmake/FindMUMPS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# Stage 1: prefer an installed MUMPS CMake config (supports COMPONENTS properly)
find_package(MUMPS CONFIG QUIET COMPONENTS ${MUMPS_FIND_COMPONENTS})
if(MUMPS_FOUND)
return()
endif()

# Stage 2: manual discovery via MUMPS_DIR hint
if(DEFINED ENV{MUMPS_DIR} AND NOT MUMPS_DIR)
set(MUMPS_DIR "$ENV{MUMPS_DIR}" CACHE PATH "MUMPS installation directory")
endif()

find_path(MUMPS_INCLUDE_DIR
NAMES dmumps_c.h
HINTS ${MUMPS_DIR}/include
)

foreach(_lib dmumps smumps mumps_common)
find_library(MUMPS_${_lib}_LIBRARY
NAMES ${_lib}
HINTS ${MUMPS_DIR}/lib ${MUMPS_DIR}/lib64
)
list(APPEND _MUMPS_REQUIRED_VARS MUMPS_${_lib}_LIBRARY)
endforeach()

# mpiseq is the sequential MPI stub — only present in sequential builds
find_library(MUMPS_mpiseq_LIBRARY
NAMES mpiseq
HINTS ${MUMPS_DIR}/lib ${MUMPS_DIR}/lib64
${MUMPS_DIR}/libseq ${MUMPS_DIR}/lib/SEQ
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MUMPS
REQUIRED_VARS MUMPS_INCLUDE_DIR ${_MUMPS_REQUIRED_VARS}
)

if(MUMPS_FOUND AND NOT TARGET MUMPS::MUMPS)
find_package(Metis REQUIRED)

set(_mumps_libs
${MUMPS_dmumps_LIBRARY}
${MUMPS_smumps_LIBRARY}
${MUMPS_mumps_common_LIBRARY}
metis::metis
)
if(MUMPS_mpiseq_LIBRARY)
list(APPEND _mumps_libs ${MUMPS_mpiseq_LIBRARY})
endif()

add_library(MUMPS::MUMPS INTERFACE IMPORTED)
set_target_properties(MUMPS::MUMPS PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MUMPS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${_mumps_libs}"
)
endif()
27 changes: 27 additions & 0 deletions cmake/FindMetis.cmake
Comment thread
EmilyBourne marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

if(DEFINED ENV{METIS_DIR} AND NOT METIS_DIR)
set(METIS_DIR "$ENV{METIS_DIR}" CACHE PATH "METIS installation directory")
endif()

find_path(METIS_INCLUDE_DIR
NAMES metis.h
HINTS ${METIS_DIR}/include
)

find_library(METIS_LIBRARY
NAMES metis
HINTS ${METIS_DIR}/lib ${METIS_DIR}/lib64
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Metis
REQUIRED_VARS METIS_INCLUDE_DIR METIS_LIBRARY
)

if(Metis_FOUND AND NOT TARGET metis::metis)
add_library(metis::metis INTERFACE IMPORTED)
set_target_properties(metis::metis PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${METIS_LIBRARY}"
)
endif()
18 changes: 18 additions & 0 deletions cmake/GMGPolarConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@PACKAGE_INIT@

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

include(CMakeFindDependencyMacro)

find_dependency(OpenMP COMPONENTS CXX)
find_dependency(Kokkos)

if(@GMGPOLAR_USE_MUMPS@)
find_dependency(MUMPS COMPONENTS OpenMP METIS)
endif()

if(@GMGPOLAR_USE_LIKWID@)
find_dependency(LIKWID)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/GMGPolarTargets.cmake")
10 changes: 5 additions & 5 deletions include/ConfigParser/config_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include <stdexcept>
#include <memory>

#include "../../include/ConfigParser/cmdline.h"
#include "../../include/Definitions/global_definitions.h"
#include "../../include/PolarGrid/polargrid.h"
#include "../../include/GMGPolar/test_cases.h"
#include "../../include/GMGPolar/igmgpolar.h"
#include <ConfigParser/cmdline.h>
#include <Definitions/global_definitions.h>
#include <PolarGrid/polargrid.h>
#include <GMGPolar/test_cases.h>
#include <GMGPolar/igmgpolar.h>
#include "test_selection.h"

namespace gmgpolar
Expand Down
2 changes: 1 addition & 1 deletion include/ConfigParser/test_selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <variant>

#include "../../include/GMGPolar/test_cases.h"
#include <GMGPolar/test_cases.h>

namespace gmgpolar
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../../../include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h"
#include <ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h>

#include "../../../include/Definitions/geometry_helper.h"
#include <Definitions/geometry_helper.h>

#include "smootherStencil.inl"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../../../include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h"
#include <ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h>

#include "../../../include/Definitions/geometry_helper.h"
#include <Definitions/geometry_helper.h>

namespace extrapolated_smoother_give
{
Expand Down
Loading
Loading