Skip to content

Port check diffusive CFL loop in MOM tracer hor diff - #89

Open
uwagura wants to merge 1 commit into
MOM6-GPU:dev/gpufrom
uwagura:port/check-diffusive-hordiff
Open

Port check diffusive CFL loop in MOM tracer hor diff#89
uwagura wants to merge 1 commit into
MOM6-GPU:dev/gpufrom
uwagura:port/check-diffusive-hordiff

Conversation

@uwagura

@uwagura uwagura commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

There was a block of code in MOM_tracer_hor_diff that only ran when check_diffusive_CFL was true. This setting is true in benchmark_ALE, but not in benchmark. Since the khdt_* arrays needed for this block of code were set on the device , the host values used for this calculation contained garbage values in benchmark_ALE, which could occasionally cause the num_itts variable set in this block to take on extremely large values and make the benchmark_ALE config appear to hang.

This PR simply ports this block of code so that max_CFL, and by extension num_itts, are always set correctly.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

GPU Port Coverage

Overall: 2046 / 5662 portable executed lines ported (36.1%)
Since base branch: +3 ported lines (+0.0 pp)

Files touched by this PR: 36 / 42 portable executed lines ported (85.7%)

Full per-file / per-routine breakdown: see the "gpu-port-report" job summary and artifact.

Full line-by-line coverage report

@edoyango edoyango 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.

clearly i wasn't disciplined enough with wrapping sections with !$omp target update! thx for persisting with this.

Ofc the hang decided not to show up when i actually want it, but it looks reasonable and reproduces answers.

Comment on lines +394 to +398
do concurrent (j=js:je, i=is:ie) DO_LOCALITY(reduce(max:max_CFL))
CFL(i,j) = 2.0*((khdt_x(I-1,j) + khdt_x(I,j)) + &
(khdt_y(i,J-1) + khdt_y(i,J))) * G%IareaT(i,j)
if (max_CFL < CFL(i,j)) max_CFL = CFL(i,j)
enddo ; enddo
max_CFL = max(max_CFL, CFL(i,j))
enddo

@edoyango edoyango Aug 7, 2026

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.

Suggested change
do concurrent (j=js:je, i=is:ie) DO_LOCALITY(reduce(max:max_CFL))
CFL(i,j) = 2.0*((khdt_x(I-1,j) + khdt_x(I,j)) + &
(khdt_y(i,J-1) + khdt_y(i,J))) * G%IareaT(i,j)
if (max_CFL < CFL(i,j)) max_CFL = CFL(i,j)
enddo ; enddo
max_CFL = max(max_CFL, CFL(i,j))
enddo
do concurrent (j=js:je, i=is:ie) DO_LOCALITY(reduce(max:max_CFL))
max_CFL = max(max_CFL, 2.0*((khdt_x(I-1,j) + khdt_x(I,j)) + &
(khdt_y(i,J-1) + khdt_y(i,J))) * G%IareaT(i,j))
enddo

This is just a suggestion, so you don't have to take it since it's noncritical. CFL (the array) isn't used anywhere else, so it could be removed.

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