Skip to content

Fix: macOS ADIOS1 w/ cctools ld64 w/o XCode #1196

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,41 @@ jobs:
cmake --build build --parallel 2
ctest --test-dir build --output-on-failure

conda_ompi_vanillaclang_all:
runs-on: macos-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
name: Setup conda
with:
auto-update-conda: true
activate-environment: testing
auto-activate-base: false
channels: conda-forge,defaults
channel-priority: true
- name: Install
shell: bash -eo pipefail -l {0}
run: |
conda env create --file conda.yml
- name: Build
shell: bash -eo pipefail -l {0}
env: {CXXFLAGS: -Werror -Wno-deprecated-declarations}
run: |
conda activate openpmd-api-dev

share/openPMD/download_samples.sh build
chmod u-w build/samples/git-sample/*.h5
cmake -S . -B build \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DopenPMD_USE_PYTHON=ON \
-DopenPMD_USE_MPI=ON \
-DopenPMD_USE_HDF5=ON \
-DopenPMD_USE_ADIOS1=ON \
-DopenPMD_USE_ADIOS2=ON \
-DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build build --parallel 2
ctest --test-dir build --output-on-failure

# TODO: apple_conda_ompi_all (similar to conda_ompi_all on Linux)
# both OpenMPI and MPICH cause startup (MPI_Init) issues on GitHub Actions
56 changes: 50 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,19 @@ set(IO_SOURCE
set(IO_ADIOS1_SEQUENTIAL_SOURCE
src/Error.cpp
src/auxiliary/Filesystem.cpp
src/auxiliary/JSON.cpp
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed because TracingJSON is now used in CommonADIOS1IOHandler.cpp

src/ChunkInfo.cpp
src/IO/ADIOS/CommonADIOS1IOHandler.cpp
src/IO/ADIOS/ADIOS1IOHandler.cpp)
src/IO/ADIOS/ADIOS1IOHandler.cpp
src/IO/IOTask.cpp)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed because we use openPMD::internal::operationAsString in CommonADIOS1IOHandler.cpp

set(IO_ADIOS1_SOURCE
src/Error.cpp
src/auxiliary/Filesystem.cpp
src/auxiliary/JSON.cpp
src/ChunkInfo.cpp
src/IO/ADIOS/CommonADIOS1IOHandler.cpp
src/IO/ADIOS/ParallelADIOS1IOHandler.cpp)
src/IO/ADIOS/ParallelADIOS1IOHandler.cpp
src/IO/IOTask.cpp)

# library
if(openPMD_BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -554,15 +558,41 @@ if(openPMD_HAVE_ADIOS1)
$<TARGET_PROPERTY:openPMD::thirdparty::nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openPMD::thirdparty::toml11,INTERFACE_INCLUDE_DIRECTORIES>)

# Strip all symbols from wrapped library objects, so we can link parallel
# and serial ADIOS1 (with MPI mock/stubs) at the same time.
include(CheckLinkerFlag)
# Vanilla Clang, g++, etc., e.g., on conda-forge
set(_GNU_LINKSTRIP "LINKER:SHELL:--exclude-libs,ALL")
set(_LLVM_LINKSTRIP "LINKER:SHELL:--exclude-libs=ALL")
set(_LD64_LINKSTRIP "LINKER:SHELL:-unexported_symbol,_*") # cctools
set(_LD64_LINKSTRIP "LINKER:-s") # cctools/ld: strip all unexported
check_linker_flag(CXX "${_GNU_LINKSTRIP}" SUPP_GNU_LINKSTRIP)
check_linker_flag(CXX "${_LLVM_LINKSTRIP}" SUPP_LLVM_LINKSTRIP)
check_linker_flag(CXX "${_LD64_LINKSTRIP}" SUPP_LD64_LINKSTRIP)

set_target_properties(openPMD.ADIOS1.Serial PROPERTIES
POSITION_INDEPENDENT_CODE ON
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set_target_properties(openPMD.ADIOS1.Serial PROPERTIES
LINK_FLAGS "-Wl,--exclude-libs,ALL")
if(SUPP_GNU_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Serial PRIVATE "${_GNU_LINKSTRIP}")
elseif(SUPP_LLVM_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Serial PRIVATE "${_LLVM_LINKSTRIP}")
elseif(SUPP_LD64_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Serial PRIVATE "${_LD64_LINKSTRIP}")
else()
message(WARNING "Cannot strip serial ADIOS1 MPI mock")
endif()
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if(SUPP_GNU_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Serial PRIVATE "${_GNU_LINKSTRIP}")
elseif(SUPP_LLVM_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Serial PRIVATE "${_LLVM_LINKSTRIP}")
elseif(SUPP_LD64_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Serial PRIVATE "${_LD64_LINKSTRIP}")
endif()
set_target_properties(openPMD.ADIOS1.Serial PROPERTIES
XCODE_ATTRIBUTE_STRIP_STYLE "non-global"
XCODE_ATTRIBUTE_DEPLOYMENT_POSTPROCESSING "YES"
Expand All @@ -585,9 +615,23 @@ if(openPMD_HAVE_ADIOS1)
VISIBILITY_INLINES_HIDDEN 1
)
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set_target_properties(openPMD.ADIOS1.Parallel PROPERTIES
LINK_FLAGS "-Wl,--exclude-libs,ALL")
if(SUPP_GNU_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Parallel PRIVATE "${_GNU_LINKSTRIP}")
elseif(SUPP_LLVM_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Parallel PRIVATE "${_LLVM_LINKSTRIP}")
elseif(SUPP_LD64_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Parallel PRIVATE "${_LD64_LINKSTRIP}")
else()
message(WARNING "Cannot strip serial ADIOS1 MPI mock")
endif()
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if(SUPP_GNU_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Parallel PRIVATE "${_GNU_LINKSTRIP}")
elseif(SUPP_LLVM_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Parallel PRIVATE "${_LLVM_LINKSTRIP}")
elseif(SUPP_LD64_LINKSTRIP)
target_link_options(openPMD.ADIOS1.Parallel PRIVATE "${_LD64_LINKSTRIP}")
endif()
set_target_properties(openPMD.ADIOS1.Parallel PROPERTIES
XCODE_ATTRIBUTE_STRIP_STYLE "non-global"
XCODE_ATTRIBUTE_DEPLOYMENT_POSTPROCESSING "YES"
Expand Down
3 changes: 2 additions & 1 deletion src/IO/ADIOS/CommonADIOS1IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,9 +1786,10 @@ void CommonADIOS1IOHandlerImpl< ChildClass >::initJson(
}
}

template class CommonADIOS1IOHandlerImpl< ADIOS1IOHandlerImpl >;
#if openPMD_HAVE_MPI
template class CommonADIOS1IOHandlerImpl< ParallelADIOS1IOHandlerImpl >;
#else
template class CommonADIOS1IOHandlerImpl< ADIOS1IOHandlerImpl >;
#endif // openPMD_HAVE_MPI

} // namespace openPMD
Expand Down