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
3 changes: 2 additions & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ jobs:
-DPETSC_DIR=${{ runner.temp }}/petsc-openmpi \
-DPETSC_ARCH=ubuntu-kokkos \
-DPCMS_TIMEOUT=10 \
-DPCMS_ENABLE_SPDLOG=OFF \
-DCatch2_DIR=${{ runner.temp }}/build-Catch2-openmpi/install/lib/cmake/Catch2 \
-DOmega_h_DIR=${{ runner.temp }}/build-omega_h-openmpi/install/lib/cmake/Omega_h \
-Dmeshfields_DIR=${{ runner.temp }}/build-meshFields-openmpi/install/lib/cmake/meshfields \
Expand Down Expand Up @@ -235,4 +236,4 @@ jobs:
echo "Some C/C++ files have clang-tidy issues. Please fix them with clang-tidy-18."
exit 1
fi
echo "All C/C++ files pass clang-tidy checks"
echo "All C/C++ files pass clang-tidy checks"
1 change: 1 addition & 0 deletions .github/workflows/cmake-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ jobs:
-DPETSC_DIR=${{ runner.temp }}/petsc
-DPETSC_ARCH=ubuntu-kokkos
-DPCMS_TIMEOUT=10
-DPCMS_ENABLE_SPDLOG=OFF
-DCatch2_DIR=${{ runner.temp }}/build-Catch2/install/lib/cmake/Catch2
-DOmega_h_DIR=${{ runner.temp }}/build-omega_h/install/lib/cmake/Omega_h
-Dmeshfields_DIR=${{ runner.temp }}/build-meshFields/install/lib/cmake/meshfields
Expand Down
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ option(PCMS_ENABLE_XGC "enable xgc field adapter" ON)
option(PCMS_ENABLE_OMEGA_H "enable Omega_h field adapter" OFF)
option(PCMS_ENABLE_C "Enable pcms C api" ON)

option(PCMS_PRINT_ENABLED "PCMS print statements enabled" ON)
find_package(spdlog QUIET)
option(PCMS_ENABLE_PRINT "PCMS print statements enabled" ON)
option(PCMS_ENABLE_SPDLOG "use spdlog for logging" ON)

if(PCMS_ENABLE_SPDLOG)
find_package(spdlog REQUIRED)
endif()

# find package before fortran enabled, so we don't require the adios2 fortran
# interfaces this is important because adios2 build with clang/gfortran is
Expand Down Expand Up @@ -58,7 +62,7 @@ if(PCMS_ENABLE_OMEGA_H)
endif()
endif()
# adios2 adds C and Fortran depending on how it was built
find_package(ADIOS2 CONFIG 2.5 REQUIRED)
find_package(ADIOS2 CONFIG 2.10.2 REQUIRED)
find_package(Kokkos CONFIG 4.5 REQUIRED)

find_package(meshfields REQUIRED)
Expand Down
156 changes: 85 additions & 71 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,53 @@
# TODO split out the field transfer library
set(PCMS_HEADERS
pcms.h
pcms/arrays.h
pcms/assert.h
pcms/bounding_box.h
pcms/common.h
pcms/coordinate.h
pcms/coordinate_systems.h
pcms/coordinate_transform.h
pcms/field.h
pcms/create_field.h
pcms/field_communicator.h
pcms/field_communicator2.h
pcms/field_evaluation_methods.h
pcms/memory_spaces.h
pcms/types.h
pcms/array_mask.h
pcms/inclusive_scan.h
pcms/profile.h
pcms/print.h
pcms/partition.h
pcms/coupler.h
pcms/coordinate_system.h
pcms/field_layout.h
pcms/adapter/point_cloud/point_cloud_layout.h
pcms/adapter/point_cloud/point_cloud.h
pcms/adapter/omega_h/omega_h_field_layout.h
pcms/adapter/omega_h/omega_h_field2.h)
set(
PCMS_HEADERS
pcms.h
pcms/arrays.h
pcms/assert.h
pcms/bounding_box.h
pcms/common.h
pcms/coordinate.h
pcms/coordinate_systems.h
pcms/coordinate_transform.h
pcms/field.h
pcms/create_field.h
pcms/field_communicator.h
pcms/field_communicator2.h
pcms/field_evaluation_methods.h
pcms/memory_spaces.h
pcms/types.h
pcms/array_mask.h
pcms/inclusive_scan.h
pcms/profile.h
pcms/print.h
pcms/partition.h
pcms/coupler.h
pcms/coordinate_system.h
pcms/field_layout.h
pcms/adapter/point_cloud/point_cloud_layout.h
pcms/adapter/point_cloud/point_cloud.h
pcms/adapter/omega_h/omega_h_field_layout.h
pcms/adapter/omega_h/omega_h_field2.h
)

