Skip to content

Commit

Permalink
ADIOS2: Better cmake and serial support
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Aug 15, 2024
1 parent 99ca727 commit 8b9f666
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 109 deletions.
2 changes: 1 addition & 1 deletion TPLsList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ SET( Seacas_TPLS_FINDMODS_CLASSIFICATIONS
Kokkos "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/" SS
Faodel "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" SS
Cereal "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" SS
ADIOS2 "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/FindTPLADIOS2.cmake" EX
ADIOS2 "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/" EX
Catalyst2 "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/FindTPLCatalyst2.cmake" EX
# TPLs defined in Zoltan/cmake/Dependencies.cmake that are never enabled
PaToH "cmake/TPLs/" EX
Expand Down
10 changes: 10 additions & 0 deletions cmake-config
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,15 @@ then
"
fi

if [ "$HAVE_ADIOS2" == "YES" ]
then
ADIOS2_SYMBOLS=" -D TPL_ENABLE_ADIOS2:BOOL=YES \
-DTPL_ADIOS2_INCLUDE_DIRS:PATH=${ADIOS2_PATH}/include/ADIOS2 \
-DTPL_ADIOS2_LIBRARY_DIRS:PATH=${ADIOS2_PATH}/lib \
-DADIOS2_LIBRARY_DIRS:PATH=${ADIOS2_PATH}/lib \
"
fi

if [ "$OS" == "Darwin" ] ; then
DARWIN_OPT="-D CMAKE_MACOSX_RPATH:BOOL=ON -D TPL_X11_INCLUDE_DIRS:PATH=/opt/X11/include"
else
Expand Down Expand Up @@ -532,6 +541,7 @@ ${KOKKOS_SYMBOLS} \
${MPI_SYMBOLS} \
${DARWIN_OPT} \
${FAODEL_SYMBOLS} \
${ADIOS2_SYMBOLS} \
\
-D MPI_BIN_DIR:PATH=${MPI_BIN} \
-D NetCDF_ROOT:PATH=${NETCDF_PATH} \
Expand Down
97 changes: 97 additions & 0 deletions cmake/tribits/common_tpls/FindTPLADIOS2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# @HEADER
# ************************************************************************
#
# TriBITS: Tribal Build, Integrate, and Test System
# Copyright 2016, 2024 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ************************************************************************
# @HEADER

if (${CMAKE_VERSION} GREATER "3.13")
cmake_policy(SET CMP0074 NEW)
endif()

# First, set up the variables for the (backward-compatible) TriBITS way of
# finding ADIOS2. These are used in case find_package(ADIOS2 ...) is not
# called or does not find HDF5. Also, these variables need to be non-null
# in order to trigger the right behavior in the function
# tribits_tpl_find_include_dirs_and_libraries().

set(REQUIRED_HEADERS adios2.h)
set(REQUIRED_LIBS_NAMES adios2_c adios2_cxx11)

if (TPL_ENABLE_MPI)
set(REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} adios2_c_mpi adios2_cxx11_mpi)
endif()

#
# Second, search for ADIOS2 components (if allowed) using the standard
# find_package(ADIOS2 ...).
#
tribits_tpl_allow_pre_find_package(ADIOS2 ADIOS2_ALLOW_PREFIND)
if (ADIOS2_ALLOW_PREFIND)

message("-- Using find_package(ADIOS2 ...) ...")
set(CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}"
"${CMAKE_CURRENT_LIST_DIR}/find_modules"
"${CMAKE_CURRENT_LIST_DIR}/utils"
)

find_package(ADIOS2)
endif()

#
# Third, call tribits_tpl_find_include_dirs_and_libraries()
#
tribits_tpl_find_include_dirs_and_libraries( ADIOS2
REQUIRED_HEADERS ${REQUIRED_HEADERS}
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES}
)
# NOTE: If find_package(ADIOS2 ...) was called and successfully found ADIOS2,
# then tribits_tpl_find_include_dirs_and_libraries() will use the already-set
# variables TPL_ADIOS2_INCLUDE_DIRS and TPL_ADIOS2_LIBRARIES and then print
# them out (and set some other standard variables as well). This is the final
# "hook" into the TriBITS TPL system.

# If the `find_package(ADIOS2)` is not run, then this may not be set
# Need to determine how this is set in the library that is being used...

