Skip to content
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

Backport from master #3861

Merged
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
22 changes: 11 additions & 11 deletions .github/workflows/everything.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
outputs:
num_code_changes: ${{ steps.get_code_changes.outputs.num_code_changes }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for appropriately named topic branch
Expand Down Expand Up @@ -69,10 +69,10 @@ jobs:
image: ornladios/adios2:ci-formatting

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: gha
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source
Expand Down Expand Up @@ -124,10 +124,10 @@ jobs:
parallel: mpich

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: gha
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source
Expand Down Expand Up @@ -231,10 +231,10 @@ jobs:
compiler: xcode13_4_1

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: gha
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source
Expand Down Expand Up @@ -280,10 +280,10 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: gha
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: source
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
baseos: [ubuntu-bionic]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: ci-source
Expand Down Expand Up @@ -393,7 +393,7 @@ jobs:
shell: bash -c "docker exec adios2-ci bash --login -e $(echo {0} | sed 's|/home/runner/work|/__w|g')"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
ref: ${{ matrix.ref }}
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ if(ADIOS2_HAVE_MPI)
add_definitions(-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX)
endif()

cmake_dependent_option(ADIOS2_Blosc2_PREFER_SHARED "Prefer shared Blosc2 libraries"
ON "Blosc2_shlib_available" OFF)

#------------------------------------------------------------------------------#
# POSIX O_DIRECT is only working for Unix in adios for now
Expand Down
1 change: 1 addition & 0 deletions CTestCustom.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"Warning #20208-D: '.*' is treated as '.*' in device code"
"Warning: '.*' is treated as '.*' in device code"
".*was specified as both a system and non-system include directory.*"
"Wunused-command-line-argument"
)
list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
".*/thirdparty/.*"
Expand Down
48 changes: 41 additions & 7 deletions cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,35 @@ endfunction()

# Blosc2
if(ADIOS2_USE_Blosc2 STREQUAL AUTO)
find_package(Blosc2 2.4)
# Prefect CONFIG mode
find_package(Blosc2 2.4 CONFIG QUIET)
if(NOT Blosc2_FOUND)
find_package(Blosc2 2.4 MODULE QUIET)
endif()
elseif(ADIOS2_USE_Blosc2)
find_package(Blosc2 2.4 REQUIRED)
# Prefect CONFIG mode
find_package(Blosc2 2.4 CONFIG)
if(NOT Blosc2_FOUND)
find_package(Blosc2 2.4 MODULE REQUIRED)
endif()
endif()
if(BLOSC2_FOUND)
if(Blosc2_FOUND)
set(ADIOS2_HAVE_Blosc2 TRUE)
if(TARGET Blosc2::blosc2_shared)
set(Blosc2_shlib_available ON)
endif()

set(adios2_blosc2_tgt Blosc2::Blosc2)
if (Blosc2_VERSION VERSION_GREATER_EQUAL 2.10.1)
if (Blosc2_shlib_available)
set(adios2_blosc2_tgt Blosc2::blosc2_$<IF:$<BOOL:${ADIOS2_Blosc2_PREFER_SHARED}>,shared,static>)
else()
set(adios2_blosc2_tgt Blosc2::blosc2_static)
endif()
endif()

add_library(adios2_blosc2 INTERFACE)
target_link_libraries(adios2_blosc2 INTERFACE ${adios2_blosc2_tgt})
endif()

