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
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ jobs:
strategy:
matrix:
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
# ADMB 13.1 only supports gcc up to version 12 on Linux
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: mpi4py/setup-mpi@v1
- uses: ssciwr/doxygen-install@v1
- uses: tlylt/install-graphviz@v1
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libfmt-dev libspdlog-dev
run: |
sudo apt-get update
sudo apt-get install -y libfmt-dev libspdlog-dev
- name: Download ADMB
run: "wget https://github.com/admb-project/admb/releases/download/admb-13.1/admb-13.1-linux.zip"
- name: Extract ADMB
Expand All @@ -27,10 +30,12 @@ jobs:
run: mv admb-13.1 admb
- name: ADMB lib names
run: |
ln -s libadmb-x86_64-linux-g++11.so libadmb.so
ln -s libadmbo-x86_64-linux-g++11.so libadmbo.so
ln -s libadmb-contrib-x86_64-linux-g++11.so libadmb-contrib.so
ln -s libadmb-contribo-x86_64-linux-g++11.so libadmb-contribo.so
gcc --version
gcc_version=$(gcc -dumpversion)
ln -s libadmb-x86_64-linux-g++${gcc_version}.so libadmb.so
ln -s libadmbo-x86_64-linux-g++${gcc_version}.so libadmbo.so
ln -s libadmb-contrib-x86_64-linux-g++${gcc_version}.so libadmb-contrib.so
ln -s libadmb-contribo-x86_64-linux-g++${gcc_version}.so libadmb-contribo.so
ls -l
working-directory: admb/lib
- run: mv admb ~/
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ enable_testing()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(fmt REQUIRED)
include_directories(${FMT_INCLUDE_DIRS})
find_package(Spdlog REQUIRED)
include_directories(${SPDLOG_INCLUDE_DIRS})
# link_directories(${SPDLOG_LIBRARY_DIRS}
# ${FMT_LIBRARY_DIRS})

find_package(MPI REQUIRED)
find_program(VALGRIND_EXECUTABLE valgrind)

Expand Down
69 changes: 69 additions & 0 deletions cmake/FindFmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# FindFmt.cmake
# This will define:
# FMT_FOUND - TRUE if found
# FMT_INCLUDE_DIRS - Where include files reside
# FMT_LIBRARIES - Library to link against (if needed)
# fmt::fmt - Imported target (for target_link_libraries)

# Typical locations:
# Ubuntu (apt): /usr/include/fmt
# Mac (brew): /usr/local/include/fmt or /opt/homebrew/include/fmt

# --- Find fmt include directory ---
find_path(
FMT_INCLUDE_DIR
NAMES fmt/core.h
PATHS
/usr/include
/usr/local/include
/opt/homebrew/include
)

find_library(
FMT_LIBRARY
NAMES fmt
PATHS
/usr/lib
/usr/local/lib
/opt/homebrew/lib
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
fmt
REQUIRED_VARS FMT_INCLUDE_DIR
# Library is optional, so no REQUIRED_VARS for FMT_LIBRARY
)

if(FMT_FOUND)
set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR})

if(FMT_LIBRARY)
set(FMT_LIBRARIES ${FMT_LIBRARY})
else()
set(FMT_LIBRARIES "")
endif()

if(NOT TARGET fmt::fmt)
if(FMT_LIBRARY)
add_library(fmt::fmt UNKNOWN IMPORTED)
set_target_properties(fmt::fmt PROPERTIES
IMPORTED_LOCATION "${FMT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIR}"
)
else()
add_library(fmt::fmt INTERFACE IMPORTED)
set_target_properties(fmt::fmt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIR}"
)
endif()
endif()
# --- Optional status messages ---
if(FMT_LIBRARY)
message(STATUS "Found fmt library: ${FMT_LIBRARY}")
else()
message(STATUS "Found fmt headers only (header-only mode)")
endif()
# --- Mark variables as advanced for GUI cleanliness ---
mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY)
endif()
64 changes: 64 additions & 0 deletions cmake/FindSpdlog.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# FindSpdlog.cmake
# This will define:
# SPDLOG_FOUND - TRUE if found
# SPDLOG_INCLUDE_DIRS - Where spdlog/spdlog.h resides
# SPDLOG_LIBRARIES - Library to link against (if needed)
# And it creates:
# spdlog::spdlog - Imported target