set(PCMS_SOURCES
pcms.cpp
pcms/assert.cpp
pcms/print.cpp
pcms/create_field.cpp
pcms/adapter/xgc/xgc_field_adapter.h
pcms/adapter/point_cloud/point_cloud_layout.cpp
pcms/adapter/point_cloud/point_cloud.cpp
pcms/adapter/omega_h/omega_h_field_layout.cpp
pcms/adapter/omega_h/omega_h_field2.cpp
pcms/adapter/xgc/xgc_field_adapter.h)
set(
PCMS_SOURCES
pcms.cpp
pcms/assert.cpp
pcms/print.cpp
pcms/create_field.cpp
pcms/adapter/xgc/xgc_field_adapter.h
pcms/adapter/point_cloud/point_cloud_layout.cpp
pcms/adapter/point_cloud/point_cloud.cpp
pcms/adapter/omega_h/omega_h_field_layout.cpp
pcms/adapter/omega_h/omega_h_field2.cpp
pcms/adapter/xgc/xgc_field_adapter.h
)

configure_file(pcms/version.h.in pcms/version.h)
configure_file(pcms/configuration.h.in pcms/configuration.h)
list(APPEND PCMS_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/pcms/version.h ${CMAKE_CURRENT_BINARY_DIR}/pcms/configuration.h)


if(PCMS_ENABLE_XGC)
list(APPEND PCMS_SOURCES pcms/adapter/xgc/xgc_reverse_classification.cpp)
Expand All @@ -55,40 +62,36 @@ if(PCMS_ENABLE_OMEGA_H)
pcms/transfer_field.h
pcms/transfer_field2.h
pcms/uniform_grid.h
pcms/point_search.h)
pcms/point_search.h
)
endif()

find_package(Kokkos REQUIRED)
find_package(perfstubs REQUIRED)

add_library(pcms_core ${PCMS_SOURCES})
set_target_properties(pcms_core PROPERTIES OUTPUT_NAME pcmscore EXPORT_NAME
core)
set_target_properties(
pcms_core PROPERTIES OUTPUT_NAME pcmscore EXPORT_NAME
core
)
add_library(pcms::core ALIAS pcms_core)
target_compile_features(pcms_core PUBLIC cxx_std_17)
target_link_libraries(pcms_core PUBLIC meshfields::meshfields redev::redev
MPI::MPI_CXX Kokkos::kokkos perfstubs)
target_link_libraries(
pcms_core PUBLIC meshfields::meshfields redev::redev
MPI::MPI_CXX Kokkos::kokkos perfstubs
)
if(PCMS_ENABLE_OMEGA_H)
target_link_libraries(pcms_core PUBLIC Omega_h::omega_h)
target_compile_definitions(pcms_core PUBLIC -DPCMS_HAS_OMEGA_H)
endif()
if(PCMS_ENABLE_SERVER)
target_compile_definitions(pcms_core PUBLIC -DPCMS_HAS_SERVER)
endif()

if(PCMS_HAS_ASAN)
target_compile_options(pcms_core PRIVATE -fsanitize=address
-fno-omit-frame-pointer)
endif()

if(PCMS_PRINT_ENABLED)
add_definitions(-DPCMS_PRINT_ENABLED)
target_compile_definitions(pcms_core INTERFACE -DPCMS_PRINT_ENABLED)
target_compile_options(
pcms_core PRIVATE -fsanitize=address
-fno-omit-frame-pointer
)
endif()

if(spdlog_FOUND)
add_definitions(-DPCMS_SPDLOG_ENABLED)
target_compile_definitions(pcms_core INTERFACE -DPCMS_SPDLOG_ENABLED)
if(PCMS_ENABLE_SPDLOG)
target_link_libraries(pcms_core PUBLIC spdlog::spdlog)
endif()

Expand All @@ -97,8 +100,9 @@ set_target_properties(pcms_core PROPERTIES PUBLIC_HEADER "${PCMS_HEADERS}")
target_include_directories(
pcms_core
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
install(
TARGETS pcms_core
EXPORT pcms_core-targets
Expand All @@ -107,23 +111,29 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms
)

configure_package_config_file(
"${CMAKE_SOURCE_DIR}/config.cmake.in" "${CMAKE_BINARY_DIR}/pcms-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms)
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms
)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/pcms-config-version.cmake"
COMPATIBILITY AnyNewerVersion)
COMPATIBILITY AnyNewerVersion
)