# BZip2
Expand Down Expand Up @@ -407,9 +430,11 @@ if(ADIOS2_USE_SST AND NOT WIN32)
endif()
endif()
if(ADIOS2_HAVE_MPI)
set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_C)
include(CheckCSourceRuns)
check_c_source_runs([=[
set(CMAKE_REQUIRED_LIBRARIES "MPI::MPI_C;Threads::Threads")
include(CheckCXXSourceRuns)
check_cxx_source_runs([=[
#include <chrono>
#include <future>
#include <mpi.h>
#include <stdlib.h>

Expand All @@ -419,9 +444,18 @@ if(ADIOS2_USE_SST AND NOT WIN32)

int main()
{
// Timeout after 5 second
auto task = std::async(std::launch::async, []() {
std::this_thread::sleep_for(std::chrono::seconds(5));
exit(EXIT_FAILURE);
});

char* port_name = new char[MPI_MAX_PORT_NAME];
MPI_Init_thread(NULL, NULL, MPI_THREAD_MULTIPLE, NULL);
MPI_Open_port(MPI_INFO_NULL, malloc(sizeof(char) * MPI_MAX_PORT_NAME));
MPI_Open_port(MPI_INFO_NULL, port_name);
MPI_Close_port(port_name);
MPI_Finalize();
exit(EXIT_SUCCESS);
}]=]
ADIOS2_HAVE_MPI_CLIENT_SERVER)
unset(CMAKE_REQUIRED_LIBRARIES)
Expand Down
5 changes: 5 additions & 0 deletions cmake/adios2-config-common.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ endif()

set(ADIOS2_HAVE_Fortran @ADIOS2_HAVE_Fortran@)
set(ADIOS2_HAVE_MPI @ADIOS2_HAVE_MPI@)
set(ADIOS2_HAVE_CUDA @ADIOS2_HAVE_CUDA@)
set(ADIOS2_HAVE_Kokkos @ADIOS2_HAVE_Kokkos@)
set(ADIOS2_HAVE_Kokkos_CUDA @ADIOS2_HAVE_Kokkos_CUDA@)
set(ADIOS2_HAVE_Kokkos_HIP @ADIOS2_HAVE_Kokkos_HIP@)
set(ADIOS2_HAVE_Kokkos_SYCL @ADIOS2_HAVE_Kokkos_SYCL@)

function(adios2_add_thirdparty_target PackageName)
add_library(adios2::thirdparty::${PackageName} INTERFACE IMPORTED)
Expand Down
2 changes: 1 addition & 1 deletion cmake/adios2-config-install.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.12)

set(_ADIOS2_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/install/post/adios2-config-dummy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.12)

project(adios2-config-dummy C CXX)

Expand Down
6 changes: 6 additions & 0 deletions cmake/install/post/generate-adios2-config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ if [ "${1:0:1}" != "/" ]
then
# Convert relative paths to absolute based on DESTDIR
PREFIX="${DESTDIR:-$(pwd)}/$1"
else
# check if the PREFIX directory exists and prepend DESTDIR if not
if [ ! -d "${PREFIX}" ]
then
PREFIX="${DESTDIR}$1"
fi
fi

shift
Expand Down
2 changes: 1 addition & 1 deletion plugins/engines/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#------------------------------------------------------------------------------#

if(ADIOS2_HAVE_Catalyst)
add_library(ParaViewADIOSInSituEngine
add_library(ParaViewADIOSInSituEngine MODULE
ParaViewFidesEngine.cpp)
target_link_libraries(ParaViewADIOSInSituEngine
PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion plugins/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#------------------------------------------------------------------------------#

if(ADIOS2_HAVE_Sodium)
add_library(EncryptionOperator
add_library(EncryptionOperator MODULE
EncryptionOperator.cpp
)
target_link_libraries(EncryptionOperator adios2_core sodium)
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build:
python: "miniconda3-4.7"
jobs:
pre_install:
- cmake -B build -S . -DADIOS2_USE_PYTHON=ON -DBUILD_TESTING=OFF -DADIOS2_BUILD_EXAMPLES=OFF
- cmake -B build -S . -DADIOS2_USE_PYTHON=ON
- cmake --build build
- cmake --install build --prefix "$HOME/.local"
formats:
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/cmake-v2/ci-el8-gcc10-mpi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ADIOS2_USE_Blosc:BOOL=ON
ADIOS2_USE_DataMan:BOOL=ON
ADIOS2_USE_Fortran:BOOL=ON
ADIOS2_USE_HDF5:BOOL=ON
ADIOS2_USE_MGARD:BOOL=OFF
ADIOS2_USE_MPI:BOOL=ON
ADIOS2_USE_Python:BOOL=ON
ADIOS2_USE_SZ:BOOL=ON
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/cmake-v2/ci-el8-gcc11-mpi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ADIOS2_USE_Blosc:BOOL=ON
ADIOS2_USE_DataMan:BOOL=ON
ADIOS2_USE_Fortran:BOOL=ON
ADIOS2_USE_HDF5:BOOL=ON
ADIOS2_USE_MGARD:BOOL=OFF
ADIOS2_USE_MPI:BOOL=ON
ADIOS2_USE_Python:BOOL=ON
ADIOS2_USE_SZ:BOOL=ON
Expand Down
11 changes: 4 additions & 7 deletions source/adios2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@ if(ADIOS2_HAVE_DataSpaces)
target_link_libraries(adios2_core_mpi PRIVATE DataSpaces::DataSpaces)
endif()

set(maybe_adios2_blosc2)
if(ADIOS2_HAVE_Blosc2)
target_sources(adios2_core PRIVATE operator/compress/CompressBlosc.cpp)
target_link_libraries(adios2_core PRIVATE Blosc2::Blosc2)
target_link_libraries(adios2_core PRIVATE adios2_blosc2)
set(maybe_adios2_blosc2 adios2_blosc2)
endif()

if(ADIOS2_HAVE_BZip2)
Expand Down Expand Up @@ -399,11 +401,6 @@ install(FILES common/ADIOSMacros.h common/ADIOSTypes.h common/ADIOSTypes.inl
install(DIRECTORY core/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2/core COMPONENT adios2_core-development
FILES_MATCHING PATTERN "*.h"
PATTERN "Info.h" EXCLUDE
)

install(FILES core/Info.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT adios2_core-development
)

install(DIRECTORY engine/
Expand Down Expand Up @@ -433,7 +430,7 @@ install(DIRECTORY toolkit/
)

# Library installation
install(TARGETS adios2_core ${maybe_adios2_core_mpi} ${maybe_adios2_core_cuda} ${maybe_adios2_core_kokkos} EXPORT adios2Exports
install(TARGETS adios2_core ${maybe_adios2_core_mpi} ${maybe_adios2_core_cuda} ${maybe_adios2_core_kokkos} ${maybe_adios2_blosc2} EXPORT adios2Exports
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_core-runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-libraries NAMELINK_COMPONENT adios2_core-development
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-development
Expand Down
66 changes: 20 additions & 46 deletions source/adios2/toolkit/sst/dp/mpi_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#define QUOTE(name) #name
#define MACRO_TO_STR(name) QUOTE(name)

static pthread_once_t OnceMpiInitializer = PTHREAD_ONCE_INIT;

/*****Stream Basic Structures ***********************************************/

typedef struct _MpiReaderContactInfo
Expand Down Expand Up @@ -249,40 +247,6 @@ static void MpiReadReplyHandler(CManager cm, CMConnection conn, void *msg_v,
static void MpiReadRequestHandler(CManager cm, CMConnection conn, void *msg_v,
void *client_Data, attr_list attrs);

/**
* Initialize MPI in the mode that it is required for MPI_DP to work.
*
* It can be called multiple times.
*/
static void MpiInitialize()
{
int IsInitialized = 0;
int provided;

MPI_Initialized(&IsInitialized);
if (!IsInitialized)
{
MPI_Init_thread(NULL, NULL, MPI_THREAD_MULTIPLE, &provided);
}
else
{
MPI_Query_thread(&provided);
}

if (provided != MPI_THREAD_MULTIPLE)
{
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (!rank)
{
fprintf(stderr,
"MPI init without MPI_THREAD_MULTIPLE (Externally "
"initialized:%s)\n",
IsInitialized ? "true" : "false");
}
}
}

/*****Public accessible functions********************************************/

/**
Expand All @@ -301,8 +265,6 @@ static DP_RS_Stream MpiInitReader(CP_Services Svcs, void *CP_Stream,
struct _SstParams *Params,
attr_list WriterContact, SstStats Stats)
{
pthread_once(&OnceMpiInitializer, MpiInitialize);

MpiStreamRD Stream = calloc(sizeof(struct _MpiStreamRD), 1);
CManager cm = Svcs->getCManager(CP_Stream);
SMPI_Comm comm = Svcs->getMPIComm(CP_Stream);
Expand Down Expand Up @@ -344,8 +306,6 @@ static DP_WS_Stream MpiInitWriter(CP_Services Svcs, void *CP_Stream,
struct _SstParams *Params, attr_list DPAttrs,
SstStats Stats)
{
pthread_once(&OnceMpiInitializer, MpiInitialize);

MpiStreamWR Stream = calloc(sizeof(struct _MpiStreamWR), 1);
CManager cm = Svcs->getCManager(CP_Stream);
SMPI_Comm comm = Svcs->getMPIComm(CP_Stream);
Expand Down Expand Up @@ -848,16 +808,30 @@ static void MpiReleaseTimeStep(CP_Services Svcs, DP_WS_Stream Stream_v,
static int MpiGetPriority(CP_Services Svcs, void *CP_Stream,
struct _SstParams *Params)
{
#if defined(MPICH)
// Only enabled when MPI_THREAD_MULTIPLE and using MPICH
int IsInitialized = 0;
int provided = 0;
pthread_once(&OnceMpiInitializer, MpiInitialize);
MPI_Query_thread(&provided);
if (provided == MPI_THREAD_MULTIPLE)
int IsMPICH = 0;
#if defined(MPICH)
IsMPICH = 1;

MPI_Initialized(&IsInitialized);
if (IsInitialized)
{
return 100;
MPI_Query_thread(&provided);
// Only enabled when MPI_THREAD_MULTIPLE and using MPICH
if (provided == MPI_THREAD_MULTIPLE)
{
return 100;
}
}
#endif

Svcs->verbose(CP_Stream, DPTraceVerbose,
"MPI DP disabled since the following predicate is false: "
"(MPICH=%s AND MPI_initialized=%s AND MPI_THREAD_MULTIPLE=%s)",
IsMPICH ? "true" : "false", IsInitialized ? "true" : "false",
provided == MPI_THREAD_MULTIPLE ? "true" : "false");

return -100;
}

Expand Down
Loading
Loading