Capture reports using the asys CLI
The Asight Systems command-line tool, asys, collects performance analysis data and generates reports for a target application without a GUI. You can then copy these reports to another system for later analysis with the GUI tool.
Key features of asys include:
Trace Collection
Collects execution information for CUDA, cuDNN, cuBLAS, NVTX, and OSRT APIs.
Collects kernel execution and memory operation information on PPU devices, and correlates CPU and PPU information.
Collects execution information for PCCL communication processes.
Collects call stacks for CUDA and OSRT APIs.
Collects CPU scheduling information and call stacks during CPU execution, and calculates the percentage of time spent in each function based on the collected stacks.
Collects memory usage information on both the PPU and CPU.
Collects metrics such as network interface card throughput.
Collection Control
Lets you control the collection duration, set a delayed start for trace collection, and manually interrupt the collection process.
Lets you specify the collection scope using NVTX ranges.
Lets you specify the collection scope using the CUDA profiler API (cudaProfilerStart/Stop).
Lets you trigger trace collection in a loop and specify the number of iterations.
Automatically generates report names and lets you compose them using macros.
Lets you customize the application's runtime environment, including configuring environment variables and managing console output.
Collects data from daemon applications and lets you specify the application's termination condition.
Supports long-duration collection with report file rotation.
Interactive Trace Collection
Lets you control application launch and trace collection separately using the start, stop, launch, and shutdown subcommands.
Lets you start and stop trace collection multiple times while an application is running.
Supports multiple concurrent collection sessions and lets you view a list of active sessions.
Lets you attach to a running application to collect trace information using the attach subcommand.
Statistical Analysis and Post-processing
Provides grouped statistics for device memory usage.
Provides statistical analysis of PPU utilization.
For information about configuring the asys environment, see Configure the asys command-line tool.
To view help, run the asys -h command. The tool offers several subcommands for different trace collection methods:
root@0b0f55fa89fd:~# asys -h
usage: asys [--version] [--help] <command> [<args>] [application] [<application args>]
The most commonly used asys commands are:
profile Run an application and capture its profile into a asysrep file.
attach Attach to process and capture its profile into a asysrep file.
launch Launch an application ready to be profiled.
start Start a profiling session.
stop Stop a profiling session and capture its profile into a asysrep file.
cancel Cancel a profiling session and discard any collected data.
shutdown Disconnect launched processes from the profiler and shutdown the profiler.
sessions List active sessions.
status Provide current status of CLI or the collection environment.
export Export asysrep file into another format.
stats Generate statistics from an existing asysrep or SQLite file.
analyze Identify optimization opportunities in a asysrep file.
Use 'asys --help <command> ' for more information about a specific command.To view help for a specific subcommand, run asys <sub_command> -h. For example, to get help for the profile subcommand, run:
asys profile -hTo view the installed asys version, run:
asys -v1. Collect traces
Run asys profile to specify trace items, run an application, and generate a trace report.
The syntax for the profile subcommand is:asys profile [option] <application> [application args]
1.1 Specify trace items
Use the --trace or -t option to specify the trace items to enable. Separate multiple trace items with a ,. For example:
asys profile -t hggc,hgtx,acblas -o baseline python test_linear.py-t hggc,hgtx,acblasspecifies the trace items to enable: hggc, hgtx, and acblas.-o baselinespecifies the output report name, without the file extension.python test_linear.pyruns the application.
After the application finishes or you interrupt it by pressing Ctrl + C, asys generates the corresponding trace report (in this example, baseline.asysrep). You can then view the report in Asight Systems.
2. Control the tracing process
2.1 Control tracing time
Use the--delay or-y option to delay the start of tracing. Use the--duration or-d option to set the tracing duration. When this duration elapses, asys stops the application and generates a report. For example:
asys profile -t hggc --delay 2 --duration 3 python test_linear.py--delay 2: Starts tracing 2 seconds after the application starts.--duration 3: Traces for 3 seconds, then stops the application and generates a report.
The following diagram shows the tracing process workflow.

