Skip to content

Write several time samples to one history file - #44

Closed
mvertens wants to merge 1 commit into
ESCOMP:mainfrom
mvertens:feature/multiple_timesamples_per_historyfile_escomp
Closed

mvertens wants to merge 1 commit into
ESCOMP:mainfrom
mvertens:feature/multiple_timesamples_per_historyfile_escomp

Conversation

@mvertens

Copy link
Copy Markdown

PR checklist

  • Short (1 sentence) summary of your PR:
    Write several time samples to one history file
  • Developer(s):
    mvertens
  • Please copy the PR test results link or provide a summary of testing completed below.
    See testing summary below
  • How much do the PR code changes differ from the unmodified code?
    • bit for bit
  • Does this PR create or have dependencies on Icepack or any other models?
    • Yes - needs a CICE_Wrapper PR
  • Does this PR update the Icepack submodule? If so, the Icepack submodule must point to a hash on Icepack's main branch.
    • No
  • Does this PR add any new test cases?
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)
    • No, does the documentation need to be updated at a later time?
      • Yes
  • Please document the changes in detail, including why the changes are made. This will become part of the PR commit log.

Summary

CICE writes one history file per time sample. For daily output needed in CMIP7 runs, a new netcdf file is created, defined written to and and closes a file every day. This not only has a negative impact on performance but also is thought to be a leading cause of the periodic hangs during I/O operations on olivia.

A new setup_nml variable, hist_file_period(max_nstrm), has been added that determines how man time samples can go into a target history file for all the allowed streams (i.e. m, d, ...). It can take values of none, month or year. The default is none everywhere (i.e. the current behavior).
As an example - the following setting will bundle daily output into monthly files.

histfreq         = 'm', 'd', 'x', 'x', 'x'
hist_file_period = 'none', 'month', 'none', 'none', 'none'

The daily stream then writes one file for January holding all 31 daily samples, one for February holding 28, and so on. Each file is named after its first sample. The fields and their values do not change. How often a sample is written is still set by histfreq.

Previously, ten PIO decompositions were created for each history write. They only need to be created once, since a decomposition belongs to the iosystem rather than to a file, so one set can be used for every file. They are now created on the first write and kept. This change does not depend on hist_file_period and improves every configuration, including one that writes monthly output.

NOTE: this PR will need a corresponding PR to CESM_CICE (will document this here when it is issues)

Performance impact

@dabail10 @briandobbins @phillips-ad
With the standard tn14 noresm CICE grid, the cmip7 daily output turned on, and the DIAF configuration, the daily wall clock time for the ice code is about 2/3 of the old setup.

Testing

The following testing was done for the same PR to NorESM:
Test1:

A two month run with the following settings
-compset NOIIA --res T62_tn14 --mach olivia --compiler intel
was done with a monthly stream and a daily stream grouped by month.
hist_file_period = "none", "month", "none", "none"
The user_nl_cice file was set to have the same settings as in cmip7 runs for daily output.

The daily stream wrote two files. January holds 31 samples and February holds 28. The output times were at midday on each day, and the bounds ran from one day to the next without a gap. No day was repeated or missing where the two files meet. January’s file was closed during the run and not at the end of it. The monthly stream wrote one file per month as before.

The same run was then repeated with hist_file_period set to none, which wrote one file per day. The daily files for January were joined with ncrcat and compared against the grouped file one record at a time with cprnc. All 31 records were identical in every field.

Test2:
Ran the previous case but in the following way:
Test2a: ran for 16 days
Test2b: restarted and ran until the end of the month
The resulting January file for daily output was identical to the one obtained in Test1

Test3:
Verified that the following test passed
ERS_Ld3.ne16pg3_tn14.NHistEsm.olivia_intel.allactive-cmip7hfio

No testing was done for this PR on derecho

@dabail10 @briandobbins phillips-ad
Performance impact: With the standard tn14 noresm grid and the DIAF configuration, the daily wall clock time for the ice code is about 2/3 of the old setup.

PR done in collaboration with Claude Opus 5.5

@mvertens

Copy link
Copy Markdown
Author

@dabail10 - I'm not sure I did this PR to the correct branch. I'm doing this off of main - but it looks like CESM_CICE is pointing to cice6_6_3_20260904 - which is almost a year old. I will hold off doing PR to CESM_CICE until I know what branch this is supposed to point.

@dabail10

Copy link
Copy Markdown
Collaborator

Please submit to to the CICE Consortium.

https://github.com/CICE-Consortium/CICE

@dabail10 dabail10 closed this Oct 31, 2026
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