if ("${TPL_ADIOS2_PARALLEL}" STREQUAL "")
assert_defined(TPL_ADIOS2_INCLUDE_DIRS)
if ("${TPL_ADIOS2_PARALLEL}" STREQUAL "")
set(TPL_ADIOS2_PARALLEL False CACHE INTERNAL
"True if ADIOS2 compiled with parallel enabled")
endif()
endif()
message(STATUS "TPL_ADIOS2_PARALLEL is ${TPL_ADIOS2_PARALLEL}")
90 changes: 0 additions & 90 deletions packages/seacas/cmake/tpls/FindTPLADIOS2.cmake

This file was deleted.

13 changes: 9 additions & 4 deletions packages/seacas/libraries/ioss/src/adios/AdiosWrapper.C
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright(C) 1999-2020 National Technology & Engineering Solutions
// Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
Expand All @@ -12,9 +12,14 @@ namespace Ioad {

AdiosWrapper::AdiosWrapper(Ioss_MPI_Comm comm, const std::string &filename, bool is_input,
unsigned long rank, const Ioss::PropertyManager &properties)
: adios2::ADIOS(comm), adios2::IO(IOInit(properties, is_input)),
adios2::Engine(EngineInit(filename, is_input)), m_Rank(rank), m_Communicator(comm),
m_OpenStep(false)
#if ADIOS2_USE_MPI
: adios2::ADIOS(comm),
#else
: adios2::ADIOS(),
#endif
adios2::IO(IOInit(properties, is_input)),
adios2::Engine(EngineInit(filename, is_input)), m_Rank(rank), m_Communicator(comm),
m_OpenStep(false)
{
}

Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/ioss/src/adios/AdiosWrapper.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright(C) 1999-2020 National Technology & Engineering Solutions
// Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
// NTESS, the U.S. Government retains certain rights in this software.
//
Expand All @@ -15,7 +15,7 @@ namespace Ioad {
template <typename T>
void AdiosWrapper::DefineVariable(const std::string &name, const adios2::Dims &shape,
const adios2::Dims &start, const adios2::Dims &count,
const bool constantDims)
const bool /*constantDims*/)
{
adios2::Variable<T> var = this->IO::InquireVariable<T>(name);
if (!var) {
Expand Down
24 changes: 12 additions & 12 deletions packages/seacas/libraries/ioss/src/adios/Ioad_DatabaseIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ namespace Ioad {
size_t data_size) const override;
int64_t get_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data,
size_t data_size) const override;
int64_t get_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
void *data, size_t data_size) const override
int64_t get_field_internal(const Ioss::StructuredBlock */* sb */, const Ioss::Field &/*field*/,
void */*data*/, size_t /*data_size*/) const override
{
return -1;
}
int64_t get_field_internal(const Ioss::Assembly *sb, const Ioss::Field &field, void *data,
size_t data_size) const override
int64_t get_field_internal(const Ioss::Assembly */*sb*/, const Ioss::Field &/*field*/, void */*data*/,
size_t /*data_size*/) const override
{
return -1;
}
int64_t get_field_internal(const Ioss::Blob *sb, const Ioss::Field &field, void *data,
size_t data_size) const override
int64_t get_field_internal(const Ioss::Blob */*sb*/, const Ioss::Field &/*field*/, void */*data*/,
size_t /*data_size*/) const override
{
return -1;
}
Expand Down Expand Up @@ -120,18 +120,18 @@ namespace Ioad {
size_t data_size) const override;
int64_t put_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data,
size_t data_size) const override;
int64_t put_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field,
void *data, size_t data_size) const override
int64_t put_field_internal(const Ioss::StructuredBlock */*sb*/, const Ioss::Field &/*field*/,
void */*data*/, size_t /*data_size*/) const override
{
return -1;
}
int64_t put_field_internal(const Ioss::Assembly *sb, const Ioss::Field &field, void *data,
size_t data_size) const override
int64_t put_field_internal(const Ioss::Assembly */*sb*/, const Ioss::Field &/*field*/, void */*data*/,
size_t /*data_size*/) const override
{
return -1;
}
int64_t put_field_internal(const Ioss::Blob *sb, const Ioss::Field &field, void *data,
size_t data_size) const override
int64_t put_field_internal(const Ioss::Blob */*sb*/, const Ioss::Field &/*field*/, void */*data*/,
size_t /*data_size*/) const override
{
return -1;
}
Expand Down

0 comments on commit 8b9f666

Please sign in to comment.