Tips: To prevent the application from stopping when the tracing duration ends, use the--kill none option.
2.2 Limit report file size
Use the--max-report-size option to set a size limit for the generatedasysrep report file in mebibytes (MiB). asys stops tracing when the report file exceeds this limit. For example:
asys profile -t hggc --max-report-size 10 python test_linear.py--max-report-size 10: Limits the maximum report file size to 10 MiB. Tracing stops when the file exceeds this size.
Tips:
If you set both the
--max-report-sizeand--durationoptions, asys stops tracing once either limit is reached.You can use the
--max-report-sizeoption with the--trace-rotationoption to limit the size of each file during report file rotation.asys stops tracing after the report reaches the size set by
--max-report-size. However, asys might append additional trace data while stopping, so the final report file can be slightly larger than the specified limit.
2.3 Event-triggered tracing
You can precisely control the tracing range by inserting specific events into your application and specifying the start and end trigger events in asys.
asys supports two trigger types, specified with the --capture-range or -c option. The trigger events are described below.
Value for --capture-range | Description |
hggcProfilerApi | Starts on hggcProfilerStart or cudaProfilerStart. Ends on hggcProfilerStop or cudaProfilerStop. |
hgtx | Triggered by an HGTX/NVTX range. |
none | Default value. Disables event-triggered tracing. |
For example, to usehggcProfilerApi as a trigger event to trace a specific code range, insert the cudaProfilerStart/cudaProfilerStop API calls into your application code.
cudaProfilerStart(); // profile start
DoProcess();
cudaProfilerStop(); // profile stop
DoOtherProcess();asys profile -t hggc -c hggcProfilerApi cuda_test-c hggcProfilerApi: Starts tracing atcudaProfilerStart, stops tracing atcudaProfilerStop, and then the application terminates. In this example, asys traces only the execution of DoProcess.
Tips: IfhggcProfilerStart andhggcProfilerStop appear multiple times during tracing (for example, start is called twice before stop), asys uses the first start and the first stop to define the tracing time range.
For example, to usehgtx as a trigger event to trace a specific code range, insert an NVTX range named "DoProcess" into your application code.
for (int index = 0; index < 5; ++index) {
nvtxRangePushA("DoProcess"); // start
DoProcess();
nvtxRangePop(); // stop
}asys profile -t hggc,hgtx -c hgtx -p DoProcess cuda_test-c hgtx: Specifies HGTX/NVTX as the trigger event source.-p DoProcess: Specifies the HGTX/NVTX range name. In this example, the range is named "DoProcess" and belongs to the default domain. Tracing starts when the DoProcess range begins and stops when it ends, after which the application terminates.
When using HGTX/NVTX as the trigger event source, the--hgtx-capture or-p option supports multiple formats for specifying domain and range matching patterns.
Value for --hgtx-capture | Description |
range@domain | Matches a time range named |
range | Matches a time range named |
range@* | Matches a time range named |
Whether the trigger method ishggcProfilerApi orhgtx, asys supports multiple event triggers (each trigger generates a separate report). You can also use the--capture-range-end option to specify the behavior when an end event is triggered.
Value for | Description |
none | Ignores the end event. Once triggered, tracing continues until the program ends or you interrupt it with |
stop | Stops tracing after this end event. The application continues to run, and asys ignores subsequent trigger events. |
stop-shutdown | Default value. Stops tracing and asys terminates the application after this end event. |
repeat[:N] | Repeatedly triggers tracing for
asys generates a separate report for each trigger, with an index number appended to the report name. |
repeat-shutdown:N | Similar to asys generates a separate report for each trigger, with an index number appended to the report name. |
merge[:N] | In the current process, repeatedly triggers tracing for
A single report is generated after |
merge-shutdown:N | The behavior is similar to the A single report is generated after |
The following example shows how to perform repeated tracing. It triggers tracing twice, generates two reports, and then terminates the application:
asys profile -t hggc,hgtx -c hgtx -p DoProcess --capture-range-end repeat-shutdown:2 cuda_test-c hgtx: Specifies HGTX/NVTX as the trigger event source.-p DoProcess: Specifies the HGTX/NVTX range name, which is "DoProcess" in this example.--capture-range-end repeat-shutdown:2: Triggers tracing twice and then terminates the application.