# Typical locations:
# Ubuntu (apt): /usr/include/spdlog
# Mac (brew): /usr/local/include/spdlog or /opt/homebrew/include/spdlog

find_path(
SPDLOG_INCLUDE_DIR
NAMES spdlog/spdlog.h
PATHS
/usr/include
/usr/local/include
/opt/homebrew/include
)

# spdlog is typically header-only, but can also be built as a library.
# Try to find a library just in case the user installed it that way.
find_library(
SPDLOG_LIBRARY
NAMES spdlog
PATHS
/usr/lib
/usr/local/lib
/opt/homebrew/lib
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Spdlog
REQUIRED_VARS SPDLOG_INCLUDE_DIR
# Library is optional, so no REQUIRED_VARS for SPDLOG_LIBRARY
)

if(SPDLOG_FOUND)
set(SPDLOG_INCLUDE_DIRS ${SPDLOG_INCLUDE_DIR})

if(SPDLOG_LIBRARY)
set(SPDLOG_LIBRARIES ${SPDLOG_LIBRARY})
else()
# header-only
set(SPDLOG_LIBRARIES "")
endif()

if(NOT TARGET spdlog::spdlog)
if(SPDLOG_LIBRARY)
add_library(spdlog::spdlog UNKNOWN IMPORTED)
set_target_properties(spdlog::spdlog PROPERTIES
IMPORTED_LOCATION "${SPDLOG_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIR}"
)
else()
add_library(spdlog::spdlog INTERFACE IMPORTED)
set_target_properties(spdlog::spdlog PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIR}"
)
endif()
endif()
endif()
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ add_executable(testSeapodymCourier testSeapodymCourier.cxx)
target_link_libraries(testSeapodymCourier PRIVATE seapodym_api)

add_executable(testParallel testParallel.cxx)
target_link_libraries(testParallel PRIVATE seapodym_api spdlog fmt)
target_link_libraries(testParallel PRIVATE seapodym_api spdlog::spdlog fmt::fmt)

add_executable(testTaskFarming testTaskFarming.cxx)
target_link_libraries(testTaskFarming PRIVATE seapodym_api)
Expand All @@ -31,10 +31,10 @@ add_executable(testTaskDepFarming testTaskDepFarming.cxx)
target_link_libraries(testTaskDepFarming PRIVATE seapodym_api)

add_executable(testTaskStepFarming testTaskStepFarming.cxx)
target_link_libraries(testTaskStepFarming PRIVATE seapodym_api spdlog fmt)
target_link_libraries(testTaskStepFarming PRIVATE seapodym_api spdlog::spdlog fmt::fmt)

add_executable(testTaskStepFarmingCohort testTaskStepFarmingCohort.cxx)
target_link_libraries(testTaskStepFarmingCohort PRIVATE seapodym_api spdlog fmt)
target_link_libraries(testTaskStepFarmingCohort PRIVATE seapodym_api spdlog::spdlog fmt::fmt)

add_executable(testDistDataCollector testDistDataCollector.cxx)
target_link_libraries(testDistDataCollector PRIVATE seapodym_api)
Expand Down
4 changes: 3 additions & 1 deletion tests/testDistDataCollector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void test(int numSize, int numChunksPerRank) {
timeGet += toc - tic;
}

MPI_Barrier(MPI_COMM_WORLD);

if (rank == 0) {
int numChunk = ddc.getNumChunks();
int numSize = ddc.getNumSize();
Expand Down Expand Up @@ -120,4 +122,4 @@ int main(int argc, char* argv[]) {
// Finalize the MPI environment
MPI_Finalize();
return 0;
}
}