-
Notifications
You must be signed in to change notification settings - Fork 13
Adds support for --help option #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
92e7850
148dd0b
a21d797
3ad7368
7378a04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,14 +3,48 @@ | |
|
|
||
| import scorep.instrumenter | ||
| import scorep.subsystem | ||
| from scorep.helper import print_err | ||
| from scorep.helper import get_scorep_version, print_err | ||
|
|
||
|
|
||
| def _err_exit(msg): | ||
| print_err("scorep: " + msg) | ||
| sys.exit(1) | ||
|
|
||
|
|
||
| def print_help(): | ||
| print(""" | ||
| Usage: python -m scorep [options] [--] <script> [args] | ||
|
|
||
| Score-P Python instrumentation wrapper. The following options control how the program is instrumented and executed. Any unknown option are passed directly to 'scorep-config'. | ||
|
|
||
| --help Show this help message and exit. | ||
| --keep-files Keep temporary files after execution. | ||
| --verbose, -v Enable verbose output for debugging and tracing. | ||
| --nocompiler Disable compiler-based instrumentation. | ||
| --nopython Disable instrumentation of Python code. | ||
| Instrumentation can still be enabled later from within the application's source code. | ||
| --noinstrumenter Same as --nopython. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. time to deprecate that option? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
| --instrumenter-type=<type> | ||
| Specify custom instrumenter type (e.g., cProfile). | ||
| --instrumenter-file=<file> | ||
| Path to a Python script that is executed before the application. | ||
| Allows instrumentation of specific modules and functions without modifying their source code. | ||
| -- Stop parsing Score-P options; interpret all following arguments verbatim as the program with its arguments. | ||
|
|
||
| Other options starting with '-' are passed directly to 'scorep-config'. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that needs to be more prominent at the beginning |
||
| To view all available Score-P configuration options, run: scorep-config --help | ||
|
|
||
| Example: | ||
| scorep --mpi --thread=pthread -- ./your_script.py --arg1 --arg2 | ||
|
|
||
| Note: | ||
| If using --noinstrumenter, Score-P will not trace Python code, but it may still collect MPI or threading events | ||
| if configured. | ||
| You can enable Python instrumentation manually from within your application's source code, | ||
| e.g., by calling 'scorep.instrumenter.enable()'. | ||
| """) | ||
|
|
||
|
|
||
| def scorep_main(argv=None): | ||
| if argv is None: | ||
| argv = sys.argv | ||
|
|
@@ -19,10 +53,12 @@ def scorep_main(argv=None): | |
| prog_argv = [] | ||
| parse_scorep_commands = True | ||
|
|
||
| show_help = False | ||
| keep_files = False | ||
| verbose = False | ||
| no_default_compiler = False | ||
| no_instrumenter = False | ||
|
|
||
| if scorep.instrumenter.has_c_instrumenter(): | ||
| instrumenter_type = "cProfile" | ||
| else: | ||
|
|
@@ -33,7 +69,12 @@ def scorep_main(argv=None): | |
| if parse_scorep_commands: | ||
| if elem == "--": | ||
| parse_scorep_commands = False | ||
| if elem == "--help": | ||
| show_help = True | ||
| break | ||
| elif elem == "--mpi": | ||
| print_err(f"scorep: Warning: The option '{elem}' is deprecated " | ||
| "and will be removed in future.") | ||
| scorep_config.append("--mpp=mpi") | ||
| elif elem == "--keep-files": | ||
| keep_files = True | ||
|
|
@@ -46,7 +87,7 @@ def scorep_main(argv=None): | |
| no_instrumenter = True | ||
| elif elem == "--noinstrumenter": | ||
| no_instrumenter = True | ||
| elif elem in ["--io=runtime:posix", "--io=posix"]: | ||
| elif elem in ["--io=runtime:posix", "--io=posix"] and get_scorep_version() >= 9.0: | ||
| print_err(f"scorep: Warning: The option '{elem}' is deprecated.") | ||
| if "SCOREP_IO_POSIX" in os.environ: | ||
| print_err(" Will not overwrite existing value for environment variable " | ||
|
|
@@ -71,6 +112,11 @@ def scorep_main(argv=None): | |
| if not no_default_compiler: | ||
| scorep_config.append("--compiler") | ||
|
|
||
| # fast exit on "--help" | ||
| if show_help: | ||
| print_help() | ||
| sys.exit(0) | ||
|
|
||
| if len(prog_argv) == 0: | ||
| _err_exit("Did not find a script to run") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what means "tracing" in this context?