The following example shows how to use the merge-shutdown:N option to collect traces twice in a loop, generate one report, and then stop the application:
asys profile -t hggc,hgtx -c hgtx -p DoProcess --capture-range-end merge-shutdown:2 cuda_test-c hgtx: Specifies HGTX/NVTX as the trigger event source.-p DoProcessspecifies the HGTX / NVTX range name. In this example, the range name isDoProcess.--capture-range-end merge-shutdown:2: Triggers tracing twice and then terminates the application.

Tips: When--capture-range-end is set torepeat[:N] orrepeat-shutdown:N, if the interval between a stop event and the next start event in the application is very short:
asys might not respond to this start event. asys will begin tracing after it matches a subsequent start event.
Trace data from other processes (which may have different trigger events) might be lost at the beginning of the tracing session.
Tips: When--capture-range-end is set tomerge[:N] ormerge-shutdown:N, the start and stop events in the application only apply to tracing within the current process:
The start and stop events of the current application process do not trigger the start or stop of tracing in other processes.
Some tracing features, such as those for CPU activity and RDMA NIC metrics, are not controlled by the application's start and stop events and will collect data continuously.
2.4 Report file rotation
For long-duration tracing, use the--trace-rotation and--duration options together to enable report file rotation.
asys collects data for the time specified by
--duration, generates a report file, and then starts the next tracing round.asys keeps only the most recent report files. The
--trace-rotationoption specifies the number of files to keep.You can use the
--outputoption to specify a report name template. Use the %t parameter in the name to record the trace start time and avoid duplicate filenames.
For example, to generate a report file every 30 seconds and keep the three most recent files:
asys profile -t hggc --duration 30 --trace-rotation 3 --output test_report_%t cuda_test--duration 30: Sets the duration for each tracing round to 30 seconds.--trace-rotation 3: Specifies that the three most recent report files are kept.--output test_report_%t: Specifies the report name template. %t is a macro that asys replaces with the trace start time. For example, a generated filename could be test_report_08_09_33.asysrep.

