Skip to content

Improve error condition handling#292

Merged
bonachea merged 8 commits intoBerkeleyLab:mainfrom
bonachea:stat-errmsg
Feb 14, 2026
Merged

Improve error condition handling#292
bonachea merged 8 commits intoBerkeleyLab:mainfrom
bonachea:stat-errmsg

Conversation

@bonachea
Copy link
Member

Fixes #87
Fixes #128

Example out-of-memory message:

ERROR STOP 'Fortran shared heap is out of memory
  while allocating 500 TiB of additional coarray memory.

  Shared heap size information:
    Total shared heap:               1 GiB    (CAF_HEAP_SIZE)
    Total non-coarray heap:        102 MiB    (CAF_COMP_FRAC * CAF_HEAP_SIZE)
    Current team coarray heap:     921 MiB

  Consider setting the CAF_HEAP_SIZE environment variable to request a larger heap.'

@bonachea bonachea requested a review from ktras January 30, 2026 02:10
Copy link
Collaborator

@ktras ktras left a comment

Choose a reason for hiding this comment

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

LGTM and I have verified that all of the PRIF procedures that have a stat argument are now dealt with.

* Enforce segment size invariants

The symmetric and non-symmetric heaps must each be sized on page boundaries.

Previously some tiny or misaligned values of CAF_HEAP_SIZE would cause startup
time crashes inside caf_caffeinate or dlmalloc.

* Expose more shared heap information up into Fortran

* Convert heap size manipulation from size_t to (u)intptr_t
The use of list-directed output in `prif_(error_)stop(stop_code_char)`
was leading to processor-defined line break behavior, which is
quite poor in practice with flang.
@bonachea bonachea merged commit bdef187 into BerkeleyLab:main Feb 14, 2026
34 checks passed
@bonachea bonachea deleted the stat-errmsg branch February 14, 2026 04:13
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.

Add proper handling of shared memory exhaustion Ensure all PRIF calls with an optional stat argument actually set it when present

2 participants