Skip to content

Commit 8e85867

Browse files
reuterbalecossevin
authored andcommitted
Transformation skeleton for ParallelRoutineDispatchTransformation
1 parent 5673795 commit 8e85867

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
SUBROUTINE DISPATCH_ROUTINE(YDGEOMETRY, YDCPG_BNDS, YDCPG_OPTS, &
2+
& YDCPG_PHY0, YDCPG_DYN0, YDMF_PHYS_SURF, YDVARS, &
3+
& YDMODEL)
4+
5+
USE GEOMETRY_MOD , ONLY : GEOMETRY
6+
USE CPG_TYPE_MOD , ONLY : CPG_DYN_TYPE, &
7+
& CPG_PHY_TYPE
8+
USE CPG_OPTS_TYPE_MOD , ONLY : CPG_BNDS_TYPE, CPG_OPTS_TYPE
9+
USE MF_PHYS_SURFACE_TYPE_MOD &
10+
& , ONLY : MF_PHYS_SURF_TYPE
11+
USE FIELD_VARIABLES_MOD, ONLY : FIELD_VARIABLES
12+
USE TYPE_MODEL , ONLY : MODEL
13+
14+
USE PARKIND1 , ONLY : JPIM ,JPRB
15+
USE YOMHOOK , ONLY : LHOOK ,DR_HOOK, JPHOOK
16+
17+
IMPLICIT NONE
18+
19+
TYPE(GEOMETRY), INTENT(IN) :: YDGEOMETRY
20+
TYPE(CPG_BNDS_TYPE), INTENT(IN) :: YDCPG_BNDS
21+
TYPE(CPG_OPTS_TYPE), INTENT(IN) :: YDCPG_OPTS
22+
TYPE(CPG_PHY_TYPE), INTENT(IN) :: YDCPG_PHY0
23+
TYPE(CPG_DYN_TYPE), INTENT(IN) :: YDCPG_DYN0
24+
TYPE(MF_PHYS_SURF_TYPE), INTENT(INOUT) :: YDMF_PHYS_SURF
25+
TYPE(FIELD_VARIABLES), INTENT(INOUT) :: YDVARS
26+
TYPE(MODEL), INTENT(IN) :: YDMODEL
27+
28+
REAL(KIND=JPRB) :: ZRDG_CVGQ (YDCPG_OPTS%KLON, 1:YDCPG_OPTS%KFLEVG)
29+
REAL(KIND=JPRB) :: ZRDG_MU0LU (YDCPG_OPTS%KLON)
30+
REAL(KIND=JPRB) :: ZRDG_MU0M (YDCPG_OPTS%KLON)
31+
REAL(KIND=JPRB) :: ZRDG_MU0N (YDCPG_OPTS%KLON)
32+
REAL(KIND=JPRB) :: ZRDG_MU0 (YDCPG_OPTS%KLON)
33+
34+
INTEGER(KIND=JPIM) :: INSTEP_DEB, INSTEP_FIN
35+
INTEGER(KIND=JPIM) :: JLEV, JLON, JSPP
36+
37+
REAL(KIND=JPHOOK) :: ZHOOK_HANDLE
38+
39+
IF (LHOOK) CALL DR_HOOK('DISPATCH_ROUTINE',0,ZHOOK_HANDLE)
40+
41+
INSTEP_DEB=1
42+
INSTEP_FIN=1
43+
!$ACDC PARALLEL,TARGET=OpenMP/OpenMPSingleColumn/OpenACCSingleColumn,NAME=CPPHINP {
44+
45+
CALL CPPHINP(YDGEOMETRY, YDMODEL, YDCPG_BNDS%KIDIA, YDCPG_BNDS%KFDIA, YDVARS%GEOMETRY%GEMU%T0, &
46+
& YDVARS%GEOMETRY%GELAM%T0, YDVARS%U%T0, YDVARS%V%T0, YDVARS%Q%T0, YDVARS%Q%DL, YDVARS%Q%DM, YDVARS%CVGQ%DL, &
47+
& YDVARS%CVGQ%DM, YDCPG_PHY0%XYB%RDELP, YDCPG_DYN0%CTY%EVEL, YDVARS%CVGQ%T0, ZRDG_MU0, ZRDG_MU0LU, ZRDG_MU0M, &
48+
& ZRDG_MU0N, ZRDG_CVGQ, YDMF_PHYS_SURF%GSD_VF%PZ0F)
49+
50+
!$ACDC }
51+
52+
IF (LHOOK) CALL DR_HOOK('DISPATCH_ROUTINE',1,ZHOOK_HANDLE)
53+
54+
END SUBROUTINE DISPATCH_ROUTINE
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# (C) Copyright 2018- ECMWF.
2+
# This software is licensed under the terms of the Apache Licence Version 2.0
3+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
4+
# In applying this licence, ECMWF does not waive the privileges and immunities
5+
# granted to it by virtue of its status as an intergovernmental organisation
6+
# nor does it submit to any jurisdiction.
7+
8+
9+
from pathlib import Path
10+
11+
import pytest
12+
13+
from loki.frontend import available_frontends, OMNI
14+
from loki import Sourcefile
15+
16+
from transformations.parallel_routine_dispatch import ParallelRoutineDispatchTransformation
17+
18+
19+
@pytest.fixture(scope='module', name='here')
20+
def fixture_here():
21+
return Path(__file__).parent
22+
23+
24+
@pytest.mark.parametrize('frontend', available_frontends(skip=[OMNI]))
25+
def test_parallel_routine_dispatch_parallel_regions(here, frontend):
26+
27+
source = Sourcefile.from_file(here/'sources/projParallelRoutineDispatch/dispatch_routine.F90', frontend=frontend)
28+
transformation = ParallelRoutineDispatchTransformation()
29+
transformation.apply(source['dispatch_routine'])
30+
31+
assert transformation.dummy_return_value == ['dispatch_routine']
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# (C) Copyright 2018- ECMWF.
2+
# This software is licensed under the terms of the Apache Licence Version 2.0
3+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
4+
# In applying this licence, ECMWF does not waive the privileges and immunities
5+
# granted to it by virtue of its status as an intergovernmental organisation
6+
# nor does it submit to any jurisdiction.
7+
8+
from loki.transform import Transformation
9+
10+
__all__ = ['ParallelRoutineDispatchTransformation']
11+
12+
13+
class ParallelRoutineDispatchTransformation(Transformation):
14+
15+
def __init__(self):
16+
self.dummy_return_value = []
17+
18+
def transform_subroutine(self, routine, **kwargs):
19+
self.dummy_return_value += [routine.name.lower()]

0 commit comments

Comments
 (0)