|
| splitModuleRoutineFile (self) |
|
| buildModi (self) |
|
| deleteNonColumnCallsPHYEX (self, simplify=False) |
|
| convertTypesInCompute (self) |
|
| deleteDrHook (self, simplify=False) |
|
| addDrHook (self) |
|
| deleteBudgetDDH (self, simplify=False) |
|
| deleteRoutineCallsMesoNHGPU (self, simplify=True) |
|
| addMPPDB_CHECKS (self, printsMode=False) |
|
| addStack (self, model, stopScopes, parserOptions=None, wrapH=False) |
|
| inlineContainedSubroutinesPHYEX (self, simplify=False) |
|
| removeIJDim (self, stopScopes, parserOptions=None, wrapH=False, simplify=False) |
|
| removePHYEXUnusedLocalVar (self, excludeList=None, simplify=False) |
|
| checkPHYEXUnusedLocalVar (self, mustRaise=False, excludeList=None) |
|
| expandAllArraysPHYEX (self, concurrent=False) |
|
| mathFunctoBRFunc (self) |
|
| shumanFUNCtoCALL (self) |
|
| buildACCTypeHelpers (self) |
|
Methods for high-to-moderate level transformation
Definition at line 60 of file applications.py.
◆ _mnh_expand_var()
pyfortool.applications.Applications._mnh_expand_var |
( |
|
self | ) |
|
|
protected |
:return: the list the variables needed by the mnh_expand directives
Definition at line 870 of file applications.py.
◆ addDrHook()
pyfortool.applications.Applications.addDrHook |
( |
|
self | ) |
|
◆ addMPPDB_CHECKS()
pyfortool.applications.Applications.addMPPDB_CHECKS |
( |
|
self, |
|
|
|
printsMode = False |
|
) |
| |
Add MPPDB_CHEKS on all intent REAL arrays on subroutines.
****** Not applied on modd_ routines. ********
Handle optional arguments.
Example, for a BL89 routine with 4 arguments, 1 INTENT(IN),
2 INTENT(INOUT), 1 INTENT(OUT), it produces :
IF (MPPDB_INITIALIZED) THEN
!Check all IN arrays
CALL MPPDB_CHECK(PZZ, "BL89 beg:PZZ")
!Check all INOUT arrays
CALL MPPDB_CHECK(PDZZ, "BL89 beg:PDZZ")
CALL MPPDB_CHECK(PTHVREF, "BL89 beg:PTHVREF")
END IF
...
IF (MPPDB_INITIALIZED) THEN
!Check all INOUT arrays
CALL MPPDB_CHECK(PDZZ, "BL89 end:PDZZ")
CALL MPPDB_CHECK(PTHVREF, "BL89 end:PTHVREF")
!Check all OUT arrays
CALL MPPDB_CHECK(PLM, "BL89 end:PLM")
END IF
param printsMode: if True, instead of CALL MPPDB_CHECK, add fortran prints for debugging
Definition at line 316 of file applications.py.
◆ addStack()
pyfortool.applications.Applications.addStack |
( |
|
self, |
|
|
|
model, |
|
|
|
stopScopes, |
|
|
|
parserOptions = None , |
|
|
|
wrapH = False |
|
) |
| |
Add specific allocations of local arrays on the fly for GPU
:param model : 'MESONH' or 'AROME' for specific objects related to the allocator or stack
:param stopScopes: scope paths where we stop to add stack
:param parserOptions, wrapH: see the PYFT class
Stacks are added to all routines called by the scopes listed in stopScopes
Definition at line 513 of file applications.py.
◆ buildACCTypeHelpers()
pyfortool.applications.Applications.buildACCTypeHelpers |
( |
|
self | ) |
|
build module files containing helpers to copy user type structures
Definition at line 1435 of file applications.py.
◆ buildModi()
pyfortool.applications.Applications.buildModi |
( |
|
self | ) |
|
Build the modi_ file corresponding to the given scope
Definition at line 80 of file applications.py.
◆ checkPHYEXUnusedLocalVar()
pyfortool.applications.Applications.checkPHYEXUnusedLocalVar |
( |
|
self, |
|
|
|
mustRaise = False , |
|
|
|
excludeList = None |
|
) |
| |
:param mustRaise: True to raise
:param excludeList: list of variable names to exclude from the check
Issue a logging.warning if there are unused local variables
If mustRaise is True, issue a logging.error instead and raise an error
Definition at line 902 of file applications.py.
◆ convertTypesInCompute()
pyfortool.applications.Applications.convertTypesInCompute |
( |
|
self | ) |
|
Convert STR%VAR into single local variable contained in compute (a-stmt)
and in if-then-stmt, else-if-stmt, where-stmt
e.g.
ZA = 1 + CST%XG ==> ZA = 1 + XCST_G
ZA = 1 + PARAM_ICE%XRTMIN(3) ==> ZA = 1 + XPARAM_ICE_XRTMIN3
ZRSMIN(1:KRR) = ICED%XRTMIN(1:KRR) => ZRSMIN(1:KRR) = ICEDXRTMIN1KRR(1:KRR)
IF(TURBN%CSUBG_MF_PDF=='NONE')THEN => IF(CTURBNSUBG_MF_PDF=='NONE')THEN
RESTRICTION : works only if the r-component variable is contained in 1 parent structure.
Allowed for conversion : CST%XG
Not converted : TOTO%CST%XG (for now, recursion must be coded)
Not converted : TOTO%ARRAY(:) (shape of the array must be determined from E1)
Definition at line 131 of file applications.py.
◆ deleteBudgetDDH()
pyfortool.applications.Applications.deleteBudgetDDH |
( |
|
self, |
|
|
|
simplify = False |
|
) |
| |
Remove Budget calls.
If Simplify is True, also remove all variables only needed for these calls
:param simplify : if True, remove variables that are now unused
Definition at line 288 of file applications.py.
◆ deleteDrHook()
pyfortool.applications.Applications.deleteDrHook |
( |
|
self, |
|
|
|
simplify = False |
|
) |
| |
Remove DR_HOOK calls.
If Simplify is True, also remove all variables only needed for these calls (ZHOOK_HANDLE,
DR_HOOK, LHOOK, YOMHOOK, JPRB, PARKIND1)
:param simplify : if True, remove variables that are now unused
Definition at line 253 of file applications.py.
◆ deleteNonColumnCallsPHYEX()
pyfortool.applications.Applications.deleteNonColumnCallsPHYEX |
( |
|
self, |
|
|
|
simplify = False |
|
) |
| |
Remove PHYEX routines that compute with different vertical columns not needed for AROME
MODE_ROTATE_WIND, UPDATE_ROTATE_WIND
If Simplify is True, also remove all variables only needed for these calls
:param simplify : if True, remove variables that are now unused
Definition at line 114 of file applications.py.
◆ deleteRoutineCallsMesoNHGPU()
pyfortool.applications.Applications.deleteRoutineCallsMesoNHGPU |
( |
|
self, |
|
|
|
simplify = True |
|
) |
| |
Remove Calls to routines not compatible with Méso-NH on GPU
e.g. CALL within a DO loop
e.g. OCND2 in condensation uses a CALL ICECLOUD and fonctions within computations
If Simplify is True, also remove all variables only needed for these calls
:param simplify : if True, remove variables that are now unused
Definition at line 305 of file applications.py.
◆ expandAllArraysPHYEX()
pyfortool.applications.Applications.expandAllArraysPHYEX |
( |
|
self, |
|
|
|
concurrent = False |
|
) |
| |
Transform array syntax into DO loops
:param concurrent: use 'DO CONCURRENT' instead of simple 'DO' loops
Definition at line 916 of file applications.py.
◆ inlineContainedSubroutinesPHYEX()
pyfortool.applications.Applications.inlineContainedSubroutinesPHYEX |
( |
|
self, |
|
|
|
simplify = False |
|
) |
| |
Inline all contained subroutines in the main subroutine
Steps :
- Identify contained subroutines
- Look for all CALL statements, check if it is a containted routines; if yes, inline
- Delete the containted routines
:param simplify: try to simplify code (construct or variables becoming useless)
:param loopVar: None to create new variable for each added DO loop
(around ELEMENTAL subroutine calls)
or a function that return the name of the variable to use for
the loop control. This function returns a string (name of the variable),
or True to create a new variable, or False to not transform this statement
The functions takes as arguments:
- lower and upper bounds as defined in the declaration statement
- lower and upper bounds as given in the statement
- name of the array
- index of the rank
Definition at line 595 of file applications.py.
◆ mathFunctoBRFunc()
pyfortool.applications.Applications.mathFunctoBRFunc |
( |
|
self | ) |
|
Convert intrinsic math functions **, LOG, ATAN, **2, **3, **4, EXP, COS, SIN, ATAN2
into a self defined function BR_ for MesoNH CPU/GPU bit-reproductibility
Definition at line 948 of file applications.py.
◆ removeIJDim()
pyfortool.applications.Applications.removeIJDim |
( |
|
self, |
|
|
|
stopScopes, |
|
|
|
parserOptions = None , |
|
|
|
wrapH = False , |
|
|
|
simplify = False |
|
) |
| |
Transform routines to be called in a loop on columns
:param stopScopes: scope paths where we stop to add the D argument (if needed)
:param parserOptions, wrapH: see the PYFT class
:param simplify: try to simplify code (remove useless dimensions in call)
ComputeInSingleColumn :
- Remove all Do loops on JI and JJ
- Initialize former indexes JI, JJ, JIJ to first array element:
JI=D%NIB, JJ=D%NJB, JIJ=D%NIJB
- If simplify is True, replace (:,*) on I/J/IJ dimension on argument
with explicit (:,*) on CALL statements:
e.g. CALL FOO(D, A(:,JK,1), B(:,:))
==> CALL FOO(D, A(JIJ,JK,1), B(:,:)) only if the target argument is not an array
Definition at line 618 of file applications.py.
◆ removePHYEXUnusedLocalVar()
pyfortool.applications.Applications.removePHYEXUnusedLocalVar |
( |
|
self, |
|
|
|
excludeList = None , |
|
|
|
simplify = False |
|
) |
| |
Remove unused local variables (dummy and module variables are not suppressed)
This function is identical to variables.removeUnusedLocalVar except that this one
is specific to the PHYEX code and take into account the mnh_expand directives.
:param excludeList: list of variable names to exclude from removal (even if unused)
:param simplify: try to simplify code (if we delete a declaration statement that used a
variable as kind selector, and if this variable is not used else where,
we also delete it)
Definition at line 885 of file applications.py.
◆ shumanFUNCtoCALL()
pyfortool.applications.Applications.shumanFUNCtoCALL |
( |
|
self | ) |
|
Convert all calling of functions and gradient present in shumansGradients
table into the use of subroutines
and use mnh_expand_directives to handle intermediate computations
Definition at line 1061 of file applications.py.
◆ splitModuleRoutineFile()
pyfortool.applications.Applications.splitModuleRoutineFile |
( |
|
self | ) |
|
Split all module and subroutine contain in a fortran file
Return a fortran file for each module and subroutine
Definition at line 66 of file applications.py.
The documentation for this class was generated from the following file: