port trczdf to GPU#3
Open
dindon-sournois wants to merge 2 commits into
Open
Conversation
dindon-sournois
commented
Apr 16, 2024
Comment on lines
+75
to
+95
| #ifdef _OPENACC | ||
| subroutine myalloc_ZDF_gpu() | ||
| allocate(zwd(jpk, dimen_jvzdf)) | ||
| zwd = huge(zwd(1,1)) | ||
| allocate(zws(jpk, dimen_jvzdf)) | ||
| zws = huge(zws(1,1)) | ||
| allocate(zwi(jpk, dimen_jvzdf)) | ||
| zwi = huge(zwi(1,1)) | ||
| allocate(zwx(jpk, dimen_jvzdf)) | ||
| zwx = huge(zwx(1,1)) | ||
| allocate(zwy(jpk, dimen_jvzdf)) | ||
| zwy = huge(zwy(1,1)) | ||
| allocate(zwz(jpk, dimen_jvzdf)) | ||
| zwz = huge(zwz(1,1)) | ||
| allocate(zwt(jpk, dimen_jvzdf)) | ||
| zwt = huge(zwt(1,1)) | ||
|
|
||
| !$acc enter data create(zwd,zwi,zwx,zws,zwz,zwy,zwt) | ||
| !$acc update device(zwd,zwi,zwx,zws,zwz,zwy,zwt) | ||
| END subroutine myalloc_ZDF_gpu | ||
| #endif |
Collaborator
Author
There was a problem hiding this comment.
We create a new subroutine here that is called once in trczdf after dimen_jvzdf value is known
We could probably do the same for the CPU version to avoid duplicates, also the memory counter might needs to be adapted
Comment on lines
177
to
179
|
|
||
| !$acc enter data create( e1t(1:jpj,1:jpi), e2t(1:jpj,1:jpi), e3t(1:jpk,1:jpj,1:jpi) ) if(use_gpu) | ||
| !$acc enter data create( e1u(1:jpj,1:jpi), e2u(1:jpj,1:jpi), e3u(1:jpk,1:jpj,1:jpi) ) if(use_gpu) | ||
| !$acc enter data create( e1v(1:jpj,1:jpi), e2v(1:jpj,1:jpi), e3v(1:jpk,1:jpj,1:jpi) ) if(use_gpu) | ||
| !$acc enter data create( e3w(1:jpk,1:jpj,1:jpi) ) if(use_gpu) | ||
| !$acc enter data create( un(1:jpk,1:jpj,1:jpi), vn(1:jpk,1:jpj,1:jpi), wn(1:jpk,1:jpj,1:jpi) ) if(use_gpu) |
Collaborator
Author
There was a problem hiding this comment.
it's not a good idea to declare these arrays here:
- they are allocated and deallocated later, which is a waste of time
- GPU allocation should be moved close to CPU
allocateas the port progress
Comment on lines
+136
to
+137
| ! NOTE: kernel is too big, should be split | ||
| !$acc parallel loop gang vector default(present) async vector_length(32) |
Collaborator
Author
There was a problem hiding this comment.
we might want to think about clever ways to generate this kernel as it seems quite big, best performance on A100 was obtained with a vector length of 32 which isn't very high
| Aij = e1t(jj,ji) * e2t(jj,ji) | ||
|
|
||
| #ifdef _OPENACC | ||
| ntx=jv |
Collaborator
Author
There was a problem hiding this comment.
for GPU version we parallelize on dimen_jvzdf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.