Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable GPU execution of atm_compute_moist_coefficients via OpenACC #1238

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

abishekg7
Copy link
Collaborator

This PR enables the GPU execution of atm_compute_moist_coefficients subroutine.

Tested with a real and idealized test cases.

@mgduda mgduda requested review from mgduda and gdicker1 October 19, 2024 00:25
@mgduda mgduda added Atmosphere OpenACC Work related to OpenACC acceleration of code labels Oct 19, 2024
@abishekg7 abishekg7 changed the title Enable GPU exection of atm_compute_moist_coefficients via OpenACC Enable GPU execution of atm_compute_moist_coefficients via OpenACC Oct 23, 2024


!$acc parallel
!$acc loop
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the loop directives should be more explicit (e.g. loop gang worker here). Just to match with other work we're doing.

do iq = moist_start, moist_end
qtotal = qtotal + 0.5 * ( scalars(iq, k, cell1) + scalars(iq, k, cell2) )
end do
cqu(k,iEdge) = 1.0 / (1.0 + qtotal)
end do
end if
end do
!$acc end parallel
!$acc exit data copyout(cqw, cqu, qtot) delete(scalars)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This exit data directive should be surrounded by MPAS_ACC_TIMER_{START,STOP} calls.

Copy link
Collaborator

@gdicker1 gdicker1 left a comment

Choose a reason for hiding this comment

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

This may need some additional work. When I compared baseline and test runs of the regional testcase, I get differences in two fields in the history file. Restart files are reported as matching.

Output from compare_netcdf.py:

Comparing files: f1 - f2                                                                                                                             
        f1=../2024Dec31_MPASAPR1223_OpenACC/baseline_acc_1735844488/history.2019-09-01_00.06.00.nc                                                   
        f2=test_att1735694999/history.2019-09-01_00.06.00.nc                                                                                         

            Variable  Min       Max       
=========================================
initial_time is not a numeric field and will not be compared
xtime is not a numeric field and will not be compared
        depv_dt_fric -32.448421  33.315609
     depv_dt_fric_pv -32.448421  30.517973
mminlu is not a numeric field and will not be compared

Also a couple of suggested edits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Atmosphere OpenACC Work related to OpenACC acceleration of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants