Skip to content

Commit

Permalink
Upgrade to openPMD API v.15.0 (#901)
Browse files Browse the repository at this point in the history
* upgrade to openPMD API v.15.0

* avoid deprecated functions
  • Loading branch information
MaxThevenet authored Mar 30, 2023
1 parent 55b7abd commit f5a2a65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cmake/dependencies/openPMD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function(find_openpmd)
if(HiPACE_openpmd_internal OR HiPACE_openpmd_src)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

# see https://openpmd-api.readthedocs.io/en/0.14.2/dev/buildoptions.html
# see https://openpmd-api.readthedocs.io/en/0.15.0/dev/buildoptions.html
set(openPMD_USE_MPI ${HiPACE_MPI} CACHE INTERNAL "")
set(openPMD_USE_PYTHON OFF CACHE INTERNAL "")
set(openPMD_BUILD_CLI_TOOLS OFF CACHE INTERNAL "")
Expand Down Expand Up @@ -65,7 +65,7 @@ function(find_openpmd)
else()
set(COMPONENT_WMPI NOMPI)
endif()
find_package(openPMD 0.14.5 CONFIG REQUIRED COMPONENTS ${COMPONENT_WMPI})
find_package(openPMD 0.15.0 CONFIG REQUIRED COMPONENTS ${COMPONENT_WMPI})
message(STATUS "openPMD-api: Found version '${openPMD_VERSION}'")
endif()
endfunction()
Expand All @@ -81,7 +81,7 @@ if(HiPACE_OPENPMD)
set(HiPACE_openpmd_repo "https://github.com/openPMD/openPMD-api.git"
CACHE STRING
"Repository URI to pull and build openPMD-api from if(HiPACE_openpmd_internal)")
set(HiPACE_openpmd_branch "0.14.5"
set(HiPACE_openpmd_branch "0.15.0"
CACHE STRING
"Repository branch for HiPACE_openpmd_repo if(HiPACE_openpmd_internal)")

Expand Down
4 changes: 2 additions & 2 deletions docs/source/building/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Please see installation instructions below in the Developers section.
- a mature `C++17 <https://en.wikipedia.org/wiki/C%2B%2B14>`__ compiler: e.g. GCC 7, Clang 7, NVCC 11.0, MSVC 19.15 or newer
- `CMake 3.18.0+ <https://cmake.org/>`__
- `AMReX development <https://amrex-codes.github.io>`__: we automatically download and compile a copy of AMReX
- `openPMD-api 0.14.5+ <https://github.com/openPMD/openPMD-api>`__: we automatically download and compile a copy of openPMD-api
- `openPMD-api 0.15.0+ <https://github.com/openPMD/openPMD-api>`__: we automatically download and compile a copy of openPMD-api

- `HDF5 <https://support.hdfgroup.org/HDF5>`__ 1.8.13+ (optional; for ``.h5`` file support)
- `ADIOS2 <https://github.com/ornladios/ADIOS2>`__ 2.7.0+ (optional; for ``.bp`` file support)
Expand Down Expand Up @@ -182,7 +182,7 @@ CMake Option Default & Values Des
``HiPACE_amrex_internal`` **ON**/OFF Needs a pre-installed AMReX library if set to ``OFF``
``HiPACE_openpmd_src`` *None* Path to openPMD-api source directory (preferred if set)
``HiPACE_openpmd_repo`` ``https://github.com/openPMD/openPMD-api.git`` Repository URI to pull and build openPMD-api from
``HiPACE_openpmd_branch`` ``0.14.5`` Repository branch for ``HiPACE_openpmd_repo``
``HiPACE_openpmd_branch`` ``0.15.0`` Repository branch for ``HiPACE_openpmd_repo``
``HiPACE_openpmd_internal`` **ON**/OFF Needs a pre-installed openPMD-api library if set to ``OFF``
``AMReX_LINEAR_SOLVERS`` ON/**OFF** Compile AMReX multigrid solver. Required for explicit solver
=========================== ============================================== ============================================================
Expand Down
10 changes: 3 additions & 7 deletions src/diagnostics/OpenPMDWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ OpenPMDWriter::WriteFieldData (
field_comp.resetDataset(dataset);
}

// Store the provided box as a chunk with openpmd
std::shared_ptr< amrex::Real const > data;
data = openPMD::shareRaw( fab.dataPtr( icomp ) ); // non-owning view until flush()

// Determine the offset and size of this data chunk in the global output
amrex::IntVect const box_offset =
{0, 0, data_box.smallEnd(2) - geom[lev].Domain().smallEnd(2)};
Expand All @@ -180,7 +176,7 @@ OpenPMDWriter::WriteFieldData (
chunk_size.erase(chunk_size.begin() + 2-slice_dir);
}

field_comp.storeChunk(data, chunk_offset, chunk_size);
field_comp.storeChunkRaw(fab.dataPtr(icomp), chunk_offset, chunk_size);
}
}

Expand Down Expand Up @@ -399,8 +395,8 @@ OpenPMDWriter::SaveRealProperty (BeamParticleContainer& pc,
auto& currRecord = currSpecies[record_name];
auto& currRecordComp = currRecord[component_name];

currRecordComp.storeChunk(openPMD::shareRaw(soa.GetRealData(idx).data()+box_offset),
{offset}, {numParticleOnTile64});
currRecordComp.storeChunkRaw(soa.GetRealData(idx).data()+box_offset,
{offset}, {numParticleOnTile64});
} // end for NumSoARealAttributes
}
}
Expand Down

0 comments on commit f5a2a65

Please sign in to comment.