install(FILES "${PROJECT_BINARY_DIR}/pcms-config.cmake"
"${PROJECT_BINARY_DIR}/pcms-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms)
install(
FILES "${PROJECT_BINARY_DIR}/pcms-config.cmake"
"${PROJECT_BINARY_DIR}/pcms-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms
)

install(
EXPORT pcms_core-targets
NAMESPACE pcms::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms
)

add_library(pcms_pcms INTERFACE)
target_link_libraries(pcms_pcms INTERFACE pcms::core)
Expand All @@ -147,11 +157,15 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms
)
# install external headers
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pcms/external/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms/external)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pcms/external/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms/external
)
install(
EXPORT pcms-targets
NAMESPACE pcms::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms
)
2 changes: 1 addition & 1 deletion src/pcms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static_assert(std::is_same_v<LO, redev::LO>,
"pcms and redev LO types must match");
static_assert(std::is_same_v<GO, redev::GO>,
"pcms and redev GO types must match");
#ifdef PCMS_HAS_OMEGA_H
#ifdef PCMS_ENABLE_OMEGA_H
static_assert(std::is_same_v<Real, Omega_h::Real>,
"pcms and Omega_h real types must match");
static_assert(std::is_same_v<LO, Omega_h::LO>,
Expand Down
1 change: 1 addition & 0 deletions src/pcms.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef PCMS_H_
#define PCMS_H_

#include "pcms/configuration.h"
#include "pcms/common.h"
#include "pcms/field_communicator.h"
#include "pcms/adapter/omega_h/omega_h_field.h"
Expand Down
5 changes: 3 additions & 2 deletions src/pcms/adapter/xgc/xgc_reverse_classification.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#include "mdspan/mdspan.hpp"
#include "pcms/arrays.h"
#include "pcms/memory_spaces.h"
#include "pcms/configuration.h"
// #include <filesystem>
#ifdef PCMS_HAS_OMEGA_H
#ifdef PCMS_ENABLE_OMEGA_H
#include <Omega_h_mesh.hpp>
#include "pcms/assert.h"
#endif
Expand Down Expand Up @@ -86,7 +87,7 @@ ReverseClassificationVertex ReadReverseClassificationVertex(std::string,
MPI_Comm,
int root = 0);

#ifdef PCMS_HAS_OMEGA_H
#ifdef PCMS_ENABLE_OMEGA_H
enum class IndexBase
{
Zero = 0,
Expand Down
8 changes: 1 addition & 7 deletions src/pcms/capi/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ namespace pcms
using FieldAdapterVariant =
std::variant<std::monostate, pcms::XGCFieldAdapter<double>,
pcms::XGCFieldAdapter<float>, pcms::XGCFieldAdapter<int>,
pcms::XGCFieldAdapter<long>, pcms::DummyFieldAdapter
// #ifdef PCMS_HAS_OMEGA_H
// ,
// pcms::OmegaHFieldAdapter<double>,
// pcms::OmegaHFieldAdapter<int>
// #endif
>;
pcms::XGCFieldAdapter<long>, pcms::DummyFieldAdapter>;

} // namespace pcms

Expand Down
8 changes: 8 additions & 0 deletions src/pcms/configuration.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#cmakedefine PCMS_ENABLE_SERVER
#cmakedefine PCMS_ENABLE_CLIENT
#cmakedefine PCMS_ENABLE_XGC
#cmakedefine PCMS_ENABLE_OMEGA_H
#cmakedefine PCMS_ENABLE_C
#cmakedefine PCMS_ENABLE_PRINT
#cmakedefine PCMS_ENABLE_SPDLOG
#cmakedefine PCMS_ENABLE_Fortran
12 changes: 6 additions & 6 deletions src/pcms/print.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PCMS_PRINT_H
#define PCMS_PRINT_H

#ifdef PCMS_SPDLOG_ENABLED
#ifdef PCMS_ENABLE_SPDLOG
#include "spdlog/spdlog.h"
#include <spdlog/fmt/bundled/printf.h>
#endif
Expand All @@ -25,24 +25,24 @@ void setStderr(FILE* err);
template <typename... Args>
void printError(const char* fmt, const Args&... args)
{
#if defined(PCMS_SPDLOG_ENABLED) && defined(PCMS_PRINT_ENABLED)
#if defined(PCMS_ENABLE_SPDLOG) && defined(PCMS_ENABLE_PRINT)
spdlog::error("{}", fmt::sprintf(fmt, args...));
#elif defined(PCMS_PRINT_ENABLED)
#elif defined(PCMS_ENABLE_PRINT)
fprintf(getStdout(), fmt, args...);
#endif
}

template <typename... Args>
KOKKOS_INLINE_FUNCTION void printInfo(const char* fmt, const Args&... args)
{
#if defined(PCMS_SPDLOG_ENABLED) && defined(PCMS_PRINT_ENABLED) && \
#if defined(PCMS_ENABLE_SPDLOG) && defined(PCMS_ENABLE_PRINT) && \
!defined(ACTIVE_GPU_EXECUTION)
spdlog::info("{}", fmt::sprintf(fmt, args...));
#elif defined(PCMS_PRINT_ENABLED) && !defined(ACTIVE_GPU_EXECUTION)
#elif defined(PCMS_ENABLE_PRINT) && !defined(ACTIVE_GPU_EXECUTION)
fprintf(getStdout(), fmt, args...);
#endif
}

} // namespace pcms

#endif // PCMS_PRINT_H
#endif // PCMS_PRINT_H