Tips:
The
--trace-rotationoption cannot be used with the--capture-rangeoption.There is a short gap between the end of one tracing round and the start of the next. asys does not collect trace data from this gap.
asys continuously collects trace data until the application finishes. You can stop the application and end tracing by pressing
Ctrl + C.
2.5 Specify the report name
You can use the--output or-o option to specify the report name. You do not need to specify the file extension; asys automatically adds the .asysrep suffix. Use the--force-overwrite true or-f true option to allow overwriting files with the same name.
When you use the-o option to specify the report name, asys supports the following macro variables.
Macro variable | Value |
%q{ENV} | The value of the "ENV" environment variable. |
%h | The hostname. |
%p | The application's PID. |
%i | A unique index number within the folder to prevent name conflicts. |
%t | The start time of the trace, in the format |
For example:
asys profile -t hggc -o report_%q{HGGC_DRIVER_CANDIDATE}_%i python test_linear.py-o report_%q{HGGC_DRIVER_CANDIDATE}_%i: In this example, the final report file isreport_UMD_2.asysrep.asys replaces
%q{HGGC_DRIVER_CANDIDATE}with the value of theHGGC_DRIVER_CANDIDATEenvironment variable.asys replaces
%iwith an index value to ensure the filename is unique within the current folder.
Tips: The default value of the-o option isreport%i. Therefore, if you do not specify the-o option, asys will not overwrite existing report files.
2.6 Customize the application runtime environment
You can customize the application's runtime environment.
Use the--env-var or-e option to add environment variables for the application's execution. Separate multiple environment variables with a comma (,).
Use the--inherit-environment false or -n false option to prevent the application from inheriting system environment variables.
Use the--show-output false or-w false option to suppress the application's printed output.
For example:
asys profile -e ENABLE_DEBUG=1,LOG_LEVEL=DEBUG -n false -w false python test_linear.py-e ENABLE_DEBUG=1,LOG_LEVEL=DEBUG: Sets theENABLE_DEBUGandLOG_LEVELenvironment variables when running the application.-n false: Prevents the application from inheriting system environment variables.-w false: Suppresses the application's printed output.
2.7 Wait for the application to exit
You can specify how asys determines when an application finishes. By default, asys waits for the application and all its forked processes to exit. For example, with an application running as a daemon, asys waits for all background daemon processes to terminate before stopping tracing. Use the--wait option to change this behavior.
Value for --wait | Description |
primary | asys waits for the application's primary process to exit. |
all | Default value. asys waits for all processes in the application process tree to exit. |
2.8 System-wide tracing
By default, asys collects trace data from the application process tree (the primary process and its descendants). If other background applications compete for CPU resources and affect your application's performance, tracing only the application process tree may not be sufficient for diagnosis. In such cases, you can use system-wide tracing to collect trace data from all processes on the operating system and analyze the impact of background applications.

Use the--sample or-s option to enable system-wide tracing. For example:
asys profile -s system-wide -t hggc python test_linear.py-s system-wide: Collects CPU scheduling trace data for all processes on the system.
You can perform system-wide tracing without specifying an application. If you do not specify an application, you cannot collect application-level tracing items. For example:
asys profile -s system-wide --ppu-metrics-device all --nic-metrics true-s system-wide: Collects CPU scheduling trace data for all processes on the system.--ppu-metrics-device all: Enables metrics sampling for all PPU devices.--nic-metrics true: Collects NIC metrics.
asys categorizes tracing items by scope. System-wide items, such as--ppu-metrics-device, are labeled "System scope" in the help information. In contrast, application-level items, such as--trace, are labeled "Application scope." You can use the-s option to switch CPU scheduling betweensystem-wide andprocess-tree. For a full list of tracing items and their scopes, runasys profile -h.
2.9 Limit tracing to specific application processes
By default, asys traces all application processes and records the trace data to a single report file. This can result in a large amount of data. To trace only specific processes, specify filtering conditions.
You can use the --process-ppu-include option to specify a list of PPU device IDs for trace data collection, separating multiple IDs with a comma ,. For example, to collect trace data only for processes that use PPU device IDs 0 and 2:
asys profile --process-ppu-include 0,2 python test_linear.pyTips:
If you use
--process-ppu-include, asys will still collect trace data from processes that do not use any PPU device.If a process uses multiple PPU devices, and any of those devices are not in the specified ID list, asys will not collect trace data for that process.
You can use the --process-rank-include option to specify the Rank IDs of the processes for which to collect trace data. Separate multiple Rank IDs with a comma (,). For example, to collect trace data only from processes with Rank ID 0 and 2:
asys profile --process-rank-include 0,2 python test_linear.pyWhen you specify the--process-rank-include option, by default, asys detects the process Rank ID from the following environment variables:
OMPI_COMM_WORLD_RANK
SLURM_PROCID
RANK
PMI_RANKTo use a different environment variable to get the Rank ID, use the--process-rank-env option to specify the environment variable name. For example, to use thePROCESS_RANK_ID environment variable to detect the Rank ID:
asys profile --process-rank-include 0,2 --process-rank-env=PROCESS_RANK_ID python test_linear.pyTips: If you use the--process-rank-include option, asys will not collect trace data from processes whose Rank ID it cannot detect.
3. Interactive tracing
In addition to tracing withasys profile, asys lets you use separate subcommands to launch an application, start and stop tracing, and stop the application, giving you flexible control over tracing.
3.1 Interactive commands
asys provides the following subcommands to control tracing. To view the help for a subcommand, runasys <subcommand> -h.
Subcommand | Description |
launch |
|
start |
|
stop |
|
cancel |
|
shutdown |
|
sessions |
|
Combine these subcommands for flexible control over application execution and tracing.
For example, to launch an application, capture two trace reports, and then stop the application:
asys launch -t hggc cuda_test
asys start -o test_report1
asys stop
asys start -o test_report2
asys stop
asys shutdownasys launch ...: Launches the application.asys start ...: Starts tracing and specifies the report file.asys stopStops tracing without stopping the application. You can run asys start ... later to start a new round of tracing.asys shutdown: Stops the application.

