PyForTool
Python-fortran-tool
Loading...
Searching...
No Matches
scripting.py
1"""
2This module contains functions usefull to build scripts around the pyfortool library
3"""
4
5import sys
6from multiprocessing import cpu_count, get_context
7from multiprocessing.managers import BaseManager
8import re
9import shlex
10import os
11import argparse
12import logging
13import traceback
14
15from pyfortool.pyfortool import PYFT
16from pyfortool.tree import Tree
17from pyfortool.util import isint, PYFTError
18from pyfortool import __version__
19
20
21def task(filename):
22 """
23 Function to use on each file
24 :param clsPYFT: PYFT class to use
25 :param filename: file name
26 """
27 global PYFT # noqa: F824
28 global allFileArgs # noqa: F824
29 allArgs, orderedOptions = allFileArgs[filename]
30 try:
31 # Opening and reading of the FORTRAN file
32 with PYFT(filename, filename,
33 parserOptions=getParserOptions(allArgs), verbosity=allArgs.logLevel,
34 wrapH=allArgs.wrapH,
35 enableCache=allArgs.enableCache) as pft:
36
37 # apply the transformation in the order they were specified
38 for arg in orderedOptions:
39 logging.debug('Applying %s on %s', arg, filename)
40 applyTransfo(pft, arg, allArgs,
41 filename if filename == allArgs.plotCentralFile else None)
42 logging.debug(' -> Done')
43
44 # Writing
45 if not allArgs.dryRun:
46 pft.write()
47
48 # Reporting
49 return (0, filename)
50
51 except Exception as exc: # pylint: disable=broad-except
52 logging.error("The following error has occurred in the file %s", filename)
53 # Three-argument form: the single-argument form needs python >= 3.10
54 traceback.print_exception(type(exc), exc, exc.__traceback__, file=sys.stdout)
55 sys.stdout.flush()
56 return (1, filename)
57
58
59class TreeManager(BaseManager):
60 """
61 Manager sharing a single Tree instance between the pyfortool_parallel processes
62 """
63
64
65TreeManager.register('Tree', Tree)
66
67
68def poolInit(cls, afa):
69 """
70 Pool initializer
71 """
72 # After many, many attempts, it seems very difficult (if not impossible)
73 # to do without global variables
74 global PYFT # pylint: disable=global-statement
75 global allFileArgs # pylint: disable=global-statement
76 PYFT = cls
77 allFileArgs = afa
78
79
80def mainParallel(argv=None):
81 """
82 Core of the pyfortool_parallel.py command
83 :param argv: list of arguments (including the 'programm' name in first position)
84 as would be obtained by sys.argv. Or None to use sys.argv
85 """
86 parser = argparse.ArgumentParser(description='Python FORTRAN tool', allow_abbrev=False,
87 epilog="The argument order matters.")
88
89 updateParser(parser, withInput=False, withOutput=False, withXml=False, withPlotCentralFile=True,
90 treeIsOptional=False, nbPar=True, restrictScope=False)
91 commonArgs, getFileArgs = getArgs(parser, argv)
92
93 # The 'fork' start method is requested explicitly. The parallel configuration installed
94 # by PYFT.setParallel below is held in class attributes, and child processes can only
95 # receive it by inheriting the parent memory. Python 3.14 made 'forkserver' the default
96 # on Linux, under which the workers would start from a freshly imported (and therefore
97 # unconfigured) PYFT class.
98 ctx = get_context('fork')
99
100 # Manager to share the Tree instance
101 with TreeManager(ctx=ctx) as manager:
102 # Set-up the Tree instance
103 sharedTree = getDescTree(commonArgs, manager.Tree)
104
105 # Prepare PYFT to be used in parallel (locks taken from the same 'fork' context)
106 PYFT.setParallel(sharedTree, clsLock=ctx.Lock, clsRLock=ctx.RLock)
107 try:
108 # Set-up the processes
109 allFileArgs = {file: getFileArgs(file) for file in sharedTree.getFiles()}
110 logging.info('Executing in parallel on %i files with a maximum of %i processes',
111 len(allFileArgs), commonArgs.nbPar)
112 with ctx.Pool(commonArgs.nbPar, initializer=poolInit,
113 initargs=(PYFT, allFileArgs)) as pool:
114 result = pool.map(task, sharedTree.getFiles())
115
116 # Writting the descTree object
117 sharedTree.toJson(commonArgs.descTree)
118
119 # General error
120 errors = [item[1] for item in result if item[0] != 0]
121 status = len(errors)
122 if status != 0:
123 logging.error('List of files with error:')
124 for error in errors:
125 logging.error(' - %s', error)
126 raise PYFTError(f"Errors have been reported in {status} file(s).")
127 finally:
128 # Unset parallel processing, even on error: the shared tree lives in the
129 # manager process, which is stopped when leaving the 'with' block
130 PYFT.unsetParallel()
131
132
133def main(argv=None):
134 """
135 Core of the pyfortool.py command
136 :param argv: list of arguments (including the 'programm' name in first position)
137 as would be obtained by sys.argv. Or None to use sys.argv
138 """
139 parser = argparse.ArgumentParser(description='Python FORTRAN tool', allow_abbrev=False,
140 epilog="The argument order matters.")
141
142 updateParser(parser, withInput=True, withOutput=True, withXml=True, withPlotCentralFile=False,
143 treeIsOptional=True, nbPar=False, restrictScope=True)
144 args, orderedOptions = getArgs(parser, argv)[1]()
145
146 parserOptions = getParserOptions(args)
147 descTree = getDescTree(args)
148
149 try:
150 # Opening and reading of the FORTRAN file
151 pft = PYFT(args.INPUT, args.OUTPUT, parserOptions=parserOptions,
152 verbosity=args.logLevel, wrapH=args.wrapH, tree=descTree,
153 enableCache=args.enableCache)
154 if args.restrictScope != '':
155 pft = pft.getScopeNode(args.restrictScope)
156
157 # apply the transformation in the order they were specified
158 for arg in orderedOptions:
159 logging.debug('Applying %s on %s', arg, args.INPUT)
160 applyTransfo(pft, arg, args, plotCentralFile=args.INPUT)
161 logging.debug(' -> Done')
162
163 # Writing
164 if descTree is not None:
165 descTree.toJson(args.descTree)
166 if args.xml is not None:
167 pft.mainScope.writeXML(args.xml)
168 if not args.dryRun:
169 pft.mainScope.write()
170
171 # Closing
172 pft.mainScope.close()
173
174 except: # noqa E722
175 # 'exept' everything and re-raise error systematically
176 logging.error("The following error has occurred in the file %s", args.INPUT)
177 raise
178
179
180ARG_UPDATE_CNT = ('--alignContinuation', '--addBeginContinuation',
181 '--removeBeginContinuation',
182 '--emoveALLContinuation')
183
184
185def getArgs(parser, argv):
186 """
187 Parse arguments and interpret the --optsByEnv option
188 :param parser: argparse parser
189 :param argv: list of arguments (including the 'programm' name in first position)
190 as would be obtained by sys.argv. Or None to use sys.argv.
191 :return: a tuple with
192 - an argparse namespace containing common arguments (not using the --optsEnv option)
193 - a function taking a filename as input and returning
194 - an argparse namespace with the common arguments and the ones added by
195 interpreting the --optsEnv option
196 - an ordered list of arguments
197 """
198 if argv is None:
199 argv = sys.argv
200 args = parser.parse_args(argv[1:])
201
202 def getFileArgs(filename=args.INPUT if hasattr(args, 'INPUT') else None):
203 """
204 :param filename: name of source code file
205 :return: argparse namespace to use with this file and
206 a list given the order in which the arguments were provided
207 """
208 # Decode the --optsByEnv option
209 arguments = argv[1:]
210 if args.optsByEnv is not None:
211 extra = ''
212 for line in [] if args.optsByEnv is None else os.environ[args.optsByEnv].split('\n'):
213 if ':=:' in line:
214 if re.match(line.split(':=:')[0], filename):
215 extra = line.split(':=:')[1]
216 else:
217 extra = line
218 index = arguments.index('--optsByEnv')
219 arguments = arguments[:index] + shlex.split(extra) + arguments[index + 2:] # keep order
220
221 # Compute the ordered list
222 updateCnt = False
223 optList = []
224 for arg in arguments:
225 if arg.startswith('--') and arg not in optList:
226 if arg in ARG_UPDATE_CNT:
227 if not updateCnt:
228 updateCnt = True
229 optList.append(arg)
230 else:
231 optList.append(arg)
232
233 return parser.parse_args(arguments), optList
234
235 return args, getFileArgs
236
237
239 """
240 Get the options to use for the fxtran parser
241 :param args: arguments parsed by the argparse parser
242 """
243 if args.parserOption is None:
244 parserOptions = PYFT.DEFAULT_FXTRAN_OPTIONS.copy()
245 else:
246 parserOptions = [el for elements in args.parserOption for el in elements]
247 if args.addIncludes:
248 parserOptions = [opt for opt in parserOptions if opt not in ('-no-include', '-noinclude')]
249 return parserOptions
250
251
252def getDescTree(args, cls=Tree):
253 """
254 get the Tree object built with the parsed arguments
255 :param args: arguments parsed by the argparse parser
256 :param cls: class to use (usefull for manager)
257 :return: a Tree instance
258 """
259 parserOptions = getParserOptions(args)
260 if args.descTree:
261 descTree = cls(tree=args.tree, descTreeFile=args.descTree,
262 parserOptions=parserOptions,
263 wrapH=args.wrapH, verbosity=args.logLevel)
264 else:
265 descTree = None
266 return descTree
267
268
269def updateParser(parser, withInput, withOutput, withXml, withPlotCentralFile, treeIsOptional,
270 nbPar, restrictScope):
271 """
272 Updates an argparse parser with arguments common to all the different tools
273 :param parser: parser in which arguments are added
274 :param withOutput: do we need the INPUT argument
275 :param withOutput: do we need the OUTPUT argument
276 :param withXml: do we need to be able to define an XML output file
277 :param withPlotCentralFile: to add the --plotCentralFile argument
278 :param treeIsOptional: is the --tree argument optional?
279 :param nbPar: number of parallel processes
280 :param restrictScope: can we specify the scope path
281 """
282
283 # ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
284 # IMPORTANT NOTE
285 # Argument order matters but argparse is not able to give the order
286 # Therefore, arguments are processed twice. The first time by argparse to fully decode them.
287 # Then a second pass is made direcly on sys.argv. This mechanism has two implications:
288 # allow_abbrev must be set to False in ArgumentParser
289 # only long argument options are allowed (begining with two dashes)
290 # ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
291 assert not parser.allow_abbrev, 'parser must be created with allow_abbrev=False'
292
293 parser.add_argument('--version', action='version',
294 version='%(prog)s {version}'.format(version=__version__))
295 parser.add_argument('--simplify', default=False, action='store_true',
296 help='After a deletion, recursively deletes the code ' +
297 'and variables that have become useless')
298 parser.add_argument('--logLevel', default='warning',
299 help='Provide logging level. Example --logLevel debug (default is warning)')
300 parser.add_argument('--enableCache', default=False, action='store_true',
301 help='Precompute parent of each xml node and store the result')
302 if nbPar:
303 parser.add_argument('--nbPar', default=cpu_count(), type=int,
304 help='Number of parallel processes, 0 to get as many processes ' +
305 'as the number of cores (default=0)')
306 parser.add_argument('--optsByEnv', default=None, type=str,
307 help='Name of the environment variable containing additional arguments ' +
308 'to use. These arguments are processed after all other arguments. ' +
309 'The variable can contain a multi-lines string. The ' +
310 'variable is read line by line and the last applicable line is ' +
311 'used. A line can take one of these two forms: ' +
312 '1) "FILE_DESCRIPTOR:=:OPTIONS" (where FILE_DESCRIPTOR is a ' +
313 'regular expression to test against the filename. If there ' +
314 'is a match, the OPTIONS can be used for the file) and ' +
315 '2) "OPTIONS" (if the line doesn\'t contain the FILE_DESCRIPTOR ' +
316 'part, it applies to all source code).')
317
318 if restrictScope:
319 parser.add_argument('--restrictScope', default='', type=str, metavar='SCOPEPATH',
320 help="Limit the action to this scope path (SUBROUTINE/FUNCTION/" +
321 "MODULE/TYPE). It is '/'-separated path with each element " +
322 "having the form 'module:<name of the module>', " +
323 "'sub:<name of the subroutine>', " +
324 "'func:<name of the function>' or 'type:<name of the type>'.")
325
326 # Inputs and outputs
327 updateParserInputsOutputs(parser, withInput, withOutput, withXml)
328
329 # fxtran
330 updateParserFxtran(parser)
331
332 # Variables
334
335 # Cosmetics
337
338 # Applications
340
341 # openACC
342 updateParserOpenACC(parser)
343
344 # Checks
345 updateParserChecks(parser)
346
347 # Statements
349
350 # Misc
351 updateParserMisc(parser)
352
353 # Tree
354 updateParserTree(parser, withPlotCentralFile, treeIsOptional)
355
356 # Preprocessot
358
359
360def updateParserInputsOutputs(parser, withInput, withOutput, withXml):
361 """
362 Updates an argparse parser with input/output arguments
363 :param parser: parser in which arguments are added
364 :param withOutput: do we need the INPUT argument
365 :param withOutput: do we need the OUTPUT argument
366 :param withXml: do we need to be able to define an XML output file
367 """
368 gInOut = parser.add_argument_group('Input and output')
369 if withInput:
370 gInOut.add_argument('INPUT', help='FORTRAN input file')
371 if withOutput:
372 gInOut.add_argument('OUTPUT', default=None, help='FORTRAN output file', nargs='?')
373 gInOut.add_argument('--renamefF', default=False, action='store_true',
374 help='Put file extension in upper case')
375 gInOut.add_argument('--renameFf', default=False, action='store_true',
376 help='Put file extension in lower case')
377 if withXml:
378 gInOut.add_argument('--xml', default=None, type=str,
379 help='Output file for xml')
380 gInOut.add_argument('--dryRun', default=False, action='store_true',
381 help='Dry run without writing the FORTRAN file (the xml ' +
382 'is still written')
383
384
386 """
387 Updates an argparse parser with fxtran arguments
388 """
389 gParser = parser.add_argument_group('fxtran parser relative options')
390 gParser.add_argument('--parserOption', nargs='*', action='append',
391 help='Option to pass to fxtran, defaults ' +
392 f'to {PYFT.DEFAULT_FXTRAN_OPTIONS}')
393 gParser.add_argument('--wrapH', default=False, action='store_true',
394 help='Wrap .h file content into a MODULE to enable the reading')
395
396
398 """
399 Updates an argparse parser with variables arguments
400 """
401 gVariables = parser.add_argument_group('Options to deal with variables')
402 gVariables.add_argument('--showVariables', default=False, action='store_true',
403 help='Show the declared variables')
404 gVariables.add_argument('--removeVariable', nargs=2, action='append',
405 metavar=('SCOPEPATH', 'VARNAME'),
406 help="Variable to remove from declaration. The first argument " +
407 "is the SUBROUTINE/FUNCTION/MODULE/TYPE where the variable " +
408 "is declared. It is '/'-separated path with each element having " +
409 "the form 'module:<name of the module>', " +
410 "'sub:<name of the subroutine>', " +
411 "'func:<name of the function>' or 'type:<name of the type>'. " +
412 "The second argument is the variable name")
413 gVariables.add_argument('--attachArraySpecToEntity', default=False, action='store_true',
414 help='Find all T-decl-stmt elements that have a child element ' +
415 'attribute with attribute-N=DIMENSION and move the attribute ' +
416 'into EN-N elements')
417 gVariables.add_argument('--addVariable', nargs=4, action='append',
418 metavar=('SCOPEPATH', 'VARNAME', 'DECLARATION', 'POSITION'),
419 help='Add a variable. First argument is the scope path (as for ' +
420 'the --removeVariable option. The second is the variable ' +
421 'name, the third is the declarative statement to insert, ' +
422 'the fourth is the position (python indexing) the new ' +
423 'variable will have in the calling statment of the ' +
424 'routine (non-integer value for a local variable).')
425 gVariables.add_argument('--addModuleVariable', nargs=3, action='append',
426 metavar=('SCOPEPATH', 'MODULENAME', 'VARNAME'),
427 help='Add a USE statement. The first argument is the scope path ' +
428 '(as for the --removeVariable option). The second is the module ' +
429 'name; the third is the variable name.')
430 gVariables.add_argument('--showUnusedVariables', default=False, action='store_true',
431 help='Show a list of unused variables.')
432 gVariables.add_argument('--removeUnusedLocalVariables',
433 help='Remove unused local variables, excluding some variables (comma-' +
434 'separated list or NONE to exclude nothing).')
435 gVariables.add_argument('--removePHYEXUnusedLocalVariables',
436 help='Remove unused local variables, excluding some variables (comma-' +
437 'separated list or NONE to exclude nothing). This option takes ' +
438 'into account the mnh_expand directives to prevent from ' +
439 'removing useful variables.')
440 gVariables.add_argument('--addExplicitArrayBounds', action='store_true',
441 help='Adds explicit bounds to arrays that already have parentheses.')
442 gVariables.add_argument('--addArrayParentheses', action='store_true',
443 help='Adds parentheses to arrays (A => A(:))')
444 gVariables.add_argument('--modifyAutomaticArrays', metavar="DECL#START#END",
445 help='Transform all automatic arrays declaration using the templates.' +
446 ' The DECL part of the template will replace the declaration ' +
447 'statement, the START part will be inserted as the first ' +
448 'executable statement while the END part will be inserted as ' +
449 'the last executable statement. Each part ' +
450 'of the template can use the following place holders: ' +
451 '"{doubledotshape}", "{shape}", "{lowUpList}", "{name}" and ' +
452 '"{type}" which are, respectively modified into ' +
453 '":, :, :", "I, I:J, 0:I", "1, I, I, J, 0, I", "A", "REAL" ' +
454 'if the original declaration statement ' +
455 'was "A(I, I:J, 0:I)". For example, the template ' +
456 '"{type}, DIMENSION({doubledotshape}), ALLOCATABLE :: ' +
457 '{name}#ALLOCATE({name}({shape}))#DEALLOCATE({name})"' +
458 'will replace automatic arrays by allocatables.')
459 gVariables.add_argument('--replaceAutomaticWithAllocatable', action='store_true',
460 help='Replace all automatic arrays with allocatable arrays.')
461 gVariables.add_argument('--addArgInTree', default=None, action='append', nargs=3,
462 metavar=('VARNAME', 'DECLARATION', 'POSITION'),
463 help='Add an argument variable. The first argument is the variable ' +
464 'name, the second one is the declarative statement to insert, ' +
465 'the third one is the position (python indexing) the new ' +
466 'variable will have in the calling statement of the ' +
467 'routine. Needs the --stopScopes argument')
468 gVariables.add_argument('--addONLY', default=False, action='store_true',
469 help='Add missing ONLY clause to USE statements.')
470
471
473 """
474 Updates an argparse parser with cosmetics arguments
475 """
476 gCosmetics = parser.add_argument_group('Cosmetics options')
477 gCosmetics.add_argument('--splitLongLines', default=False, action='store_true',
478 help='Split lines longer than the limit given by --maxLineLength')
479 gCosmetics.add_argument('--upperCase', default=False, action='store_true',
480 help='Put FORTRAN code in upper case letters')
481 gCosmetics.add_argument('--lowerCase', default=False, action='store_true',
482 help='Put FORTRAN code in lower case letters')
483 gCosmetics.add_argument('--changeIfStatementsInIfConstructs', default=False,
484 action='store_true',
485 help='Find all if-statement and convert it to if-then-statement')
486 gCosmetics.add_argument('--indent', default=False, action='store_true',
487 help='Correct indentation')
488 gCosmetics.add_argument('--removeIndent', default=False, action='store_true',
489 help='Remove indentation')
490 gCosmetics.add_argument('--removeEmptyLines', default=False, action='store_true',
491 help='Remove empty lines')
492 gCosmetics.add_argument('--removeComments', default=False, action='store_true',
493 help='Remove comments')
494 gCosmetics.add_argument('--updateSpaces', default=False, action='store_true',
495 help='Updates spaces around operators, commas, parenthesis and ' +
496 'at the end of line')
497 gCosmetics.add_argument('--alignContinuation', default=False, action='store_true',
498 help='Align the beginings of continued lines')
499 gCosmetics.add_argument('--addBeginContinuation', default=False, action='store_true',
500 help='Add missing continuation characters (\'&\') at the ' +
501 'begining of lines')
502 gCosmetics.add_argument('--removeBeginContinuation', default=False, action='store_true',
503 help='Remove continuation characters (\'&\') at the begining of lines')
504 gCosmetics.add_argument('--removeALLContinuation', default=False, action='store_true',
505 help='Remove all continuation characters(\'&\')')
506 gCosmetics.add_argument('--prettify', default=False, action='store_true',
507 help='Prettify the source code (indentation, spaces...)')
508 gCosmetics.add_argument('--minify', default=False, action='store_true',
509 help='Simplify the source code (indentation, spaces...)')
510 gCosmetics.add_argument('--removeEmptyCONTAINS', default=False, action='store_true',
511 help='Remove useless CONTAINS statements')
512 gCosmetics.add_argument('--formatModuleUse', default=False, action='store_true',
513 help='Order USE declarations by module type (MODD_, MODE_, ' +
514 'MODI_, MODN_) and alphabetically within each group')
515
516
518 """
519 Updates an argparse parser with applications arguments
520 """
521 gApplications = parser.add_argument_group('Options to apply upper level transformation')
522 gApplications.add_argument('--deleteDrHook', default=False, action='store_true',
523 help='Delete DR HOOK use')
524 gApplications.add_argument('--addDrHook', default=False, action='store_true',
525 help='Add DR HOOK')
526 gApplications.add_argument('--deleteBudgetDDH', default=False, action='store_true',
527 help='Delete Budget/DDH use')
528 gApplications.add_argument('--deleteRoutineCallsMesoNHGPU', default=False, action='store_true',
529 help='Delete parts of the code not compatible with MesoNH-OpenACC' +
530 'such as OCND2 blocks')
531 gApplications.add_argument('--splitModuleRoutineFile', default=False, action='store_true',
532 help='Split a file')
533 gApplications.add_argument('--deleteNonColumnCallsPHYEX', default=False, action='store_true',
534 help='Delete call to PHYEX routines that needs information on ' +
535 'horizontal points (multiple column dependency')
536 gApplications.add_argument('--removeIJDim', default=False, action='store_true',
537 help='Remove I and J dimensions (1, KLON). ' +
538 'Needs the --stopScopes argument.')
539 gApplications.add_argument('--expandAllArraysPHYEX', default=False, action='store_true',
540 help='Expand all array syntax (computing and where block) ' +
541 'using PHYEX conventions')
542 gApplications.add_argument('--expandAllArraysPHYEXConcurrent', default=False,
543 action='store_true',
544 help='Expand all array syntax with DO CONCURRENT loops ' +
545 '(computing and where block) using PHYEX conventions')
546 gApplications.add_argument('--expandAllArrays', default=False, action='store_true',
547 help='Expand all array syntax (computing and where block) ' +
548 'using mnh directives if present')
549 gApplications.add_argument('--expandAllArraysConcurrent', default=False, action='store_true',
550 help='Expand all array syntax with DO CONCURRENT loops ' +
551 '(computing and where block) using mnh directives if present')
552 gApplications.add_argument('--inlineContainedSubroutinesPHYEX', default=False,
553 action='store_true',
554 help='Inline containted subroutines in main routine, using ' +
555 'PHYEX conventions')
556 gApplications.add_argument('--addStack', metavar='MODEL', type=str,
557 help='Add local arrays to the stack. The argument is the ' +
558 'the model name in which stack must be added ("AROME" ' +
559 'or "MESONH"). Needs the --stopScopes argument for AROME.')
560 gApplications.add_argument('--addIncludes', default=False, action='store_true',
561 help='Add .h includes in the file and remove the INCLUDE statement')
562 gApplications.add_argument('--addSubmodulePHYEX', default=False, action='store_true',
563 help='Add SUBMODULE and INTERFACE of subroutines in PHYEX')
564 gApplications.add_argument('--mnhExpand', default=False, action='store_true',
565 help='Apply the mnh_expand directives with DO loops')
566 gApplications.add_argument('--mnhExpandConcurrent', default=False, action='store_true',
567 help='Apply the mnh_expand directives with DO CONCURRENT loops')
568 gApplications.add_argument('--addMPPDB_CHECKS', default=False, action='store_true',
569 help='Add MPPDB_CHEKS bit-repro checking routines of MesoNH for ' +
570 'all in and inout arrays in subroutines')
571 gApplications.add_argument('--addPrints', default=False, action='store_true',
572 help='Add Prints of min/maxval and shape of all in, out, inout ' +
573 'arguments of all scopes')
574 gApplications.add_argument('--shumanFUNCtoCALL', default=False, action='store_true',
575 help='Transform shuman functions to call statements ' +
576 '(legacy version)')
577 gApplications.add_argument('--shugradTransfo', default=False, action='store_true',
578 help='Transform shuman functions to call statements')
579 gApplications.add_argument('--mathFunctoBRFunc', default=False, action='store_true',
580 help='Convert intrinsic math functions **, LOG, ATAN, **2, **3, ' +
581 '**4, EXP, COS, SIN, ATAN2 into a self defined function BR_ ' +
582 'for MesoNH bit-repro.')
583 gApplications.add_argument('--convertTypesInCompute', default=False, action='store_true',
584 help='Use single variable instead of variable contained in ' +
585 'structure in compute statement for optimization issue ')
586 gApplications.add_argument('--buildModi', default=False, action='store_true',
587 help='Builds the corresponding modi_ file')
588 gApplications.add_argument('--removeExtraDOinMnhDoConcurrent', default=False,
589 action='store_true',
590 help='Remove DO and ENDDO instructions inside !$mnh_do_concurrent')
591 gApplications.add_argument('--convertuseModuleToIncludes', default=False,
592 action='store_true',
593 help='Convert USE MODULE, ONLY: ROUTINE to #include routine.intfb.h')
594
595
597 """
598 Updates an argparse parser with openACC arguments
599 """
600 gOpenACC = parser.add_argument_group('OpenACC')
601 gOpenACC.add_argument('--addACCData', default=False, action='store_true',
602 help='Add !$acc data present and !$acc end data directives')
603 gOpenACC.add_argument('--addACCRoutineSeq', default=False, action='store_true',
604 help='Add "!$acc routine seq" to routines under stopScopes')
605 gOpenACC.add_argument('--craybyPassDOCONCURRENT', default=False, action='store_true',
606 help='remove acc loop independant collapse for BR_ fonctions and ' +
607 'mnh_undef(OPENACC) macro' +
608 ' use DO CONCURRENT with mnh_undef(LOOP)')
609 gOpenACC.add_argument('--removeACC', default=False, action='store_true',
610 help='remove all ACC directives')
611 gOpenACC.add_argument('--removebyPassDOCONCURRENT', default=False, action='store_true',
612 help='remove macro !$mnh_(un)def(OPENACC) and !$mnh_(un)def(LOOP) ' +
613 'directives')
614 gOpenACC.add_argument('--buildACCTypeHelpers', default=False, action='store_true',
615 help='build module files containing helpers to copy user ' +
616 'type structures')
617 gOpenACC.add_argument('--allocatetoHIP', default=False, action='store_true',
618 help='convert (DE)ALLOCATE to (DE)ALLOCATE_HIP on variables only sent ' +
619 'to the GPU via acc enter data copyin/create (for GPU AMD MI250X)')
620
621
623 """
624 Updates an argparse parser with checks arguments
625 """
626
627 gChecks = parser.add_argument_group('Check options')
628 gChecks.add_argument('--checkIMPLICIT', choices={'Warn', 'Err'}, default=None,
629 help='Send a warning or raise an error if the "IMPLICIT NONE" ' +
630 'is missing')
631 gChecks.add_argument('--checkINTENT', choices={'Warn', 'Err'}, default=None,
632 help='Send a warning or raise an error if the "INTENT" ' +
633 'attribute is missing for a dummy argument')
634 gChecks.add_argument('--checkOpInCall', choices={'Warn', 'Err'}, default=None,
635 help='Send a warning or raise an error if a call argument is an '
636 'operation.')
637 gChecks.add_argument('--checkUnusedLocalVar', choices={'Warn', 'Err'}, default=None,
638 help='Send a warning or raise an error if some local '
639 'variables are unused.')
640 gChecks.add_argument('--checkPHYEXUnusedLocalVar', choices={'Warn', 'Err'}, default=None,
641 help='Send a warning or raise an error if some local '
642 'variables are unused (excluding variables needed '
643 'for mnh_expand directives).')
644 gChecks.add_argument('--checkEmptyParensInCall', choices={'Warn', 'Err'}, default=None,
645 help='Send a warning or raise an error if a call argument is an '
646 'array with empty parens.')
647 gChecks.add_argument('--checkContinuationInArraySection', choices={'Warn', 'Err'},
648 default=None,
649 help='Send a warning or raise an error if an array index '
650 'selection (containing a \':\' or applied to a variable '
651 'declared as an array) is split over several lines.')
652 gChecks.add_argument('--checkLineLength', choices={'Warn', 'Err'}, default=None,
653 help='Send a warning or raise an error if a line is longer than '
654 'the limit given by --maxLineLength.')
655 gChecks.add_argument('--maxLineLength', type=int, default=132,
656 help='Maximum line length used by --checkLineLength and '
657 '--splitLongLines (default: 132).')
658 gChecks.add_argument('--checkONLY', choices={'Warn', 'Err'}, default=None,
659 help='Send a warning or raise an error if a USE statement is not '
660 'followed by an ONLY clause.')
661 gChecks.add_argument('--checkKeyDim', choices={'Warn', 'Err'}, default=None,
662 help='Send a warning or raise an error if MERGE-based array '
663 'dimensions are inconsistent across scopes.')
664 gChecks.add_argument('--checkTopLevelUSE', choices={'Warn', 'Err'}, default=None,
665 help='Send a warning or raise an error if a USE statement in '
666 'top-level module is present')
667
668
670 """
671 Updates an argparse parser with statements arguments
672 """
673
674 gStatement = parser.add_argument_group('Statements options')
675 gStatement.add_argument('--removeCall', action='append',
676 help="Call to remove from the source code. The argument " +
677 "is the subprogram name")
678 gStatement.add_argument('--removePrints', default=False, action='store_true',
679 help="Remove print statements from the source code.")
680 gStatement.add_argument('--inlineContainedSubroutines', default=False, action='store_true',
681 help='Inline containted subroutines in main routine')
682 gStatement.add_argument('--setFalseIfStmt', default=None,
683 help='Replace this value by .FALSE. in if statements')
684 gStatement.add_argument('--checkEmptyParensInMnhExpand', choices={'Warn', 'Err'}, default=None,
685 help='Send a warning or raise an error if an empty parens ' +
686 'is found in an mnh_expand directive.')
687
688
690 """
691 Updates an argparse parser with misc arguments
692 """
693 gMisc = parser.add_argument_group('Miscellaneous')
694 gMisc.add_argument('--showScopes', default=False, action='store_true',
695 help='Show the different scopes found in the source code')
696 gMisc.add_argument('--empty', default=False, action='store_true',
697 help='Empty the different scopes')
698
699
700def updateParserTree(parser, withPlotCentralFile, treeIsOptional):
701 """
702 Updates an argparse parser with statements arguments
703 :param withPlotCentralFile: to add the --plotCentralFile argumen
704 :param treeIsOptional: is the --tree argument optional?
705 """
706 gTree = parser.add_argument_group('Tree')
707 gTree.add_argument('--tree', default=None, action='append', required=not treeIsOptional,
708 help='Directories where source code must be searched for')
709 gTree.add_argument('--descTree', default=None, required=not treeIsOptional,
710 help='File to write and/or read the description of the tree.')
711 if withPlotCentralFile:
712 gTree.add_argument('--plotCentralFile', default=None, type=str,
713 help='Central file of the plot')
714 gTree.add_argument('--plotCompilTree', default=None,
715 help='File name for compilation dependency graph (.dot or image extension)')
716 gTree.add_argument('--plotExecTree', default=None,
717 help='File name for execution dependency graph (.dot or image extension)')
718 gTree.add_argument('--plotMaxUpper', default=None, type=int,
719 help='Maximum number of upper elements in the plot tree')
720 gTree.add_argument('--plotMaxLower', default=None, type=int,
721 help='Maximum number of lower elements in the plot tree')
722 gTree.add_argument('--stopScopes', default=None, type=str,
723 help='#-separated list of scopes ' +
724 'where the recursive inclusion of an argument variable ' +
725 'must stop (needed for some transformations).')
726
727
729 """
730 Updates an argparse parser with statements arguments
731 """
732 gCpp = parser.add_argument_group('Preprocessor')
733 gCpp.add_argument('--applyCPPifdef', nargs='*', action='append',
734 help="This option is followed by the list of defined or undefined " +
735 "CPP keys. " +
736 "All #ifdef and #ifndef concerning these keys are evaluated. " +
737 "Undefined keys are preceded by a percentage sign.")
738
739
740def applyTransfo(pft, arg, args, plotCentralFile):
741 """
742 Apply transformation on a PYFT instance
743 :param pft: PYFT instance
744 :param arg: argument to deal with
745 :param args: parsed argparsed arguments
746 :param plotCentralFile: central file for plots
747 """
748 simplify = {'simplify': args.simplify}
749 parserOptions = getParserOptions(args)
750 stopScopes = args.stopScopes.split('#') if args.stopScopes is not None else None
751
752 # File name manipulations
753 applyTransfoFileName(pft, arg)
754
755 # Variables
756 applyTransfoVariables(pft, arg, args, simplify, parserOptions, stopScopes)
757
758 # Applications
759 applyTransfoApplications(pft, arg, args, simplify, parserOptions, stopScopes)
760
761 # OpenACC
762 applyTransfoOpenACC(pft, arg, args, stopScopes)
763
764 # Cosmetics
765 applyTransfoCosmetics(pft, arg, args)
766
767 # Checks
768 applyTransfoChecks(pft, arg, args, stopScopes)
769
770 # Statements
771 applyTransfoStatements(pft, arg, args, simplify)
772
773 # Misc
774 applyTransfoMisc(pft, arg, args, simplify)
775
776 # Tree
777 applyTransfoTree(pft, arg, args, plotCentralFile)
778
779 # Preprocessor
780 applyTransfoPreprocessor(pft, arg, args)
781
782
784 """
785 Apply file name transformations on a PYFT instance
786 :param pft: PYFT instance
787 :param arg: argument to deal with
788 :param args: parsed argparsed arguments
789 """
790
791 # File name manipulations
792 if arg == '--renamefF':
793 pft.renameUpper()
794 elif arg == '--renameFf':
795 pft.renameLower()
796
797
798def applyTransfoVariables(pft, arg, args, simplify, parserOptions, stopScopes):
799 """
800 Apply variables transformations on a PYFT instance
801 :param pft: PYFT instance
802 :param arg: argument to deal with
803 :param args: parsed argparsed arguments
804 :param simplify: kwargs to simplify
805 :param parserOptions: fxtran parser options
806 :param stopScopes: upper limit in call tree for some transformations
807 """
808 if arg == '--showVariables':
809 pft.varList.showVarList()
810 elif arg == '--attachArraySpecToEntity':
811 pft.attachArraySpecToEntity()
812 elif arg == '--removeVariable':
813 for scopePath, varName in args.removeVariable:
814 pft.getScopeNode(pft.normalizeScope(scopePath)).removeVar([varName], **simplify)
815 elif arg == '--addVariable':
816 for scopePath, varName, declStmt, pos in args.addVariable:
817 pft.getScopeNode(pft.normalizeScope(scopePath)).addVar(
818 [[varName, declStmt, (int(pos) if isint(pos) else None)]])
819 elif arg == '--addModuleVariable':
820 for scopePath, moduleName, varName in args.addModuleVariable:
821 pft.getScopeNode(pft.normalizeScope(scopePath)).addModuleVar([[moduleName, varName]])
822 elif arg == '--showUnusedVariables':
823 pft.showUnusedVar()
824 elif arg == '--removeUnusedLocalVariables':
825 pft.removeUnusedLocalVar(
826 [item.strip() for item in args.removeUnusedLocalVariables.split(',')]
827 if args.removeUnusedLocalVariables != 'NONE' else None, **simplify)
828 elif arg == '--removePHYEXUnusedLocalVariables':
829 pft.removePHYEXUnusedLocalVar(
830 [item.strip() for item in args.removePHYEXUnusedLocalVariables.split(',')]
831 if args.removePHYEXUnusedLocalVariables != 'NONE' else None, **simplify)
832 elif arg == '--addExplicitArrayBounds':
833 pft.addExplicitArrayBounds()
834 elif arg == '--addArrayParentheses':
835 pft.addArrayParentheses()
836 elif arg == '--modifyAutomaticArrays':
837 pft.modifyAutomaticArrays(*(args.modifyAutomaticArrays.split('#')))
838 elif arg == '--replaceAutomaticWithAllocatable':
839 pft.modifyAutomaticArrays(
840 "{type}, DIMENSION({doubledotshape}), ALLOCATABLE :: {name}",
841 "ALLOCATE({name}({shape}))", "DEALLOCATE({name})")
842 elif arg == '--addArgInTree':
843 for varName, declStmt, pos in args.addArgInTree:
844 pft.addArgInTree(varName, declStmt, int(pos), stopScopes,
845 parserOptions=parserOptions,
846 wrapH=args.wrapH)
847 elif arg == '--addONLY':
848 pft.addONLY(parserOptions=parserOptions, wrapH=args.wrapH)
849
850
851def applyTransfoApplications(pft, arg, args, simplify, parserOptions, stopScopes):
852 """
853 Apply applications transformations on a PYFT instance
854 :param pft: PYFT instance
855 :param arg: argument to deal with
856 :param args: parsed argparsed arguments
857 :param simplify: kwargs to simplify
858 :param parserOptions: fxtran parser options
859 :param stopScopes: upper limit in call tree for some transformations
860 """
861 if arg == '--addStack':
862 pft.addStack(args.addStack, stopScopes,
863 parserOptions=parserOptions,
864 wrapH=args.wrapH)
865 elif arg == '--deleteDrHook':
866 pft.deleteDrHook(**simplify)
867 elif arg == '--addDrHook':
868 pft.addDrHook()
869 elif arg == '--deleteBudgetDDH':
870 pft.deleteBudgetDDH(**simplify)
871 elif arg == '--deleteRoutineCallsMesoNHGPU':
872 pft.deleteRoutineCallsMesoNHGPU(**simplify)
873 elif arg == '--deleteNonColumnCallsPHYEX':
874 pft.deleteNonColumnCallsPHYEX(**simplify)
875 elif arg == '--addMPPDB_CHECKS':
876 pft.addMPPDB_CHECKS()
877 elif arg == '--addPrints':
878 pft.addMPPDB_CHECKS(printsMode=True)
879 elif arg == '--addSubmodulePHYEX':
880 pft.addSubmodulePHYEX()
881 # mnhExpand must be before inlineContainedSubroutines as inlineContainedSubroutines
882 # can change variable names used by mnh_expand directives
883 assert not (args.mnhExpand and args.mnhExpandConcurrent), \
884 "Only one of --mnhExpand and --mnhExpandConcurrent"
885 if arg == '--mnhExpand':
886 pft.removeArraySyntax(everywhere=False, addAccIndependentCollapse=False)
887 elif arg == '--mnhExpandConcurrent':
888 pft.removeArraySyntax(concurrent=True, everywhere=False)
889 elif arg == '--inlineContainedSubroutines':
890 pft.inlineContainedSubroutines(**simplify)
891 elif arg == '--inlineContainedSubroutinesPHYEX':
892 pft.inlineContainedSubroutinesPHYEX(**simplify)
893 elif arg == '--expandAllArrays':
894 pft.removeArraySyntax()
895 elif arg == '--expandAllArraysConcurrent':
896 pft.removeArraySyntax(concurrent=True)
897 elif arg == '--expandAllArraysPHYEX':
898 pft.expandAllArraysPHYEX()
899 elif arg == '--expandAllArraysPHYEXConcurrent':
900 pft.expandAllArraysPHYEX(concurrent=True)
901 elif arg == '--removeIJDim':
902 pft.removeIJDim(stopScopes,
903 parserOptions=parserOptions,
904 wrapH=args.wrapH, **simplify)
905 elif arg == '--shumanFUNCtoCALL':
906 pft.shumanFUNCtoCALL()
907 elif arg == '--shugradTransfo':
908 pft.shugradTransfo()
909 elif arg == '--buildACCTypeHelpers':
910 pft.buildACCTypeHelpers()
911 elif arg == '--mathFunctoBRFunc':
912 pft.mathFunctoBRFunc()
913 elif arg == '--convertTypesInCompute':
914 pft.convertTypesInCompute()
915 elif arg == '--buildModi':
916 pft.buildModi()
917 elif arg == '--splitModuleRoutineFile':
918 pft.splitModuleRoutineFile()
919 elif arg == '--removeExtraDOinMnhDoConcurrent':
920 pft.removeExtraDOinMnhDoConcurrent()
921 elif arg == '--convertuseModuleToIncludes':
922 pft.convertuseModuleToIncludes()
923
924
925def applyTransfoOpenACC(pft, arg, args, stopScopes): # pylint: disable=unused-argument
926 """
927 Apply openACC transformations on a PYFT instance
928 :param pft: PYFT instance
929 :param arg: argument to deal with
930 :param args: parsed argparsed arguments
931 :param stopScopes: upper limit in call tree for some transformations
932 """
933 if arg == '--addACCData':
934 pft.addACCData()
935 elif arg == '--craybyPassDOCONCURRENT':
936 pft.craybyPassDOCONCURRENT()
937 elif arg == '--removebyPassDOCONCURRENT':
938 pft.removebyPassDOCONCURRENT()
939 elif arg == '--addACCRoutineSeq':
940 pft.addACCRoutineSeq(stopScopes)
941 elif arg == '--removeACC':
942 pft.removeACC()
943 elif arg == '--allocatetoHIP':
944 pft.allocatetoHIP()
945
946
947def applyTransfoCosmetics(pft, arg, args):
948 """
949 Apply cosmetics transformations on a PYFT instance
950 :param pft: PYFT instance
951 :param arg: argument to deal with
952 :param args: parsed argparsed arguments
953 """
954 if arg == '--splitLongLines':
955 pft.splitLongLines(args.maxLineLength)
956 elif arg == '--upperCase':
957 pft.upperCase()
958 elif arg == '--lowerCase':
959 pft.lowerCase()
960 elif arg == '--changeIfStatementsInIfConstructs':
961 pft.changeIfStatementsInIfConstructs()
962 elif arg == '--indent':
963 pft.indent()
964 elif arg == '--removeIndent':
965 pft.indent(indentProgramunit=0, indentBranch=0)
966 elif arg == '--removeEmptyLines':
967 pft.removeEmptyLines()
968 elif arg == '--removeComments':
969 pft.removeComments()
970 elif arg == '--updateSpaces':
971 pft.updateSpaces()
972 elif arg in ARG_UPDATE_CNT:
973 pft.updateContinuation(align=args.alignContinuation,
974 addBegin=args.addBeginContinuation,
975 removeBegin=args.removeBeginContinuation,
976 removeALL=args.removeALLContinuation)
977 elif arg == '--prettify':
978 pft.indent()
979 pft.upperCase()
980 pft.removeEmptyLines()
981 pft.updateSpaces()
982 pft.updateContinuation()
983 elif arg == '--minify':
984 pft.indent(indentProgramunit=0, indentBranch=0)
985 pft.upperCase()
986 pft.removeComments()
987 pft.removeEmptyLines()
988 pft.updateSpaces()
989 pft.updateContinuation(align=False, removeALL=True, addBegin=False)
990 elif arg == '--removeEmptyCONTAINS':
991 pft.removeEmptyCONTAINS()
992 elif arg == '--formatModuleUse':
993 pft.formatModuleUse()
994
995
996def applyTransfoChecks(pft, arg, args, stopScopes):
997 """
998 Apply checks transformations on a PYFT instance
999 :param pft: PYFT instance
1000 :param arg: argument to deal with
1001 :param args: parsed argparsed arguments
1002 :param stopScopes: list of scope paths or None
1003 """
1004 if arg == '--checkIMPLICIT':
1005 pft.checkImplicitNone(args.checkIMPLICIT == 'Err')
1006 elif arg == '--checkINTENT':
1007 pft.checkIntent(args.checkINTENT == 'Err')
1008 elif arg == '--checkOpInCall':
1009 pft.checkOpInCall(args.checkOpInCall == 'Err')
1010 elif arg == '--checkUnusedLocalVar':
1011 pft.checkUnusedLocalVar(args.checkUnusedLocalVar == 'Err')
1012 elif arg == '--checkPHYEXUnusedLocalVar':
1013 pft.checkPHYEXUnusedLocalVar(args.checkPHYEXUnusedLocalVar == 'Err')
1014 elif arg == '--checkEmptyParensInCall':
1015 pft.checkEmptyParensInCall(args.checkEmptyParensInCall == 'Err')
1016 elif arg == '--checkContinuationInArraySection':
1017 pft.checkContinuationInArraySection(args.checkContinuationInArraySection == 'Err')
1018 elif arg == '--checkLineLength':
1019 pft.checkLineLength(args.maxLineLength, args.checkLineLength == 'Err')
1020 elif arg == '--checkONLY':
1021 pft.checkONLY(args.checkONLY == 'Err')
1022 elif arg == '--checkKeyDim':
1023 pft.checkKeyDimConsistency(args.checkKeyDim == 'Err',
1024 stopScopes=stopScopes)
1025 elif arg == '--checkTopLevelUSE':
1026 pft.checkTopLevelUSE(args.checkTopLevelUSE == 'Err')
1027 elif arg == '--checkEmptyParensInMnhExpand':
1028 pft.checkEmptyParensInMnhExpand(args.checkEmptyParensInMnhExpand == 'Err')
1029
1030
1031def applyTransfoStatements(pft, arg, args, simplify):
1032 """
1033 Apply statements transformations on a PYFT instance
1034 :param pft: PYFT instance
1035 :param arg: argument to deal with
1036 :param args: parsed argparsed arguments
1037 :param simplify: kwargs to simplify
1038 """
1039 if arg == '--removeCall':
1040 for rc in args.removeCall:
1041 pft.removeCall(rc, **simplify)
1042 elif arg == '--removePrints':
1043 pft.removePrints(**simplify)
1044 elif arg == '--setFalseIfStmt':
1045 pft.setFalseIfStmt(args.setFalseIfStmt, **simplify)
1046
1047
1048def applyTransfoMisc(pft, arg, args, simplify): # pylint: disable=unused-argument
1049 """
1050 Apply misc transformations on a PYFT instance
1051 :param pft: PYFT instance
1052 :param arg: argument to deal with
1053 :param args: parsed argparsed arguments
1054 :param simplify: kwargs to simplify
1055 """
1056 if arg == '--showScopes':
1057 pft.showScopesList()
1058 elif arg == '--empty':
1059 pft.empty(**simplify)
1060
1061
1062def applyTransfoTree(pft, arg, args, plotCentralFile):
1063 """
1064 Apply tree transformations on a PYFT instance
1065 :param pft: PYFT instance
1066 :param arg: argument to deal with
1067 :param args: parsed argparsed arguments
1068 :param plotCentralFile: central file for plots
1069 """
1070 if arg == '--plotCompilTree' and plotCentralFile is not None:
1071 pft.tree.plotCompilTreeFromFile(plotCentralFile, args.plotCompilTree,
1072 args.plotMaxUpper, args.plotMaxLower)
1073 elif arg == '--plotExecTree' and plotCentralFile is not None:
1074 pft.tree.plotExecTreeFromFile(plotCentralFile, args.plotExecTree,
1075 args.plotMaxUpper, args.plotMaxLower)
1076
1077
1078def applyTransfoPreprocessor(pft, arg, args):
1079 """
1080 Apply preprocessor transformations on a PYFT instance
1081 :param pft: PYFT instance
1082 :param arg: argument to deal with
1083 :param args: parsed argparsed arguments
1084 """
1085 if arg == '--applyCPPifdef':
1086 pft.applyCPPifdef([k for aList in args.applyCPPifdef for k in aList])
1087
1088
1089if __name__ == "__main__":
1090 main()
applyTransfoApplications(pft, arg, args, simplify, parserOptions, stopScopes)
Definition scripting.py:851
updateParserVariables(parser)
Definition scripting.py:397
applyTransfoStatements(pft, arg, args, simplify)
applyTransfoTree(pft, arg, args, plotCentralFile)
applyTransfoPreprocessor(pft, arg, args)
updateParserCosmetics(parser)
Definition scripting.py:472
applyTransfoVariables(pft, arg, args, simplify, parserOptions, stopScopes)
Definition scripting.py:798
updateParserInputsOutputs(parser, withInput, withOutput, withXml)
Definition scripting.py:360
updateParserApplications(parser)
Definition scripting.py:517
updateParserFxtran(parser)
Definition scripting.py:385
updateParserChecks(parser)
Definition scripting.py:622
updateParserOpenACC(parser)
Definition scripting.py:596
updateParserPreprocessor(parser)
Definition scripting.py:728
mainParallel(argv=None)
Definition scripting.py:80
applyTransfoOpenACC(pft, arg, args, stopScopes)
Definition scripting.py:925
updateParserStatements(parser)
Definition scripting.py:669
getArgs(parser, argv)
Definition scripting.py:185
applyTransfo(pft, arg, args, plotCentralFile)
Definition scripting.py:740
getDescTree(args, cls=Tree)
Definition scripting.py:252
applyTransfoMisc(pft, arg, args, simplify)
updateParser(parser, withInput, withOutput, withXml, withPlotCentralFile, treeIsOptional, nbPar, restrictScope)
Definition scripting.py:270
applyTransfoCosmetics(pft, arg, args)
Definition scripting.py:947
applyTransfoFileName(pft, arg)
Definition scripting.py:783
updateParserTree(parser, withPlotCentralFile, treeIsOptional)
Definition scripting.py:700
applyTransfoChecks(pft, arg, args, stopScopes)
Definition scripting.py:996
poolInit(cls, afa)
Definition scripting.py:68
updateParserMisc(parser)
Definition scripting.py:689