Skip to content
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

Add cycle and nbtotal to hst #1128

Merged
merged 9 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Current develop

### Added (new features/APIs/variables/...)
- [[PR 1128]](https://github.com/parthenon-hpc-lab/parthenon/pull/1128) Add cycle and nbtotal to hst
- [[PR 1099]](https://github.com/parthenon-hpc-lab/parthenon/pull/1099) Functionality for outputting task graphs in GraphViz format.
- [[PR 1091]](https://github.com/parthenon-hpc-lab/parthenon/pull/1091) Add vector wave equation example.
- [[PR 991]](https://github.com/parthenon-hpc-lab/parthenon/pull/991) Add fine fields.
Expand Down Expand Up @@ -71,6 +72,7 @@
- [[PR 1108]](https://github.com/parthenon-hpc-lab/parthenon/pull/1108) Remove NaN payload tags infrastructure

### Incompatibilities (i.e. breaking changes)
- [[PR 1128]](https://github.com/parthenon-hpc-lab/parthenon/pull/1128) Add cycle and nbtotal to hst
- [[PR 1108]](https://github.com/parthenon-hpc-lab/parthenon/pull/1108) Remove NaN payload tags infrastructure
- [[PR 1026]](https://github.com/parthenon-hpc-lab/parthenon/pull/1026) Particle BCs without relocatable device code
- [[PR 1037]](https://github.com/parthenon-hpc-lab/parthenon/pull/1037) Add SwarmPacks
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/burgers/burgers_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
description="Compute difference between two history solvers parthenon VIBE",
)
parser.add_argument("file1", type=str, help="First file in diff")
parser.add_argument("file2", type=str, help="Second fiel in diff")
parser.add_argument("file2", type=str, help="Second file in diff")
parser.add_argument(
"-t", "--tolerance", type=float, default=1e-8, help="Relative tolerance for diff"
)
Expand Down Expand Up @@ -54,4 +54,4 @@ def compare_files(file1, file2, tolerance, print_results=True):

if __name__ == "__main__":
args = parser.parse_args()
sys.exit(compare_files(args.file1, args.file1, args.tolerance, True))
sys.exit(compare_files(args.file1, args.file2, args.tolerance, True))
3 changes: 0 additions & 3 deletions benchmarks/burgers/burgers_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
hst_vars.emplace_back(HstSum, ReduceMass, "MS Mass " + std::to_string(i_octant));
i_octant++;
}
hst_vars.emplace_back(HstSum, MeshCountHistory, "Meshblock count");
pkg->AddParam(parthenon::hist_param_key, hst_vars);

pkg->EstimateTimestepMesh = EstimateTimestepMesh;
Expand Down Expand Up @@ -439,6 +438,4 @@ Real MassHistory(MeshData<Real> *md, const Real x1min, const Real x1max, const R
return result;
}

Real MeshCountHistory(MeshData<Real> *md) { return md->NumBlocks(); }

} // namespace burgers_package
1 change: 0 additions & 1 deletion benchmarks/burgers/burgers_package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Real EstimateTimestepMesh(MeshData<Real> *md);
TaskStatus CalculateFluxes(MeshData<Real> *md);
Real MassHistory(MeshData<Real> *md, const Real x1min, const Real x1max, const Real x2min,
const Real x2max, const Real x3min, const Real x3max);
Real MeshCountHistory(MeshData<Real> *md);

// compute the hll flux for Burgers' equation
KOKKOS_INLINE_FUNCTION
Expand Down
4 changes: 4 additions & 0 deletions src/outputs/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ void HistoryOutput::WriteOutputFile(Mesh *pm, ParameterInput *pin, SimTime *tm,
std::fprintf(pfile, "# History data\n"); // descriptor is first line
std::fprintf(pfile, "# [%d]=time ", iout++);
std::fprintf(pfile, "[%d]=dt ", iout++);
std::fprintf(pfile, "[%d]=cycle ", iout++);
std::fprintf(pfile, "[%d]=nbtotal ", iout++);
for (auto &op : ops) {
for (auto &label : labels[op]) {
std::fprintf(pfile, "[%d]=%-8s ", iout++, label.c_str());
Expand All @@ -187,6 +189,8 @@ void HistoryOutput::WriteOutputFile(Mesh *pm, ParameterInput *pin, SimTime *tm,
// write history variables
std::fprintf(pfile, output_params.data_format.c_str(), tm->time);
std::fprintf(pfile, output_params.data_format.c_str(), tm->dt);
std::fprintf(pfile, "%12d ", tm->ncycle);
std::fprintf(pfile, "%12d", pm->nbtotal);
for (auto &op : ops) {
for (auto &result : results[op]) {
std::fprintf(pfile, output_params.data_format.c_str(), result);
Expand Down
4 changes: 3 additions & 1 deletion tst/regression/test_suites/output_hdf5/output_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def Analyse(self, parameters):
ref_results = [
["time", 1.0, 1.0],
["dt", 1.75781e-03, 3.12500e-03],
["cycle", 5.69000e02, 2.14000e02],
["nbtotal", 1.30000e02, 2.04000e02],
["total_advected", 7.06177e-02, 1.39160e-02],
["advected_powers_0", 7.06177e-02, 1.39160e-02],
["advected_powers_1", 3.88112e-02, 2.59597e-03],
Expand All @@ -141,7 +143,7 @@ def Analyse(self, parameters):
f.readline()
header = f.readline()[1:].split()
for i, val in enumerate(ref_results):
col_label = header[i].strip()[4:]
col_label = (header[i].strip()).split("=", 1)[1]
if col_label != val[0]:
print(
"Wrong",
Expand Down
Loading