For example, to start tracing with an event trigger condition, and then launch the application:
asys start -o test_report -c hgtx -p DoProcess
asys launch -t hggc,hgtx cuda_testasys start ...: Starts the collection process and uses the-cand-poptions to specify an event trigger condition. Data capture begins after the application launches.-c hgtx: Enables tracing to be triggered by an HGTX range event.-p DoProcess: Specifies that tracing is triggered by the HGTX range namedDoProcess.
The
asys launch ...command launches the application. Because tracing is already enabled by theasys startcommand,asys launch ...starts tracing immediately after the application launches. Recording begins when an event trigger condition is matched.

3.2 Concurrent collection processes
asys supports running multiple collection processes concurrently, such as multipleasys profile orasys launch / start processes. Each collection process corresponds to asession, which distinguishes it from other concurrent processes. You can use options to create or connect to a session. Each session has a name and a session ID, and session names must be unique.
Parameter | Description |
--session-new |
|
--session |
|
For example, run asys launch to create a session. When you run asys start, associate this session and specify that this session starts tracing.
asys launch -t hggc --session-new test cuda_test
asys start --session test--session-new test: Creates a session namedtest.--session test: Connects to the session namedtest.
To view the list of active sessions, run:
asys sessions list
The ID column shows the session ID for each session. You can use this session ID with the--session option to select a session.
If you omit a session option, asys uses the following default session names:
asys profilesubcommand:profile-<pid>-<application>.asys launch / start / stop / cancel / shutdownsubcommands:[default].
Tip: You can run multiple asys profile subcommands concurrently because their default session names are different. For interactive subcommands, only one session with the default name can exist at a time.
4. Attach trace collection (Beta)
asys supports collecting trace data by attaching to a running application. The application does not need to be launched by asys. The asys attach command allows you to attach to multiple application processes simultaneously and repeatedly attach to the same application to collect data. Once collection is complete, the application continues to run unaffected.

