Skip to content

Output version#254

Merged
Sam Clarke-Green (t00sa) merged 18 commits into
MetOffice:mainfrom
andrewcoughtrie:output_version
Jun 25, 2026
Merged

Output version#254
Sam Clarke-Green (t00sa) merged 18 commits into
MetOffice:mainfrom
andrewcoughtrie:output_version

Conversation

@andrewcoughtrie

Copy link
Copy Markdown
Collaborator

Description

I've restructured the header output so that it only outputs it once per file (where it used to put the header for each of the ranks in the collated files). The header now includes the output style and the format version which can be picked up by the post-processing apps to check they are working against a format they can deal with. Whilst making these changes I've restructured the test-output-files system tests to both check against known good output (this checks the header only (the first 13 lines) as the time values may change, this should be extended in future but will require more complex output parsing) and names the files uniquely based on the total number of cores being tested on (this avoids a race condition in that the 1 and 2 core tests were naming their output files the same but the files had differing content).

Linked issues

Closes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • New tests have been added
  • Tests have been modified to accommodate this change

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes, for both debug and optimised builds

@t00sa Sam Clarke-Green (t00sa) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nothing major. I've added a couple of comments inline.

Comment thread src/c++/writer/single.cpp Outdated
Comment on lines +62 to +64
// Broadcast the header length from rank 0 so all ranks know the offset
int header_length = static_cast<int>(header_buffer.str().length());
MPI_Bcast(&header_length, 1, MPI_INT, 0, mpi_context_.get_handle());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This isn't needed because header_length is the same on every task. Might be worth adding a comment to make this clear to future developers.

Comment thread src/c++/formatter.cpp
*/

void meto::Formatter::threads(std::ostream &os, hashvec_t hashvec) {
void meto::Formatter::default_output(std::ostream &header, std::ostream &os,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The doxygen comment needs updating. It would also make sense to either change the comments that refer to the key and the header or to change the ostream names to match the comment description.

@t00sa Sam Clarke-Green (t00sa) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

@t00sa
Sam Clarke-Green (t00sa) merged commit c17c6f1 into MetOffice:main Jun 25, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants