Skip to content

Commit a71d40d

Browse files
authored
Bump Kokkos to 5.1.1 and Parthenon to upcoming 26.xx version (#167)
* Bump Kokkos to 5.1.1 and Parthenon to upcoming 26.xx version * Remove incorrect enforced symmetry with race condition and add explicit checks * Remove complex conjugate modes from sample input * Make REQUIRE a WARN for backwards compatibility * Remove Hermitian modes from gen fmturb modes * Add Changelog * Update reference data given new sample vectors * use ref data created on CI machine * Update ref data following latest PArtheon fixes * Enforce stronger limits on error in particle advection * Add info on breaking changes * Fix compiluation given updated Parthenon API * Use ULP logic for comparison in test * Make formatter happy * Bump parth to use standard compliant labels * Fix parth compile and print warn only on rank 0 * Update relevant info in changelog
1 parent e061acb commit a71d40d

11 files changed

Lines changed: 85 additions & 50 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
## Current develop (i.e., `main` branch)
44

55
### General notes
6+
With the latest update of the Parthenon submodule several new features are now available, e.g.,
7+
- [OpenPMD output](https://parthenon-hpc-lab.github.io/parthenon/pgrete/pmd-output/src/outputs.html#openpmd) including support for slices, data compression and coarse graining\
8+
Note, the original naming convention (in the development branch) used for labeling components was not fully standard compliant.
9+
New outputs are automatically written in the standard compliant version.
10+
However, to keep the old scheme (e.g., when restarting from existing simulation data with the intent to keep the timeseries consistent add `openpmd_format_version=1` to the corresponding openpmd output blocks.
11+
- A watchdog (to kill a simulation that hangs for whatever reason). Just run with `-w HH:MM:SS`.
12+
- Support for (tracer) particles with AMR.
13+
- Support for using more parallelism for the ghost zone exchange kernels, which speeds up simulation with few (<10) blocks per rank on device, see [here](https://github.com/parthenon-hpc-lab/parthenon/pull/1271).
14+
A good starting point is `parthenon/mesh/minimum_number_of_teams_for_boundary_kernel=8`.
15+
16+
With the update of Kokkos to version 5.1.1 (or >5.0 in general) a performance regression was identified.
17+
This is likely related to the Kokkos-internal use of int64 indices in the new `mdspan` based `View`s resulting more register usage (which. in turn, results in lower occupancy on devices).
18+
The Kokkos team is aware of this and working on a fix.
19+
If the current performance is (significantly) below expectation, one can try to use "legacy" views via `Kokkos_ENABLE_IMPL_VIEW_LEGACY=ON`.
20+
21+
**IMPORTANT** The latest Parthenon submodule includes a fix for a race condition in the flux correction communication routine when run with mesh refinement on GPUs, see [here](https://github.com/parthenon-hpc-lab/parthenon/pull/1405).
22+
Please update immediately or rebuild AthenaPK with `PARTHENON_DISABLE_SPARSE=OFF` to mitigate the race condition.
623

724
### Added (new features/APIs/variables/...)
825

@@ -12,11 +29,14 @@
1229
- [[PR 172]](https://github.com/parthenon-hpc-lab/athenapk/pull/172) Fixed data race condition in few modes IFT (no practical implication)
1330

1431
### Infrastructure
32+
- [[PR 167]](https://github.com/parthenon-hpc-lab/athenapk/pull/167) Bump Kokkos to 5.1.1 and `Parthenon` to upcoming 26.xx version (incl OpenPMD support)
1533
- [[PR 168]](https://github.com/parthenon-hpc-lab/athenapk/pull/168) Document agentic coding guidelines (and add PR template)
1634

1735
### Removed (removing behavior/API/varaibles/...)
1836

1937
### Incompatibilities (i.e. breaking changes)
38+
- [[PR 167]](https://github.com/parthenon-hpc-lab/athenapk/pull/167) C++20 is now the minimum standard
39+
- [[PR 167]](https://github.com/parthenon-hpc-lab/athenapk/pull/167) New Parthenon submodule changed input file parsing (removed `*pib = pin->pfirst_block;`), see [here](https://github.com/parthenon-hpc-lab/parthenon/pull/1385)
2040

2141
## Release 26.05
2242

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ project(athenaPK VERSION 26.05 LANGUAGES CXX)
1919

2020
set(CMAKE_CXX_EXTENSIONS OFF)
2121
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
22-
set(CMAKE_CXX_STANDARD 17)
22+
set(CMAKE_CXX_STANDARD 20)
2323

2424
# make paths in target_source() absolute
2525
# used for sources in src/pgen folder
@@ -70,6 +70,7 @@ set(PARTHENON_ENABLE_TESTING OFF CACHE BOOL "Disable Parthenon testing.")
7070
set(PARTHENON_DISABLE_OPENMP ON CACHE BOOL "Disable OpenMP")
7171
set(PARTHENON_DISABLE_EXAMPLES ON CACHE BOOL "Don't build Parthenon examples.")
7272
set(PARTHENON_DISABLE_SPARSE ON CACHE BOOL "Disable sparse (not used in AthenaPK yet)")
73+
set(PARTHENON_DISABLE_OPENPMD OFF CACHE BOOL "Enable OpenPMD outputs in AthenaPK by default")
7374

7475
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/parthenon/CMakeLists.txt)
7576
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/parthenon parthenon)

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ please either
5858
##### Required
5959

6060
* CMake 3.13 or greater
61-
* C++17 compatible compiler
61+
* C++20 compatible compiler
6262
* Parthenon (using the submodule version provided by AthenaPK)
6363
* Kokkos (using the submodule version provided by AthenaPK)
6464

@@ -67,6 +67,7 @@ please either
6767
* MPI
6868
* OpenMP (for host parallelism. Note that MPI is the recommended option for on-node parallelism.)
6969
* HDF5 (for outputs)
70+
* OpenPMD and ADIOS2 (for outputs, recommended future standard but no `yt` support yet. Can be disabled via `PARTHENON_DISABLE_OPENPMD=ON` during configure)
7071
* Python3 (for regressions tests with numpy, scipy, matplotlib, unyt, and h5py modules)
7172
* Ascent (for in situ visualization and analysis)
7273

@@ -125,22 +126,36 @@ Some example input files are provided in the [inputs](inputs/) folder.
125126

126127
#### Data Analysis
127128

128-
There exit several options to read/process data written by AthenaPK -- specifically in
129-
the `file_type = hdf5` format, see
129+
There exit several options to read/process data written by AthenaPK, see
130130
[Parthenon doc](https://parthenon-hpc-lab.github.io/parthenon/develop/src/outputs.html):
131131

132132
1. With [ParaView](https://www.paraview.org/) and
133133
[VisIt](https://wci.llnl.gov/simulation/computer-codes/visit/).
134-
In ParaView, select the "XDMF Reader" when prompted.
134+
For HDF5 in ParaView, select the "XDMF Reader" when prompted.
135+
For openPMD outputs, the native BP5 reader can be used to open the files.
136+
However, this may perform poorly (due to lack of automated mesh decomposition
137+
and load balancing).
138+
Thus, it is recommended to use the specific
139+
[openpmd-visit-reader](https://github.com/BenWibking/openpmd-visit-reader)
140+
plugin for VisIt, which has robustly handled larger, multiple TB datasets.
135141

136142
2. With [yt](https://yt-project.org/)
137143
As of versions >=4.4 `*.phdf` files can be read as usual with `yt.load()`.
144+
OpenPMD/ADIOS2 output cannot be properly read by `yt` yet.
138145

139-
3. Using [Ascent](https://github.com/Alpine-DAV/ascent) (for in situ visualization and analysis).
146+
3. OpenPMD outputs in general.
147+
Outputs written following the openPMD standard can be processed by any tool implemting
148+
the standard.
149+
For Python based analysis the most straightforward way is via the
150+
[openPMD-api](https://github.com/openPMD/openPMD-api)
151+
or even more easily via the [openPMD-viewer](https://github.com/openPMD/openPMD-viewer)
152+
that builds on the API (both can be installed via `pip`).
153+
154+
4. Using [Ascent](https://github.com/Alpine-DAV/ascent) (for in situ visualization and analysis).
140155
This requires Ascent to be installed/available at compile time of AthenaPK.
141156
To enable set `PARTHENON_ENABLE_ASCENT=ON`.
142157

143-
4. (Not recommended) Using the integrated Python script called "`phdf`" provided by Parthenon,
158+
5. (Not recommended) Using the integrated Python script called "`phdf`" provided by Parthenon,
144159
i.e., the either install `parthenon_tools`
145160
(located in `external/parthenon/scripts/python/packages/parthenon/tools`) or add
146161
that directory to your Python path.

external/Kokkos

Submodule Kokkos updated 1454 files

external/parthenon

Submodule parthenon updated 224 files

src/pgen/cloud.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,10 @@ void InitUserMeshData(Mesh *mesh, ParameterInput *pin) {
119119
// rescale sim time limit
120120
pin->SetReal("parthenon/time", "tlim", tlim_rescaled);
121121
// rescale dt of each output block
122-
parthenon::InputBlock *pib = pin->pfirst_block;
123-
while (pib != nullptr) {
124-
if (pib->block_name.compare(0, 16, "parthenon/output") == 0) {
125-
auto dt = pin->GetReal(pib->block_name, "dt");
126-
pin->SetReal(pib->block_name, "dt", dt * t_cc);
127-
}
128-
pib = pib->pnext; // move to next input block name
122+
auto blocks = pin->GetBlockNamesWithPrefix("parthenon/output");
123+
for (const auto &block_name : blocks) {
124+
auto dt = pin->GetReal(block_name, "dt");
125+
pin->SetReal(block_name, "dt", dt * t_cc);
129126
}
130127

131128
msg << "## Interpreted time limits (partenon/time/tlim and dt for outputs) as in "

src/pgen/shattering.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,10 @@ void InitUserMeshData(Mesh *mesh, ParameterInput *pin) {
163163
// rescale sim time limit
164164
pin->SetReal("parthenon/time", "tlim", tlim_orig * tlim);
165165
// rescale dt of each output block
166-
parthenon::InputBlock *pib = pin->pfirst_block;
167-
while (pib != nullptr) {
168-
if (pib->block_name.compare(0, 16, "parthenon/output") == 0) {
169-
auto dt = pin->GetReal(pib->block_name, "dt");
170-
pin->SetReal(pib->block_name, "dt", dt * tlim);
171-
}
172-
pib = pib->pnext; // move to next input block name
166+
auto blocks = pin->GetBlockNamesWithPrefix("parthenon/output");
167+
for (const auto &block_name : blocks) {
168+
auto dt = pin->GetReal(block_name, "dt");
169+
pin->SetReal(block_name, "dt", dt * tlim);
173170
}
174171

175172
// Now disable rescaling of times so that this is done only once and not for restarts

src/utils/few_modes_ft.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//========================================================================================
22
// AthenaPK - a performance portable block structured AMR astrophysical MHD code.
3-
// Copyright (c) 2023, Athena-Parthenon Collaboration. All rights reserved.
3+
// Copyright (c) 2023-2026, Athena-Parthenon Collaboration. All rights reserved.
44
// Licensed under the 3-clause BSD License, see LICENSE file for details
55
//========================================================================================
66
//========================================================================================
@@ -74,17 +74,19 @@ FewModesFT::FewModesFT(parthenon::ParameterInput *pin, parthenon::StateDescripto
7474
if (k_vec_host(0, i) == 0 && k_vec_host(0, i) == k_vec_host(0, j) &&
7575
k_vec_host(1, i) == -k_vec_host(1, j) &&
7676
k_vec_host(2, i) == -k_vec_host(2, j)) {
77-
PARTHENON_WARN(
78-
"The given set of k_vec include complex conjugate partners for mode " +
79-
std::to_string(i) + " with components " + std::to_string(k_vec_host(0, i)) +
80-
" " + std::to_string(k_vec_host(1, i)) + " " +
81-
std::to_string(k_vec_host(2, i)) +
82-
"."
83-
"In theory, this results in these modes being counted double. In practice, "
84-
"this will have little to no effect as the normalization is done separate "
85-
"for the real space field rather than the spectral field. However, if this "
86-
"is a fresh simulation (and not a restarted one with given/fixed k_vec) it "
87-
"is recommended to update the set of k_vec in the input file.");
77+
if (parthenon::Globals::my_rank == 0) {
78+
PARTHENON_WARN(
79+
"The given set of k_vec include complex conjugate partners for mode " +
80+
std::to_string(i) + " with components " + std::to_string(k_vec_host(0, i)) +
81+
" " + std::to_string(k_vec_host(1, i)) + " " +
82+
std::to_string(k_vec_host(2, i)) +
83+
"."
84+
"In theory, this results in these modes being counted double. In practice, "
85+
"this will have little to no effect as the normalization is done separate "
86+
"for the real space field rather than the spectral field. However, if this "
87+
"is a fresh simulation (and not a restarted one with given/fixed k_vec) it "
88+
"is recommended to update the set of k_vec in the input file.");
89+
}
8890
}
8991
PARTHENON_REQUIRE_THROWS(!(k_vec_host(0, i) == k_vec_host(0, j) &&
9092
k_vec_host(1, i) == k_vec_host(1, j) &&

tst/regression/test_suites/particle_advection/particle_advection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ def Analyse(self, parameters):
9595
relabs = 0.5 * np.abs(((a - b) + 1) % 2 - 1)
9696

9797
# In principle, the difference should be 0
98-
# TODO(PG) investigate where this comes from. Integrator? Interpolation? ...?
99-
if relabs.max() > 0.003:
98+
if relabs.max() > 1e-14:
10099
print(
101100
f"ERROR: difference between intial and final position to large for {pos}: {relabs.max()}"
102101
)
-1 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)