4.1 Usage
The following example shows how to use asys attach to attach to multiple application processes and collect trace data:
asys attach -t hggc -f true -o attach_report 94644,94923-t hggc: Collects HGGC-related trace data.-f true: Allows overwriting an existing report file with the same name.-o attach_report: Sets the report name toattach_report.94644,94923Attaches to the processes with PIDs 94644 and 94923. Use a,to separate multiple PIDs.
After you run asys attach, trace data collection begins. You can press Ctrl + C to stop trace collection and generate a report file, or use the --duration option to specify a collection duration. For example:
asys attach -t hggc --duration 10 94644,94923 --duration 10: Collects data for 10 seconds, then stops trace collection and generates a report. This does not affect the application's execution.
The asys attach command supports repeatedly attaching to an application to collect trace data. The tool does not stop the application after collection is complete. asys attach has a minimal performance impact after collection stops and does not interfere with the application's continued execution.
4.2 Supported features
The trace collection features supported by asys attach are similar to those of asys profile. You can run asys attach -h to view the supported features.
The following table describes the data collected for each trace item supported by the -t option.
Trace item | Collected content |
hggc | Execution time and call stack information for Execution time and call stack information for
Correlation between |
pccl | Execution time for each stage of the |
asys attach also supports the following trace collection features:
Supports
--sampleCPU execution information and--backtracecall stack collection.Supports
--python-samplingPython call stack collection.Supports Python function collection via
--python-functions-trace.Supports collecting the HGGC API Python backtrace using
--python-backtrace.Supports system memory usage collection with
--host-memory-sampling.Supports the
--ppu-metrics-deviceparameter for device metrics collection.Supports the
--nic-metricsparameter for collecting NIC metrics.Supports
--hggcbacktraceto collect HGGC call stacks.The
--hggc-memory-usageflag enables the collection of device memory usage and pinned memory usage.
4.3 Considerations
Consider the following when using asys attach for trace collection:
asys attachis supported only on x86_64 and Arm instruction set environments.asys attachmay cause an application deadlock when attaching to the process.Do not use different release versions of
asys attachon the same application process.
asys attach has the following limitations:
asys attachdoes not currently support collecting trace data forHGTX,ACDNN,ACBLAS,OSRT, or video.asys attachcannot collect trace information from legacyHGGCgraphs instantiated before you attach.asys attachdoes not support attaching to a process that is already using theHGPTIlibrary.
5. Multi-node trace collection
asys profile supports a multi-node trace collection mode. By running the asys profile command once, you can generate a report file on each server without modifying your application code. This feature supports various multi-node application launch frameworks.
Tip: Ensure that the PPU-SDK is installed and initialized on each server.
5.1 Profile Ray multi-node applications
asys supports trace collection for multi-node applications launched by the Ray framework, such as model applications that use vLLM. After you configure the Ray cluster, use the --multi-node-mode ray option when launching the application with asys profile to enable multi-node trace collection. For example:
asys profile --multi-node-mode ray -f true -o qwen_vllm bash eval_llm_infer.sh--multi-node-mode ray: Enables the multi-node trace collection mode for theRayframework.-f true: Overwrites an existing report file.-o qwen_vllm: Specifies the report name asqwen_vllm.
The multi-node trace collection mode generates a separate report file on each server, with _node_<hostname> appended to the filename. For example, if the base report name is qwen_vllm, the actual filenames on each server might look like this:
qwen_vllm_node_swu137.asysrep
qwen_vllm_node_swu140.asysrep
Tips:
You must run this command as the root user or a user with equivalent permissions. Enabling the multi-node trace collection mode for the
Rayframework may cause the application to crash or deadlock.The --multi-node-mode option does not support collecting heap memory usage data or capturing application stdout/stderr output.
Trace collection may be incomplete during the application shutdown phase because of how
Rayframework workers terminate. To ensure complete data, we recommend using event-triggered tracing with the--capture-rangeoption or enabling the--flush-on-context-synchronize trueoption to save trace data promptly.
5.2 Profile multi-node applications launched by mpirun
asys supports trace collection for multi-node applications launched by mpirun. When launching the application with asys profile, use the --multi-node-mode mpirun option to enable multi-node trace collection. For example:
asys profile --multi-node-mode mpirun -f true -o pccl_all_reduce mpirun -np 16 -npernode 8 -H swu92:8,swu93:8 all_reduce_perf--multi-node-mode mpirun: Enables the multi-node trace collection mode for applications launched bympirun.-f true: Overwrites an existing report file.-o pccl_all_reduce: Specifies the report name aspccl_all_reduce.
The multi-node trace collection mode generates a separate report file on each server, with _node_<hostname> appended to the filename. For example, if the base report name is pccl_all_reduce, the actual filenames on each server might look like this:
pccl_all_reduce_node_swu92.asysrep
pccl_all_reduce_node_swu93.asysrep
Tips:
The --multi-node-mode option does not support collecting heap memory usage data or capturing application stdout/stderr output.
Using the absolute path to
mpirun, such as/usr/bin/mpirun, is not supported.