Skip to content
Snippets Groups Projects
Commit 63187fce authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #37 from chuckatkins/create-mpi-and-nompi-libs

Add support for building both MPI and NOMPI libs in the same build.
parents 961b77b8 e3f40327
No related branches found
No related tags found
No related merge requests found
...@@ -65,12 +65,12 @@ if(ADIOS_ENABLE_PIC) ...@@ -65,12 +65,12 @@ if(ADIOS_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif() endif()
option(ADIOS_USE_MPI "Enable the MPI version of ADIOS" ON) option(ADIOS_USE_MPI "Enable the MPI version of ADIOS" OFF)
if(ADIOS_USE_MPI) if(ADIOS_USE_MPI)
# Workaround for OpenMPI forcing the link of C++ bindings # Workaround for OpenMPI forcing the link of C++ bindings
add_definitions(-DOMPI_SKIP_MPICXX) add_definitions(-DOMPI_SKIP_MPICXX)
endif() endif()
option(ADIOS_USE_BZip2 "Enable support for BZip2 transforms" ON) option(ADIOS_USE_BZip2 "Enable support for BZip2 transforms" OFF)
option(ADIOS_USE_ADIOS1 "Enable support for the ADIOS 1 engine" OFF) option(ADIOS_USE_ADIOS1 "Enable support for the ADIOS 1 engine" OFF)
option(ADIOS_USE_DataMan "Enable support for the DataMan engine" OFF) option(ADIOS_USE_DataMan "Enable support for the DataMan engine" OFF)
......
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp)
target_link_libraries(hello_bpWriter_nompi adios2_nompi)
if(ADIOS_BUILD_TESTING)
add_test( NAME Example::hello::bpWriter_nompi COMMAND hello_bpWriter_nompi)
endif()
if(ADIOS_USE_MPI) if(ADIOS_USE_MPI)
find_package(MPI COMPONENTS C REQUIRED) find_package(MPI COMPONENTS C REQUIRED)
add_executable(hello_bpWriter helloBPWriter.cpp) add_executable(hello_bpWriter helloBPWriter.cpp)
...@@ -12,12 +19,5 @@ if(ADIOS_USE_MPI) ...@@ -12,12 +19,5 @@ if(ADIOS_USE_MPI)
if(ADIOS_BUILD_TESTING) if(ADIOS_BUILD_TESTING)
add_test( NAME Example::hello::bpWriter COMMAND hello_bpWriter) add_test( NAME Example::hello::bpWriter COMMAND hello_bpWriter)
endif() endif()
else()
add_executable(hello_bpWriter_nompi helloBPWriter_nompi.cpp)
target_link_libraries(hello_bpWriter_nompi adios2)
if(ADIOS_BUILD_TESTING)
add_test( NAME Example::hello::bpWriter_nompi COMMAND hello_bpWriter_nompi)
endif()
endif() endif()
...@@ -3,6 +3,16 @@ ...@@ -3,6 +3,16 @@
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp)
target_link_libraries(hello_datamanReader_nompi adios2_nompi)
if(ADIOS_BUILD_TESTING)
add_test(
NAME Example::hello::datamanReader_nompi
COMMAND hello_datamanReader_nompi
)
endif()
if(ADIOS_USE_MPI) if(ADIOS_USE_MPI)
find_package(MPI COMPONENTS C REQUIRED) find_package(MPI COMPONENTS C REQUIRED)
...@@ -14,15 +24,5 @@ if(ADIOS_USE_MPI) ...@@ -14,15 +24,5 @@ if(ADIOS_USE_MPI)
if(ADIOS_BUILD_TESTING) if(ADIOS_BUILD_TESTING)
add_test(NAME Example::hello::datamanReader COMMAND hello_datamanReader) add_test(NAME Example::hello::datamanReader COMMAND hello_datamanReader)
endif() endif()
else()
add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp)
target_link_libraries(hello_datamanReader_nompi adios2)
if(ADIOS_BUILD_TESTING)
add_test(
NAME Example::hello::datamanReader_nompi
COMMAND hello_datamanReader_nompi
)
endif()
endif() endif()
...@@ -3,6 +3,16 @@ ...@@ -3,6 +3,16 @@
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp)
target_link_libraries(hello_datamanWriter_nompi adios2_nompi)
if(ADIOS_BUILD_TESTING)
add_test(
NAME Example::hello::datamanWriter_nompi
COMMAND hello_datamanWriter_nompi
)
endif()
if(ADIOS_USE_MPI) if(ADIOS_USE_MPI)
find_package(MPI COMPONENTS C REQUIRED) find_package(MPI COMPONENTS C REQUIRED)
...@@ -14,15 +24,5 @@ if(ADIOS_USE_MPI) ...@@ -14,15 +24,5 @@ if(ADIOS_USE_MPI)
if(ADIOS_BUILD_TESTING) if(ADIOS_BUILD_TESTING)
add_test(NAME Example::hello::datamanWriter COMMAND hello_datamanWriter) add_test(NAME Example::hello::datamanWriter COMMAND hello_datamanWriter)
endif() endif()
else()
add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp)
target_link_libraries(hello_datamanWriter_nompi adios2)
if(ADIOS_BUILD_TESTING)
add_test(
NAME Example::hello::datamanWriter_nompi
COMMAND hello_datamanWriter_nompi
)
endif()
endif() endif()
...@@ -3,6 +3,16 @@ ...@@ -3,6 +3,16 @@
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp)
target_link_libraries(hello_timeBPWriter_nompi adios2_nompi)
if(ADIOS_BUILD_TESTING)
add_test(
NAME Example::hello::timeBPWriter_nompi
COMMAND hello_timeBPWriter_nompi
)
endif()
if(ADIOS_USE_MPI) if(ADIOS_USE_MPI)
find_package(MPI COMPONENTS C REQUIRED) find_package(MPI COMPONENTS C REQUIRED)
add_executable(hello_timeBPWriter timeBPWriter.cpp) add_executable(hello_timeBPWriter timeBPWriter.cpp)
...@@ -13,14 +23,4 @@ if(ADIOS_USE_MPI) ...@@ -13,14 +23,4 @@ if(ADIOS_USE_MPI)
if(ADIOS_BUILD_TESTING) if(ADIOS_BUILD_TESTING)
add_test(NAME Example::hello::timeBPWriter COMMAND hello_timeBPWriter) add_test(NAME Example::hello::timeBPWriter COMMAND hello_timeBPWriter)
endif() endif()
else()
add_executable(hello_timeBPWriter_nompi timeBPWriter_nompi.cpp)
target_link_libraries(hello_timeBPWriter_nompi adios2)
if(ADIOS_BUILD_TESTING)
add_test(
NAME Example::hello::timeBPWriter_nompi
COMMAND hello_timeBPWriter_nompi
)
endif()
endif() endif()
...@@ -2,69 +2,81 @@ ...@@ -2,69 +2,81 @@
# Distributed under the OSI-approved Apache License, Version 2.0. See # Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details. # accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
set(adios2_targets adios2_nompi)
if(ADIOS_USE_MPI)
list(APPEND adios2_targets adios2)
endif()
foreach(adios2_target IN LISTS adios2_targets)
add_library(${adios2_target}
ADIOS.cpp ADIOS_inst.cpp
#ADIOS_C.cpp
capsule/heap/STLVector.cpp
capsule/shmem/ShmSystemV.cpp
core/Capsule.cpp
core/Engine.cpp
core/Method.cpp
core/Support.cpp
core/Transform.cpp
core/Transport.cpp
engine/bp/BPFileReader.cpp
engine/bp/BPFileWriter.cpp
format/BP1.cpp
format/BP1Aggregator.cpp
format/BP1Writer.cpp
functions/adiosFunctions.cpp
transport/file/FStream.cpp
transport/file/FileDescriptor.cpp
transport/file/FilePointer.cpp
)
target_include_directories(${adios2_target}
PUBLIC ${ADIOS_SOURCE_DIR}/include
)
if(ADIOS_USE_ADIOS1)
find_package(ADIOS REQUIRED)
target_sources(${adios2_target} PRIVATE
engine/adios1/ADIOS1Reader.cpp
engine/adios1/ADIOS1Writer.cpp
)
target_compile_definitions(${adios2_target} PRIVATE ADIOS_HAVE_ADIOS1)
target_link_libraries(${adios2_target} PRIVATE adios::adios)
endif()
if(ADIOS_USE_DataMan)
find_package(DataMan REQUIRED)
target_sources(${adios2_target} PRIVATE
engine/dataman/DataManReader.cpp
engine/dataman/DataManWriter.cpp
transport/wan/MdtmMan.cpp
)
target_compile_definitions(${adios2_target} PRIVATE ADIOS_HAVE_DATAMAN)
target_link_libraries(${adios2_target} PRIVATE DataMan::DataMan)
endif()
if(ADIOS_USE_BZip2)
find_package(BZip2 REQUIRED)
target_sources(${adios2_target} PRIVATE transform/BZip2.cpp)
target_compile_definitions(${adios2_target} PRIVATE ADIOS_HAVE_BZIP2)
target_link_libraries(${adios2_target} PRIVATE BZip2::BZip2)
endif()
endforeach()
add_library(adios2 target_sources(adios2_nompi PRIVATE mpidummy.cpp)
ADIOS.cpp ADIOS_inst.cpp if(CMAKE_CXX_COMPILER_WRAPPER STREQUAL CrayPrgEnv)
#ADIOS_C.cpp target_compile_options(adios2_nompi PRIVATE --cray-bypass-pkgconfig)
endif()
capsule/heap/STLVector.cpp
capsule/shmem/ShmSystemV.cpp
core/Capsule.cpp
core/Engine.cpp
core/Method.cpp
core/Support.cpp
core/Transform.cpp
core/Transport.cpp
engine/bp/BPFileReader.cpp
engine/bp/BPFileWriter.cpp
format/BP1.cpp
format/BP1Aggregator.cpp
format/BP1Writer.cpp
functions/adiosFunctions.cpp
transport/file/FStream.cpp
transport/file/FileDescriptor.cpp
transport/file/FilePointer.cpp
)
target_include_directories(adios2 PUBLIC ${ADIOS_SOURCE_DIR}/include)
if(ADIOS_USE_MPI) if(ADIOS_USE_MPI)
find_package(MPI COMPONENTS C REQUIRED) find_package(MPI COMPONENTS C REQUIRED)
target_include_directories(adios2 PUBLIC ${MPI_C_INCLUDE_PATH}) target_include_directories(adios2 PUBLIC ${MPI_C_INCLUDE_PATH})
target_compile_definitions(adios2 PUBLIC ADIOS_HAVE_MPI) target_compile_definitions(adios2 PUBLIC ADIOS_HAVE_MPI)
target_link_libraries(adios2 PUBLIC ${MPI_C_LIBRARIES}) target_link_libraries(adios2 PUBLIC ${MPI_C_LIBRARIES})
else()
target_sources(adios2 PRIVATE mpidummy.cpp)
endif()
if(ADIOS_USE_ADIOS1)
find_package(ADIOS REQUIRED)
target_sources(adios2 PRIVATE
engine/adios1/ADIOS1Reader.cpp
engine/adios1/ADIOS1Writer.cpp
)
target_compile_definitions(adios2 PRIVATE ADIOS_HAVE_ADIOS1)
target_link_libraries(adios2 PRIVATE adios::adios)
endif()
if(ADIOS_USE_DataMan)
find_package(DataMan REQUIRED)
target_sources(adios2 PRIVATE
engine/dataman/DataManReader.cpp
engine/dataman/DataManWriter.cpp
transport/wan/MdtmMan.cpp
)
target_compile_definitions(adios2 PRIVATE ADIOS_HAVE_DATAMAN)
target_link_libraries(adios2 PRIVATE DataMan::DataMan)
endif()
if(ADIOS_USE_BZip2)
find_package(BZip2 REQUIRED)
target_sources(adios2 PRIVATE transform/BZip2.cpp)
target_compile_definitions(adios2 PRIVATE ADIOS_HAVE_BZIP2)
target_link_libraries(adios2 PRIVATE BZip2::BZip2)
endif() endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment