Skip to content

Restore Cray !DIR$ directives mangled into comments by the formatter - #2000

Closed
sbryngelson wants to merge 3 commits into
MFlowCode:masterfrom
sbryngelson:fix/cray-dir-directives
Closed

sbryngelson wants to merge 3 commits into
MFlowCode:masterfrom
sbryngelson:fix/cray-dir-directives

Conversation

@sbryngelson

@sbryngelson sbryngelson commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

The switch to ffmt (52e8af1) rewrote every "!DIR$ ..." line as a
"! DIR$ ..." comment, which CCE ignores: OPTIMIZE (-haggress) in
m_igr.fpp and m_time_steppers.fpp, the IGR "unroll 4/6" hints, and the
CCE 19 IPA NOINLINE workaround in m_phase_change.fpp (where ffmt also
merged the three directives into one comment). ffmt has no option to
leave directive lines alone and re-mangles them on every format run.

Add a CRAY_DIR Fypp macro that emits "!DIR$ " under
#ifdef _CRAYFTN, following the GPU_ROUTINE cray_inline pattern, and use
it for all of these. The directive text is restored from 52e8af1^
(s_TSat dropped from the NOINLINE list, since it no longer exists). The
unroll hints, previously unguarded, are now Cray-only.

Verified that ffmt --check leaves the files unchanged, and that Fypp
output with MFC_COMPILER=Cray contains each !DIR$ line inside an
#ifdef _CRAYFTN block (unroll 6 checked with case optimization and
igr_order = 5). Not compiled with CCE.

The switch to ffmt (52e8af1) rewrote every "!DIR$ ..." line as a
"! DIR$ ..." comment, which CCE ignores: OPTIMIZE (-haggress) in
m_igr.fpp and m_time_steppers.fpp, the IGR "unroll 4/6" hints, and the
CCE 19 IPA NOINLINE workaround in m_phase_change.fpp (where ffmt also
merged the three directives into one comment). ffmt has no option to
leave directive lines alone and re-mangles them on every format run.

Add a CRAY_DIR Fypp macro that emits "!DIR$ <directive>" under
#ifdef _CRAYFTN, following the GPU_ROUTINE cray_inline pattern, and use
it for all of these. The directive text is restored from 52e8af1^
(s_TSat dropped from the NOINLINE list, since it no longer exists). The
unroll hints, previously unguarded, are now Cray-only.

Verified that ffmt --check leaves the files unchanged, and that Fypp
output with MFC_COMPILER=Cray contains each !DIR$ line inside an
#ifdef _CRAYFTN block (unroll 6 checked with case optimization and
igr_order = 5). Not compiled with CCE.
@github-actions

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/simulation/m_igr.fpp 2296 +7
src/common/include/parallel_macros.fpp 256 +5
src/common/m_phase_change.fpp 286 +1
src/simulation/m_time_steppers.fpp 905 -1
Directory Lines Diff
common 10484 +6
simulation 28509 +6
total 47526 +12

@sbryngelson

Copy link
Copy Markdown
Member Author

Closing this for now to bring the number of open PRs from me down to four, so the ones that stay open get real review attention rather than being lost in a queue of 35.

No work is lost and nothing needs re-doing. The branch fix/cray-dir-directives remains on the fork at 9ec1bec684, this PR's diff and discussion stay here, and the head commit is additionally archived in a local verified bundle. Reopening takes no force-push and no rebase:

gh pr reopen 2000 -R MFlowCode/MFC

I intend to reopen these in small batches as the open slots free up. Apologies for the notification noise.

Opened and closed with Claude Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant