-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding Adios2 io support #113
base: master
Are you sure you want to change the base?
Changes from all commits
c786f61
788e45c
906c8bc
dcdfe09
a3fe049
ad95f00
a76e37a
cb35d7f
5627b34
1971fe0
aae867b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# - Try to find ADIOS2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this file. It is not needed and will cause us issues in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I will try to remove it although I don't know what the the alternative is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
# Once done this will define | ||
# ADIOS2_FOUND - System has ADIOS2 | ||
# ADIOS2_INCLUDE_DIR - The ADIOS2 include directories | ||
# ADIOS2_LIBS - The libraries needed to use ADIOS2 | ||
# ADIOS2_<library>_FOUND - System has <library> | ||
# ADIOS2_MAJOR_VERSION - the leading integer of the version string | ||
# ADIOS2_MINOR_VERSION - the date code from the version string | ||
# | ||
# Based on input variables: | ||
# ADIOS2_LIB_DIR | ||
# ADIOS2_INCLUDE_DIR | ||
# And environment variable: | ||
# CMAKE_PREFIX_PATH | ||
# | ||
# This implementation assumes an adios2 install has the following structure | ||
# VERSION/ | ||
# include/*.h | ||
# lib64/*.a | ||
|
||
macro(adios2LibCheck libs isRequired) | ||
foreach(lib ${libs}) | ||
unset(adios2lib CACHE) | ||
find_library(adios2lib "${lib}" PATHS ${ADIOS2_LIB_DIR}) | ||
if(adios2lib MATCHES "^adios2lib-NOTFOUND$") | ||
if(${isRequired}) | ||
message(FATAL_ERROR "adios2 library ${lib} not found in ${ADIOS2_LIB_DIR}") | ||
else() | ||
message("adios2 library ${lib} not found in ${ADIOS2_LIB_DIR}") | ||
endif() | ||
else() | ||
set("ADIOS2_${lib}_FOUND" TRUE CACHE INTERNAL "ADIOS2 library present") | ||
set(ADIOS2_LIBS ${ADIOS2_LIBS} ${adios2lib}) | ||
endif() | ||
endforeach() | ||
endmacro(adios2LibCheck) | ||
|
||
find_path(ADIOS2_INCLUDE_DIR | ||
NAMES adios2_c.h adios2.h | ||
PATHS ${ADIOS2_INCLUDE_DIR}) | ||
if(NOT EXISTS "${ADIOS2_INCLUDE_DIR}") | ||
message(FATAL_ERROR "adios2 include dir not found") | ||
endif() | ||
|
||
string(REGEX REPLACE | ||
"/include$" "" | ||
ADIOS2_INSTALL_DIR | ||
"${ADIOS2_INCLUDE_DIR}") | ||
|
||
string(REGEX MATCH | ||
"[0-9]+[.][0-9]+-[0-9]+" | ||
ADIOS2_VERSION | ||
"${ADIOS2_INCLUDE_DIR}") | ||
|
||
#VERSION_LESS and VERSION_GREATER need '.' delimited version strings. | ||
string(REGEX REPLACE | ||
"([0-9]+[.][0-9]+)-([0-9]+)" | ||
"\\1.\\2" ADIOS2_DOT_VERSION | ||
"${ADIOS2_VERSION}") | ||
string(REGEX REPLACE | ||
"([0-9]+)[.]([0-9]+)-([0-9]+)" | ||
"\\1" ADIOS2_MAJOR_VERSION | ||
"${ADIOS2_VERSION}") | ||
string(REGEX REPLACE | ||
"([0-9]+)[.]([0-9]+)-([0-9]+)" | ||
"\\3" ADIOS2_MINOR_VERSION | ||
"${ADIOS2_VERSION}") | ||
|
||
set(MIN_VALID_ADIOS2_VERSION 2.10.0) | ||
set(MAX_VALID_ADIOS2_VERSION 2.10.10) | ||
#if( ${SKIP_ADIOS2_VERSION_CHECK} ) | ||
# message(STATUS "Skipping ADIOS2 version check." | ||
# " This may result in undefined behavior") | ||
#elseif( (ADIOS2_DOT_VERSION VERSION_LESS MIN_VALID_ADIOS2_VERSION) OR | ||
# (ADIOS2_DOT_VERSION VERSION_GREATER MAX_VALID_ADIOS2_VERSION) ) | ||
# MESSAGE(FATAL_ERROR | ||
# "invalid ADIOS2 version: ${ADIOS2_DOT_VERSION}, \ | ||
# valid versions are ${MIN_VALID_ADIOS2_VERSION} to ${MAX_VALID_ADIOS2_VERSION}") | ||
#endif() | ||
message(STATUS "Building with ADIOS2 ${ADIOS2_DOT_VERSION}") | ||
|
||
set(ADIOS2_LIBS "") | ||
|
||
if (Omega_h_USE_MPI) | ||
set(ADIOS2_LIB_NAMES | ||
adios2_core_mpi | ||
adios2_cxx11_mpi | ||
) | ||
else() | ||
set(ADIOS2_LIB_NAMES | ||
adios2_core | ||
adios2_cxx11 | ||
) | ||
endif() | ||
|
||
adios2LibCheck("${ADIOS2_LIB_NAMES}" TRUE) | ||
|
||
# handle the QUIETLY and REQUIRED arguments and set ADIOS2_FOUND to TRUE | ||
# if all listed variables are TRUE | ||
find_package_handle_standard_args(ADIOS2 DEFAULT_MSG | ||
ADIOS2_LIBS ADIOS2_INCLUDE_DIR | ||
) | ||
|
||
mark_as_advanced(ADIOS2_INCLUDE_DIR ADIOS2_LIBS) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,17 @@ if(Omega_h_USE_SimModSuite) | |
"${CMAKE_CURRENT_BINARY_DIR}/Omega_h_simConfig.h") | ||
endif() | ||
|
||
message(STATUS "Omega_h_USE_ADIOS2: ${Omega_h_USE_ADIOS2}") | ||
if(Omega_h_USE_ADIOS2) | ||
list(APPEND Omega_h_SOURCES Omega_h_adios2.cpp) | ||
#Is there a better way? I assume CMAKE_MODULE_PATH was purposely not set in | ||
# the top level CMakeLists.txt | ||
set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") | ||
Comment on lines
+179
to
+180
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if you get rid of the config files these should not be needed. |
||
find_package(ADIOS2 MODULE REQUIRED) | ||
set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH}) | ||
endif() | ||
|
||
if(Omega_h_USE_SEACASExodus) | ||
set(Omega_h_SOURCES ${Omega_h_SOURCES} Omega_h_exodus.cpp) | ||
endif() | ||
|
@@ -226,6 +237,16 @@ if(Omega_h_USE_SimModSuite) | |
target_link_libraries(omega_h PUBLIC "${SIMMODSUITE_LIBS}") | ||
endif() | ||
|
||
if(Omega_h_USE_ADIOS2) | ||
set(ADIOS_REQUIRED_VERSION 2.10) | ||
if (Omega_h_USE_MPI) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DADIOS2_USE_MPI") | ||
target_include_directories(omega_h PUBLIC "${ADIOS2_INCLUDE_DIR}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't need this if we use the adios2 cmake targets |
||
target_link_libraries(omega_h PUBLIC "${ADIOS2_LIBS}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the target should be |
||
else() | ||
message("set Omega_h_USE_MPI to use ADIOS2") | ||
endif() | ||
endif() | ||
|
||
bob_link_dependency(omega_h PUBLIC SEACASExodus) | ||
|
||
|
@@ -629,6 +650,15 @@ if(BUILD_TESTING) | |
else() | ||
test_func(describe_serial 1 ./describe ${CMAKE_SOURCE_DIR}/meshes/box_3d.osh) | ||
endif() | ||
|
||
if (Omega_h_USE_ADIOS2) | ||
osh_add_util(bp2osh) | ||
osh_add_util(osh2bp) | ||
osh_add_exe(adios2_io) | ||
test_basefunc(adios2_io 1 ./adios2_io | ||
${CMAKE_SOURCE_DIR}/meshes/unitbox_cutTriCube_1k.osh | ||
output.bp) | ||
endif() | ||
endif() | ||
|
||
bob_config_header("${CMAKE_CURRENT_BINARY_DIR}/Omega_h_config.h") | ||
|
@@ -744,6 +774,10 @@ else() | |
list(APPEND Omega_h_HEADERS Omega_h_array_default.hpp) | ||
endif() | ||
|
||
if(Omega_h_USE_ADIOS2) | ||
list(APPEND Omega_h_HEADERS Omega_h_adios2.hpp) | ||
endif() | ||
|
||
install(FILES ${Omega_h_HEADERS} DESTINATION include) | ||
|
||
if (Omega_h_USE_pybind11) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need this since
find_package
should directly work since adios2 provides a config file.