| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
from argparse import ArgumentParser |
| 26 |
|
| 27 |
from Tensile.Toolchain.Validators import ToolchainDefaults |
| 28 |
|
| 29 |
|
| 30 |
def parseArguments(): |
| 31 |
""" |
| 32 |
Returns: |
| 33 |
A dictionary containing the keys representing options and their values. |
| 34 |
""" |
| 35 |
|
| 36 |
argParser = ArgumentParser( |
| 37 |
description="TensileLogic runs critical checks to ensure the " |
| 38 |
"integrity of the supplied logic files.", |
| 39 |
) |
| 40 |
argParser.add_argument("LogicPath", help="path to library logic (yaml) files") |
| 41 |
|
| 42 |
argParser.add_argument( |
| 43 |
"-v", |
| 44 |
"--verbose", |
| 45 |
dest="Verbose", |
| 46 |
type=int, |
| 47 |
default=1, |
| 48 |
choices=[0, 1, 2, 3], |
| 49 |
help="set print level with `-v 2`", |
| 50 |
) |
| 51 |
argParser.add_argument( |
| 52 |
"--jobs", |
| 53 |
"-j", |
| 54 |
dest="Jobs", |
| 55 |
action="store", |
| 56 |
default=48, |
| 57 |
help="number of worker processes to use during validation checks", |
| 58 |
) |
| 59 |
argParser.add_argument( |
| 60 |
"--cxx-compiler", |
| 61 |
dest="CxxCompiler", |
| 62 |
action="store", |
| 63 |
default=ToolchainDefaults.CXX_COMPILER, |
| 64 |
help=f"default: {ToolchainDefaults.CXX_COMPILER}", |
| 65 |
) |
| 66 |
|
| 67 |
group = argParser.add_mutually_exclusive_group() |
| 68 |
group.add_argument( |
| 69 |
"--check-all", dest="CheckAll", action="store_true", help="run all logic file checks" |
| 70 |
) |
| 71 |
group.add_argument( |
| 72 |
"--check-only-custom-kernels", |
| 73 |
dest="CheckOnlyCustomKernels", |
| 74 |
action="store_true", |
| 75 |
help="run logic file checks only on custom kernels", |
| 76 |
) |
| 77 |
args = argParser.parse_args() |
| 78 |
|
| 79 |
return args |