Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
49027c7
Add OpenPMD as external lib
pgrete Jan 8, 2024
4525e86
Add OpenPMD skeleto
pgrete Jan 11, 2024
4de250c
WIP more Open PMD
pgrete Jan 11, 2024
b906af7
WIP OpenPMD use file id
pgrete Jan 12, 2024
108fc7a
Merge branch 'develop' into pgrete/pmd-output
pgrete Feb 29, 2024
79660a2
Write blocks
pgrete Feb 29, 2024
372b585
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Mar 8, 2024
8d40c91
Centralize getting var info for output
pgrete Mar 8, 2024
4f20c26
WIP openpmd, chunks don't work yet plus check dimensionality
pgrete Mar 8, 2024
4dde705
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Mar 14, 2024
f29e8d1
Fix chunk extents
pgrete Mar 14, 2024
a501a5d
Write Attributes
pgrete Mar 15, 2024
c0be75c
Rename restart to restart_hdf5
pgrete Mar 15, 2024
7f03528
WIP abstract RestartReader
pgrete Mar 18, 2024
56795f2
WIP separating RestartReader
pgrete Mar 18, 2024
8587303
Make RestartReader abstract
pgrete Mar 19, 2024
8bf955b
Merge branch 'pgrete/refactor-restart' into pgrete/pmd-output
pgrete Mar 20, 2024
e3ea8d7
Add OpenPMD restart skeleton
pgrete Mar 20, 2024
33b6261
WIP updating loc logic
pgrete Mar 20, 2024
788118c
Merge branch 'develop' into pgrete/pmd-output
pgrete Apr 11, 2024
62e54da
Fix interface from recent changes in develop
pgrete Apr 11, 2024
6309663
Read and Write loc
pgrete Apr 11, 2024
7224f42
Houston, we have a build
pgrete Apr 11, 2024
ae1f241
Added OpenPMD restart ReadBlocks
pgrete Apr 12, 2024
19863d7
Fix loc level
pgrete Apr 12, 2024
e2b2bd1
Make Series persistent and fix rootlevel typo
pgrete Apr 15, 2024
f9373e8
WIP Read/Write Params
pgrete Apr 15, 2024
96a3f4c
Make ReadParams private member
pgrete Apr 15, 2024
61306a0
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Apr 18, 2024
56976a8
Fix root level in output
pgrete Apr 18, 2024
6199843
Move to mesh per record standard for writing
pgrete Apr 22, 2024
9fb9f68
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Apr 23, 2024
684b7ab
Allow for 2D and 3D output. Fix single dataset reset.
pgrete Apr 23, 2024
251c6ea
Fix logical loc
pgrete Apr 23, 2024
03f80c7
Rename opmd files
pgrete Apr 24, 2024
890fffe
Separate common calls to chunks and names
pgrete Apr 24, 2024
04359d3
Reuse shared chunk and name for restarts
pgrete Apr 24, 2024
2b89659
Add regression test
pgrete Apr 24, 2024
804e60d
Somewhat make restarts working
pgrete Apr 24, 2024
a436f55
Fix order of arguments for correct flush
pgrete Apr 26, 2024
6a3a80d
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Apr 26, 2024
28d725d
Fix handling of output variable names
pgrete Apr 26, 2024
a039ea1
Fix reading chunks for sparsely populated output files
pgrete Apr 26, 2024
ae8519f
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Apr 29, 2024
7476641
Dont tell anyone I spent days on this...
pgrete May 3, 2024
39d4b99
Temp disable dumping Views from device
pgrete May 3, 2024
d2ba882
Merge branch 'develop' into pgrete/pmd-output
pgrete May 22, 2024
626303d
Merge branch 'pgrete/fix-hasghost-restart' into pgrete/pmd-output
pgrete Jun 12, 2024
4241198
Dump deref cnt in opmd restart
pgrete Jun 12, 2024
101ebf2
Merge branch 'develop' into pgrete/pmd-output
BenWibking Jun 18, 2024
60a38b2
install openpmd in macOS CI
BenWibking Jun 18, 2024
461eeaa
Merge branch 'develop' into pgrete/pmd-output
BenWibking Jun 21, 2024
cd007d3
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Jun 25, 2024
28020db
Remove extraneous popRegion
pgrete Jun 25, 2024
5324e00
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Jul 11, 2024
af4b966
Fix formatting
pgrete Jul 11, 2024
0e015d1
Make format clang16 compatible
pgrete Jul 11, 2024
5135aea
Fix default backend_config parsing
pgrete Jul 12, 2024
b344291
another attempt
pgrete Jul 12, 2024
7486915
Bump OpenPMD version
pgrete Jul 12, 2024
0e3f758
pmd: Write scalar particle data
pgrete Jul 25, 2024
e39ef61
Code dedup
pgrete Jul 25, 2024
b938511
Allow writing non-scalar particles
pgrete Jul 25, 2024
08d6b41
Make positions standard compliant
pgrete Jul 25, 2024
bf74c7e
Allow for particles restarts (serial works)
pgrete Jul 25, 2024
3b37c26
Support particle restarts in parallel
pgrete Jul 26, 2024
0ca5b6f
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Jul 26, 2024
b30788a
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Aug 6, 2024
5f95466
Add now prefix to pmd outputs
pgrete Aug 6, 2024
6811594
Make linter happy
pgrete Aug 7, 2024
c0d7f11
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Sep 2, 2024
b2d7525
Bump OPMD version and add delim
pgrete Sep 4, 2024
f229274
Merge branch 'develop' into pgrete/pmd-output
pgrete Sep 26, 2024
3283635
Change delim. Is this stupid?
pgrete Sep 26, 2024
d59d573
Merge branch 'develop' into pgrete/pmd-output
pgrete Oct 7, 2024
3f95fc4
Make params IO test more flexible
pgrete Oct 7, 2024
1141ff3
Add test case for opmd params IO
pgrete Oct 7, 2024
e6e4d0b
Reading/writing non-ParArray Params works
pgrete Oct 7, 2024
8230f94
Allow writing ParArray and Views to Params
pgrete Oct 8, 2024
e64ae7e
Read ParArray/View from opmd raw
pgrete Oct 8, 2024
b789711
Make basic parsing of Params work
pgrete Oct 8, 2024
466ecd2
Restore view from opmd params
pgrete Oct 8, 2024
3aa4c78
Fix manual pararray reading
pgrete Oct 8, 2024
4c1c70f
Make linter happy?
pgrete Oct 8, 2024
8a1850b
Make restoring HostViews possible
pgrete Oct 9, 2024
1f02ffa
Make reading host arrays work using the direct interface in the unit …
pgrete Oct 9, 2024
d6565c5
Expands types for read/write to all vec
pgrete Oct 9, 2024
6065213
Remove debug info
pgrete Oct 9, 2024
4bf6a92
Merge branch 'develop' into pgrete/pmd-output
BenWibking Oct 16, 2024
e67f589
Merge branch 'develop' into pgrete/pmd-output
pgrete Nov 9, 2024
503a5b6
Fix bc interface from PR 1177
pgrete Nov 9, 2024
d064f03
Merge branch 'develop' into pgrete/pmd-output
BenWibking Nov 22, 2024
dfbcb27
Merge branch 'develop' into pgrete/pmd-output
pgrete Nov 29, 2024
4769a63
Fix output numbering for triggered opmd outputs
pgrete Nov 29, 2024
543dbf9
Make formatter happy
pgrete Nov 29, 2024
449cd5e
Bump opmd to 0.16.1 stable version (not requiring work around any more)
pgrete May 23, 2025
7f813c0
AMR restarts work and are bitwise identical now
pgrete May 23, 2025
3689e6c
Cross test opmd and rst outputs
pgrete May 23, 2025
2db2db7
Merge branch 'develop' into pgrete/pmd-output
pgrete May 23, 2025
aea0519
Fix merge issues
pgrete May 23, 2025
57b719a
Fix compile issue with std::string dtor of vectypes
pgrete May 23, 2025
9bed0ce
Allow embedded and system opmd build w and wo MPI
pgrete Jun 4, 2025
9ae2fde
Try opmd build in CI
pgrete Jun 5, 2025
0ac42c6
Provide path to openpmd_api
pgrete Jun 5, 2025
d230db9
Update CI containers to be used
pgrete Jun 5, 2025
41c94c5
Disable read/write of string views (not supported by Kokkos)
pgrete Jun 5, 2025
642e23d
Add comments
pgrete Jun 18, 2025
8e089bb
Add opmd dump/load of new uint64 ids
pgrete Jun 18, 2025
1b8b904
Add opmd write support for all field types
pgrete Jun 19, 2025
a1768b0
Fix 2D offsets
pgrete Jun 20, 2025
69fc044
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Jul 2, 2025
3d48016
First stab at opmd restart for non-CC fields
pgrete Jul 2, 2025
2a0cde8
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Jul 2, 2025
301f25b
First attempt at adding/restoring opmd sparseinfo
pgrete Jul 2, 2025
0d5d4d3
Fix misplaced comma
pgrete Jul 2, 2025
207d24b
Add missing int8_t to mpi type map
pgrete Jul 3, 2025
4fe5d63
Only write SparseInfo when sparse fields are present
pgrete Jul 3, 2025
762a9ce
Fix interfaces
pgrete Jul 24, 2025
be68203
Fix doc build
pgrete Jul 24, 2025
5ce4304
Add mutability maybe restart and made it so we can read old restart f…
jonahm-LANL Jul 28, 2025
ce7ef95
Just warn for default restart Params
pgrete Jul 29, 2025
80e3ef7
Update restart logic. Fixes #1235
pgrete Jul 29, 2025
f133962
Only warn about default non-input params
pgrete Jul 29, 2025
fbfd356
Ensure last output is not in the future
pgrete Jul 29, 2025
c7f8ab5
remove pmesh->is_restart for Globals
pgrete Jul 30, 2025
dd94417
Allow writing legacy id fields for particles
pgrete Jul 30, 2025
9d90214
Allow empty restart swarms
pgrete Jul 30, 2025
1988ed2
Unify missing var handling
pgrete Jul 30, 2025
38b1ec5
Add reminder todo to params
pgrete Jul 30, 2025
b3849d4
Add Changelog
pgrete Jul 30, 2025
51f45b7
change check orphans to default to false for restarts
jonahm-LANL Jul 30, 2025
dcc025d
more careful logic
jonahm-LANL Jul 30, 2025
04f0cab
oops added an if
jonahm-LANL Jul 30, 2025
3ab5353
ok try this
jonahm-LANL Jul 30, 2025
11a9884
Fix removing first elemn in linked list
pgrete Jul 31, 2025
43fcf78
Add missing guards
pgrete Jul 31, 2025
be19c0a
Merge branch 'pgrete/backwards-comapt-restarts-v2' into pgrete/pmd-ou…
pgrete Jul 31, 2025
fcc4a5b
Fix interface
pgrete Aug 1, 2025
72412bd
Check pin for opmd out and check vars skel
pgrete Aug 1, 2025
73e445f
Add option for single prec output in openpmd
pgrete Aug 1, 2025
d6936ae
Allow coarsened opmd outputs
pgrete Aug 1, 2025
4924929
Merge branch 'develop' into pgrete/pmd-output
pgrete Aug 18, 2025
cb8997b
Fix logic causing issues for restarts with varying output blocks
pgrete Aug 18, 2025
fa25d69
Fix formatting and test case
pgrete Aug 19, 2025
4f8249e
Merge branch 'pgrete/fix-output-block-restarts' into pgrete/pmd-output
pgrete Aug 19, 2025
6787b42
Fix/cleanup include logic and move format ver to impl
pgrete Aug 19, 2025
0a5df77
Add missing try-catch for opmd params
pgrete Aug 19, 2025
3edc7af
Fix opmd params try catch
pgrete Aug 19, 2025
7cc4040
Add final logic to opmd
pgrete Aug 19, 2025
e671e67
WIP slices
pgrete Aug 19, 2025
6ab9d02
Logic for slices seems to work. Data not.
pgrete Aug 20, 2025
6cd7c39
Fix final logic
pgrete Aug 21, 2025
56081fe
Fix slices
pgrete Aug 21, 2025
dc60f00
Merge remote-tracking branch 'origin/develop' into pgrete/pmd-output
pgrete Aug 21, 2025
3267252
Merge branch 'develop' into pgrete/pmd-output
pgrete Aug 25, 2025
505cdb4
Fix regression test
pgrete Aug 28, 2025
c657226
merge
BenWibking Sep 30, 2025
39c2a9a
fix style
BenWibking Sep 30, 2025
dcd576c
Merge branch 'develop' into pgrete/pmd-output
pgrete Oct 7, 2025
beeacba
Impl VariableExists for OpenPMD
pgrete Oct 7, 2025
00d9476
Format
pgrete Oct 7, 2025
4d33816
Merge branch 'develop' into pgrete/pmd-output
pgrete Oct 15, 2025
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
6 changes: 5 additions & 1 deletion .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ jobs:
cache-dependency-path: '**/requirements.txt'
- run: pip install -r requirements.txt

