Skip to content

Commit 40c1327

Browse files
prathi-windXuzheng Tiansbryngelsonmohdsaid497566Tanush Prathi
authored
Created FYPP macros to allow for meta-directive parallelization (#883)
Co-authored-by: Xuzheng Tian <xtian64@login-phoenix-rh9-3.pace.gatech.edu> Co-authored-by: Spencer Bryngelson <sbryngelson@gmail.com> Co-authored-by: Spencer Bryngelson <shb@gatech.edu> Co-authored-by: mohdsaid497566 <mohdsaid497566@gmail.com> Co-authored-by: Tanush Prathi <tprathi3@login-phoenix-rh9-1.pace.gatech.edu> Co-authored-by: Mohammed S. Al-Mahrouqi <145478595+mohdsaid497566@users.noreply.github.com> Co-authored-by: Ben Wilfong <48168887+wilfonba@users.noreply.github.com>
1 parent 45d5302 commit 40c1327

40 files changed

+2463
-1501
lines changed

docs/documentation/gpuParallelization.md

Lines changed: 566 additions & 0 deletions
Large diffs are not rendered by default.

src/common/include/macros.fpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#:include 'parallel_macros.fpp'
2+
13
#:def LOG(expr)
24
#ifdef MFC_DEBUG
35
block
@@ -12,14 +14,16 @@
1214

1315
#:def ALLOCATE(*args)
1416
@:LOG({'@:ALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'})
15-
allocate (${', '.join(args)}$)
16-
!$acc enter data create(${', '.join(args)}$)
17+
#:set allocated_variables = ', '.join(args)
18+
allocate (${allocated_variables}$)
19+
$:GPU_ENTER_DATA(create=('[' + allocated_variables + ']'))
1720
#:enddef ALLOCATE
1821

1922
#:def DEALLOCATE(*args)
2023
@:LOG({'@:DEALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'})
21-
!$acc exit data delete(${', '.join(args)}$)
22-
deallocate (${', '.join(args)}$)
24+
#:set allocated_variables = ', '.join(args)
25+
$:GPU_EXIT_DATA(delete=('[' + allocated_variables + ']'))
26+
deallocate (${allocated_variables}$)
2327
#:enddef DEALLOCATE
2428

2529
#:def ACC_SETUP_VFs(*args)
@@ -30,13 +34,13 @@
3034
@:LOG({'@:ACC_SETUP_VFs(${', '.join(args)}$)'})
3135

3236
#:for arg in args
33-
!$acc enter data copyin(${arg}$)
34-
!$acc enter data copyin(${arg}$%vf)
37+
$:GPU_ENTER_DATA(copyin=('[' + arg + ']'))
38+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%vf]'))
3539
if (allocated(${arg}$%vf)) then
3640
do macros_setup_vfs_i = lbound(${arg}$%vf, 1), ubound(${arg}$%vf, 1)
3741
if (associated(${arg}$%vf(macros_setup_vfs_i)%sf)) then
38-
!$acc enter data copyin(${arg}$%vf(macros_setup_vfs_i))
39-
!$acc enter data create(${arg}$%vf(macros_setup_vfs_i)%sf)
42+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%vf(macros_setup_vfs_i)]'))
43+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%vf(macros_setup_vfs_i)%sf]'))
4044
end if
4145
end do
4246
end if
@@ -52,9 +56,9 @@
5256
@:LOG({'@:ACC_SETUP_SFs(${', '.join(args)}$)'})
5357

5458
#:for arg in args
55-
!$acc enter data copyin(${arg}$)
59+
$:GPU_ENTER_DATA(copyin=('[' + arg + ']'))
5660
if (associated(${arg}$%sf)) then
57-
!$acc enter data create(${arg}$%sf)
61+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%sf]'))
5862
end if
5963
#:endfor
6064
end block
@@ -68,18 +72,18 @@
6872
@:LOG({'@:ACC_SETUP_source_spatials(${', '.join(args)}$)'})
6973

7074
#:for arg in args
71-
!$acc enter data copyin(${arg}$)
75+
$:GPU_ENTER_DATA(copyin=('[' + arg + ']'))
7276
if (allocated(${arg}$%coord)) then
73-
!$acc enter data create(${arg}$%coord)
77+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%coord]'))
7478
end if
7579
if (allocated(${arg}$%val)) then
76-
!$acc enter data create(${arg}$%val)
80+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%val]'))
7781
end if
7882
if (allocated(${arg}$%angle)) then
79-
!$acc enter data create(${arg}$%angle)
83+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%angle]'))
8084
end if
8185
if (allocated(${arg}$%xyz_to_r_ratios)) then
82-
!$acc enter data create(${arg}$%xyz_to_r_ratios)
86+
$:GPU_ENTER_DATA(copyin=('[' + arg + '%xyz_to_r_ratios]'))
8387
end if
8488
#:endfor
8589
end block
@@ -102,3 +106,4 @@
102106
//${message or '"No error description."'}$)
103107
end if
104108
#:enddef
109+
! New line at end of file is required for FYPP

0 commit comments

Comments
 (0)