Closed dqwu closed 8 months ago
Do you need to convert the restart files to netcdf? Anytime they are that large, assume you're doing bp-only restarts.
Do you need to convert the restart files to netcdf? Anytime they are that large, assume you're doing bp-only restarts.
Actually the conversion is not required for restart runs. However, this issue still needs to be fixed for the SUBSET rearranger, which is the default rearranger used by the conversion tool.
Variable-length array (VLA) is supported by C99 but its usage should not be abused. Normally, it should only be used for local arrays with relatively small sizes.
While attempting to convert a sizable eamxx restart file (exceeding 2 TB) from ADIOS BP5 format to NetCDF format on Frontier, a segmentation fault was observed:
srun: error: frontier00005: task 32: Segmentation fault
[Core dump stack trace with GDB]
Upon further investigation, it has been identified that the issue stems from the use of stack-based pointer arrays within the write_darray_multi_par() function. Specifically, the arrays startlist and countlist need to be migrated to heap-based arrays due to their substantial size.
Here's the relevant code snippet:
For IO tasks, num_regions can be as large as 167,772,224, leading to a considerable space requirement for the startlist and countlist arrays, approximately 2.5 GB.
Please be aware that the ADIOS conversion tool employs the SUBSET rearranger as its default setting. If the BOX rearranger is used instead, the described issue becomes non-reproducible. This is due to the fact that, when using the BOX rearranger, num_regions is always 1.
It is important to note that on Frontier, the stack size limit is set to less than 300 MB:
To resolve this, it is recommended to transition these arrays from stack-based to heap-based to accommodate the larger size requirements, preventing potential segmentation faults.
See also issue #17, PR #264, scream PR E3SM-Project/scream#2393