- name: Install dependencies
- name: Install dependencies (Homebrew)
run: |
brew install openmpi hdf5-mpi adios2 || true

- name: Install OpenPMD
run: |
openPMD_USE_MPI=ON python3 -m pip install openpmd-api --no-binary openpmd-api

- name: Install parthenon_tools
run: |
pip install scripts/python/packages/parthenon_tools
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-short.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
- name: cpplint
run: python3 ./tst/style/cpplint.py --counting=detailed --recursive src example tst
- name: copyright
# using variant mpi because openpmd lib is only installed with mpi support (no serial)
run: |
cmake -DCMAKE_CXX_FLAGS=-Werror -Bbuild-copyright-check
cmake -DCMAKE_CXX_FLAGS=-Werror -Bbuild-copyright-check -DMACHINE_VARIANT=mpi
cmake --build build-copyright-check -t check-copyright
- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -104,6 +105,7 @@ jobs:
# make sure parthenon tools is in our python path
export PYTHONPATH="$PYTHONPATH:$(python -m site --user-site)"
ctest -R regression_mpi_test:output_hdf5
ctest -R regression_mpi_test:restart_opmd
# Test example with swarms
- name: particle-leapfrog
run: |
Expand Down Expand Up @@ -174,6 +176,7 @@ jobs:
# make sure parthenon tools is in our python path
export PYTHONPATH="$PYTHONPATH:$(python -m site --user-site)"
ctest -R regression_mpi_test:output_hdf5
ctest -R regression_mpi_test:restart_opmd
# Test example with swarms
- name: particle-leapfrog
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
mkdir -p build && cd build
cmake -DPARTHENON_DISABLE_HDF5=ON \
-DPARTHENON_DISABLE_MPI=ON \
-DPARTHENON_DISABLE_OPENPMD=ON \
-DREGRESSION_GOLD_STANDARD_SYNC=OFF \
-DBUILD_TESTING=OFF \
..
Expand Down
47 changes: 47 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ option(PARTHENON_DISABLE_MPI "MPI is enabled by default if found, set this to Tr
option(PARTHENON_ENABLE_HOST_COMM_BUFFERS "CUDA/HIP Only: Allocate communication buffers on host (may be slower)" OFF)
option(PARTHENON_DISABLE_HDF5 "HDF5 is enabled by default if found, set this to True to disable HDF5" OFF)
option(PARTHENON_DISABLE_HDF5_COMPRESSION "HDF5 compression is enabled by default, set this to True to disable compression in HDF5 output/restart files" OFF)
option(PARTHENON_DISABLE_OPENPMD "OpenPMD is enabled by default if found, set this to ON to disable OpenPMD" OFF)
option(PARTHENON_USE_SYSTEM_OPENPMD "OpenPMD API is downloaded and installed automatically by default. Set this to ON to find and use a version installed on the system." OFF)
option(PARTHENON_DISABLE_SPARSE "Sparse capability is enabled by default, set this to True to compile-time disable all sparse capability" OFF)
option(PARTHENON_ENABLE_ASCENT "Enable Ascent for in situ visualization and analysis" OFF)
option(PARTHENON_LINT_DEFAULT "Linting is turned off by default, use the \"lint\" target or set \
Expand Down Expand Up @@ -207,6 +209,51 @@ if (NOT PARTHENON_DISABLE_HDF5)
install(TARGETS HDF5_C EXPORT parthenonTargets)
endif()

set(PARTHENON_ENABLE_OPENPMD OFF)
if (NOT PARTHENON_DISABLE_OPENPMD)
if (PARTHENON_USE_SYSTEM_OPENPMD)
# we want to enforce the use of ADIOS2 with this backend
set(PARTHENON_OPENPMD_COMPONENTS "ADIOS2")
if (ENABLE_MPI)
list(APPEND PARTHENON_OPENPMD_COMPONENTS "MPI")
else()
list(APPEND PARTHENON_OPENPMD_COMPONENTS "NOMPI")
endif()
find_package(openPMD 0.16.1 CONFIG COMPONENTS ${PARTHENON_OPENPMD_COMPONENTS})
if (NOT openPMD_FOUND)
message(FATAL_ERROR "OpenPMD API requested to be used from the environment but it was "
"not found. Either append the path to the installed OpenPMD lib via the "
"openPMD_DIR or CMAKE_PREFIX_PATH, or use the version shipped with Parthenon by keeping "
"PARTHENON_USE_SYSTEM_OPENPMD=OFF")
endif()
else()
include(FetchContent)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(openPMD_BUILD_CLI_TOOLS OFF)
set(openPMD_BUILD_EXAMPLES OFF)
set(openPMD_BUILD_TESTING OFF)
set(openPMD_BUILD_SHARED_LIBS OFF)
set(openPMD_INSTALL OFF)
set(openPMD_USE_ADIOS2 ON) # we definitely want ADIOS2
if( NOT Python3_Interpreter_FOUND)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
endif()
# Why not build the python interface for easier testing when Python is available
if(Python3_Interpreter_FOUND)
set(openPMD_USE_PYTHON ON)
else()
set(openPMD_USE_PYTHON OFF)
endif()
FetchContent_Declare(openPMD
GIT_REPOSITORY "https://github.com/openPMD/openPMD-api.git"
GIT_TAG "3a60e77") # Release 0.16.1
FetchContent_MakeAvailable(openPMD)
install(TARGETS openPMD EXPORT parthenonTargets)
endif()

set(PARTHENON_ENABLE_OPENPMD ON)
endif()

# Kokkos recommendatation resulting in not using default GNU extensions
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
4 changes: 3 additions & 1 deletion cmake/machinecfg/CI.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#========================================================================================
# Parthenon performance portable AMR framework
# Copyright(C) 2020 The Parthenon collaboration
# Copyright(C) 2020-2025 The Parthenon collaboration
# Licensed under the 3-clause BSD License, see LICENSE file for details
#========================================================================================
# (C) (or copyright) 2020. Triad National Security, LLC. All rights reserved.
Expand Down Expand Up @@ -38,3 +38,5 @@ else()
set(HDF5_ROOT /usr/local/hdf5/serial CACHE STRING "HDF5 path")
set(PARTHENON_DISABLE_MPI ON CACHE BOOL "Disable MPI")
endif()

set(PARTHENON_USE_SYSTEM_OPENPMD ON CACHE BOOL "Use API in container")
4 changes: 3 additions & 1 deletion cmake/machinecfg/GitHubActions.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#========================================================================================
# Parthenon performance portable AMR framework
# Copyright(C) 2021 The Parthenon collaboration
# Copyright(C) 2021-2025 The Parthenon collaboration
# Licensed under the 3-clause BSD License, see LICENSE file for details
#========================================================================================
# (C) (or copyright) 2021. Triad National Security, LLC. All rights reserved.
Expand Down Expand Up @@ -50,4 +50,6 @@ else()
set(PARTHENON_DISABLE_MPI ON CACHE BOOL "Disable MPI")
endif()

set(PARTHENON_USE_SYSTEM_OPENPMD ON CACHE BOOL "Use API in container")

set(CMAKE_CXX_FLAGS "${MACHINE_CXX_FLAGS}" CACHE STRING "Default flags for this config")
15 changes: 15 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#=========================================================================================
# Parthenon performance portable AMR framework
# Copyright(C) 2020-2025 The Parthenon collaboration
# Licensed under the 3-clause BSD License, see LICENSE file for detail
#=========================================================================================
# (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved.
#
# This program was produced under U.S. Government contract 89233218CNA000001 for Los
Expand Down Expand Up @@ -196,6 +200,7 @@ add_library(parthenon
outputs/history.cpp
outputs/io_wrapper.cpp
outputs/io_wrapper.hpp
outputs/output_attr.hpp
outputs/output_utils.cpp
outputs/output_utils.hpp
outputs/outputs.cpp
Expand Down Expand Up @@ -360,6 +365,16 @@ if (ENABLE_HDF5)
target_link_libraries(parthenon PUBLIC HDF5_C)
endif()

if (PARTHENON_ENABLE_OPENPMD)
target_sources(parthenon PRIVATE
outputs/parthenon_opmd.cpp
outputs/parthenon_opmd.hpp
outputs/restart_opmd.cpp
outputs/restart_opmd.hpp
)
target_link_libraries(parthenon PUBLIC openPMD::openPMD)
endif()

# For Cuda with NVCC (<11.2) and C++17 Kokkos currently does not work/compile with
# relaxed-constexpr, see https://github.com/kokkos/kokkos/issues/3496
# However, Parthenon heavily relies on it and there is no harm in compiling Kokkos
Expand Down
2 changes: 2 additions & 0 deletions src/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
// defne ENABLE_HDF5 or not at all
#cmakedefine ENABLE_HDF5

#cmakedefine PARTHENON_ENABLE_OPENPMD

// define PARTHENON_DISABLE_HDF5_COMPRESSION or not at all
#cmakedefine PARTHENON_DISABLE_HDF5_COMPRESSION

Expand Down
7 changes: 6 additions & 1 deletion src/interface/params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ class Params {
return myParams_.at(key)->type();
}

const Mutability &GetMutability(const std::string &key) const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

auto const it = myMutable_.find(key);
PARTHENON_REQUIRE_THROWS(it != myMutable_.end(), "Key " + key + " doesn't exist");
return it->second;
}

std::vector<std::string> GetKeys() const {
std::vector<std::string> keys;
for (auto &x : myParams_) {
Expand All @@ -130,7 +136,6 @@ class Params {
return keys;
}

auto GetMutability(const std::string &key) const { return myMutable_.at(key); }
bool IsMutable(const std::string &key) const {
return static_cast<bool>(myMutable_.at(key));
}
Expand Down
47 changes: 47 additions & 0 deletions src/outputs/output_attr.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//========================================================================================
// Parthenon performance portable AMR framework
// Copyright(C) 2023-2024 The Parthenon collaboration
// Licensed under the 3-clause BSD License, see LICENSE file for details
//========================================================================================
// (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved.
//
// This program was produced under U.S. Government contract 89233218CNA000001 for Los
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
// for the U.S. Department of Energy/National Nuclear Security Administration. All rights
// in the program are reserved by Triad National Security, LLC, and the U.S. Department
// of Energy/National Nuclear Security Administration. The Government is granted for
// itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide
// license in this material to reproduce, prepare derivative works, distribute copies to
// the public, perform publicly and display publicly, and to permit others to do so.
//========================================================================================

#ifndef OUTPUTS_OUTPUT_ATTR_HPP_
#define OUTPUTS_OUTPUT_ATTR_HPP_

#include <vector>

// JMM: This could probably be done with template magic but I think
// using a macro is honestly the simplest and cleanest solution here.
// Template solution would be to define a variatic class to conain the
// list of types and then a hierarchy of structs/functions to turn
// that into function calls. Preprocessor seems easier, given we're
// not manipulating this list in any way.
// The following types are the ones we allow to be stored as attributes in outputs
// (specifically within Params).
#define PARTHENON_ATTR_VALID_VEC_TYPES(T) \
T, std::vector<T>, ParArray1D<T>, ParArray2D<T>, ParArray3D<T>, HostArray1D<T>, \
HostArray2D<T>, HostArray3D<T>, Kokkos::View<T *>, Kokkos::View<T **>, \
ParArrayND<T>, ParArrayHost<T>
// JMM: This is the list of template specializations we
// "pre-instantiate" We only pre-instantiate device memory, not host
// memory. The reason is that when building with the Kokkos serial
// backend, DevMemSpace and HostMemSpace are the same and so this
// resolves to the same type in the macro, which causes problems.
#define PARTHENON_ATTR_FOREACH_VECTOR_TYPE(T) \
PARTHENON_ATTR_APPLY(T); \
PARTHENON_ATTR_APPLY(Kokkos::View<T *, LayoutWrapper, DevMemSpace>); \
PARTHENON_ATTR_APPLY(Kokkos::View<T **, LayoutWrapper, DevMemSpace>); \
PARTHENON_ATTR_APPLY(Kokkos::View<T ***, LayoutWrapper, DevMemSpace>); \
PARTHENON_ATTR_APPLY(device_view_t<T>)

#endif // OUTPUTS_OUTPUT_ATTR_HPP_
Loading
Loading