Trace a target program
1. Tracing PPU activities
asys supports collecting trace data for both HGGC and mainstream GPUs. Use the -t option to specify which trace items to capture. If you do not specify any trace items, asys collects hggc,hgtx,acdnn,acblas by default. The following table lists the PPU-related trace items supported by the --trace option.
|
Trace item |
Description |
|
hggc |
Execution time and call stacks for HGGC runtime/driver APIs Execution time and call stacks for mainstream GPU runtime/driver APIs PPU execution details: kernel, memcpy, and memset Correlation between HGGC APIs and PPU execution |
|
acdnn |
ACDNN API: Execution times |
|
acblas |
ACBLAS API: Execution times |
|
hgvideo |
Execution time of HG-Encode APIs Execution time of HG-ACVID APIs Execution time of HG-JPEG APIs PPU execution information: video encoding and decoding Correlation between video APIs and PPU execution |
|
pccl |
Execution time for each phase of PCCL communication |
For the hggc trace item, you can control the scope of data collection for HGGC tracing by using the --hggc-trace-set option to enable specific sub-trace items. You can specify multiple subsets, separated by a , character. For example, --hggc-trace-set=kernel-activity,kernel-api:
|
Parameter |
Description |
|
kernel-activity |
Collects information about kernel execution on the PPU. |
|
memory-activity |
Collects information about memory operations on the PPU. |
|
kernel-api |
Collects execution information for kernel-related APIs on the host. |
|
memory-api |
Collects execution information for memory-related APIs on the host. |
|
default-set |
Default. Includes all specifiable trace subsets and other HGGC trace information. |
To specifically prevent the hggc trace item from collecting certain APIs, you can configure the ASIGHT_HGGC_TRACE_BLACKLIST environment variable by specifying a list of APIs to exclude, separating multiple API names with a ,. For example: export ASIGHT_HGGC_TRACE_BLACKLIST=cudaEventQuery,cuEventQuery.
1.1 PPU device activities
1.1.1 PPU activity
Required asys option: --trace hggc
After you open a collected report in the GUI tool, the PPU workload is displayed in a hierarchical structure, as shown in the following figure:

For easier viewing, the same timeline can span multiple rows. For example, in the figure above, the add_kernel event is displayed not only on its own row but also on the Kernels and stream rows.
If a context contains multiple streams, the tool displays an [All Stream] row that summarizes all streams.
Tips:
-
If a device has only one context, the tool hides the context node and shows its child stream nodes directly. Similarly, if a context has only one stream, the tool hides the stream node.
-
The displayed PPU device index is the physical index and is not affected by the
CUDA_VISIBLE_DEVICESenvironment variable. -
For HGGC stream memory write activities, the timeline shows only the start time, with a duration of 0.
Each PPU node name is prefixed with a percentage representing its duration relative to its parent's. For example, calculate the stream node percentage as follows:
stream percentage = 100.0 * stream duration / context duration
stream duration = sum of all event durations within the stream
context duration = sum of all event durations within the context
Therefore, "50.3% Stream 8" indicates that the total duration of all events in this stream accounts for 50.3% of the total duration of all events in its parent context.
Tips: The percentage calculation for kernel HGTX nodes under the Kernels row is an exception. Its denominator is the duration of the stream node, not its direct parent node.
Tips: When you apply a filter, the tool recalculates the time percentage for PPU nodes based on the filtered range and reorders them accordingly.
The PPU Device row summarizes all activities on the device. It is divided into two sub-rows: the upper sub-row shows kernel executions, and the lower sub-row shows memory operations. Different colors are used to distinguish memory operation types, such as HtoD, DtoH, DtoD, Pinned, and Pageable, as shown in the following figure:

1.1.2 PPU graphs
Required asys option: --trace hggc
The Timeline View supports a dedicated timeline for graphs to help you analyze graph execution. If a report contains graph information, the tool displays graph nodes under the stream node in the following hierarchy:
-
Graph Group
-
Graph
-
Graph Exec
-
-
The graph timeline displays the Graph ID and Graph Exec ID, as shown in the following figure:

The device row also summarizes aggregated graph information.

1.1.3 PPU video
Required asys option: --trace hgvideo
asys also supports collecting Video Activity data from the PPU and displays a corresponding timeline to help you analyze video processing performance, as shown in the following figure:

A video node appears under the stream node, showing all Video Activities within that stream. Similar to the kernel timeline, this information is also summarized in the device node. When you select a time range, the tooltip displays the time percentage of Video Activity, as shown in the following figure:

1.1.4 PPU HGTX projection
Required asys options: --trace hggc,hgtx
The Timeline View can display projections of HGTX ranges onto each HGGC stream row under the PPU node. These projections show the time range of PPU activities triggered within an HGTX range.

HGTX ranges are correlated with PPU activities in the following ways:
-
Correlation via HGGC API calls: An HGTX range is projected onto PPU activities triggered by an HGGC API call made within that range.
-
Correlation via HGGC graph node creation: An HGTX range is projected onto the PPU activities corresponding to an HGGC graph node that is created within that range, for example, by using HGGC stream capture.
1.1.5 Organizing PPU kernel nodes
The Timeline View supports two ways to organize kernel nodes:
-
Group by kernel base name
-
Group by kernel's HGTX
The following figure shows kernels grouped by base name:

The following figure shows kernels grouped by their HGTX:

You can switch between these two organization methods in the Options dialog.

1.2 Host API calls
1.2.1 HGGC API
Required asys option: --trace hggc
The thread node displays HGGC API call information. You can view the dispatch time for kernels and the start time for memory operations within HGGC:

Tips: In some scenarios, the tool may not collect the return value of an HGGC API.
1.2.2 ACDNN
Required asys option: --trace acdnn
After you enable this collection, the ACDNN timeline appears under the thread node:

1.2.3 ACBLAS
Required asys option: --trace acblas
After you enable this collection, the ACBLAS timeline appears under the thread node:

1.2.4 Video API
Required asys option: --trace hgvideo
When enabled, Video API calls, including Encode, Decode, and HGJPEG APIs, are displayed as follows:

1.3 Navigating host APIs and device activities
Asight Systems displays the correlation between host API calls and device activities and allows you to navigate between them:

In the figure above, clicking cudaLaunchKernel highlights the associated kernel executing on the device. You can use the Go to Host API or Go to Device Activity options in the context menu to navigate between them.
1.4 Switching between API and kernel names
You can change how launch API names are displayed by navigating to Tools > Options > Systems Profile > HGGC API Name Mode.
-
Show host API name
-
Show launched kernel name
1.5 Dependencies between PPU activities
Kernels on different streams on the PPU can establish execution dependencies through cudaEventRecord and cudaStreamWait. The Timeline View can display these dependencies. To do this, right-click a PPU activity or a related event API on the timeline:

The Timeline View uses an orange curve to represent the dependency, as shown in the following figure.
Timelines unrelated to the dependency are grayed out. Hovering over the curve displays details about the dependency. Clicking the curve highlights the entire dependency path. Dependencies between kernels on the same stream and dependencies on the default stream are represented by a green curve:

When an activity depends on multiple events across multiple streams, the dependency is displayed as follows:
-
The dependency is drawn from the last waited-on event in the dependent stream.
-
The view does not show dependent events on the same stream as the queried PPU activity.
By default, the view shows only effective dependencies. For example, when you query the dependencies of a kernel, the view shows the dependencies that delayed its execution. These are the dependencies that were active from the moment the launch API was called until the kernel began running on the PPU.
If you want to view all dependencies, including logical dependencies that were already met, go to Tools > Options > Systems Profile and set HGGC dependency display mode to All to display all logical dependencies.
Tips: Dependencies are calculated from the trace data in the report. If multiple threads with race conditions operate on an HGGC stream, the tool may display inaccurate dependencies.
1.6 Deep dive into a single kernel
If a kernel's performance does not meet expectations and you want to analyze it, select the kernel in the Timeline View and choose "Analyze the Selected Kernel with Asight Compute" from the right-click menu. This copies the command that generates an Asight Compute report. Run the command in the Asight Compute CLI to generate the report, and then use the Asight Compute GUI for further analysis.


2. Tracking PPU metrics
asys periodically samples various runtime metrics from a device, such as resource utilization and I/O throughput. The Asight Systems GUI visualizes these metrics over time:

Metrics of the same category are grouped and can be viewed in two aggregated modes: Overlay and Stacked.
Use the --ppu-metrics-device option to specify which devices to sample. To sample all devices, use --ppu-metrics-device all. For example:
asys profile -t hggc --ppu-metrics-device all python test_linear.py
This command samples all devices using the default metrics set.
Use the --ppu-metrics-set option to specify the metrics set to sample. For example, --ppu-metrics-set throughput samples the metrics set related to I/O throughput:
asys profile -t hggc --ppu-metrics-device all --ppu-metrics-set throughput python test_linear.py
Use the --ppu-metrics-device help option to list the available devices. You can specify multiple devices by separating their IDs with a comma (,). For example, --ppu-metrics-device 0,1 samples runtime metrics from only devices 0 and 1:
root@02892cb56ba5:~# asys profile --ppu-metrics-device help
Possible --ppu-metrics-device values are:
all: Select all supported PPUs
none: Disable PPU Metrics [Default]
device ID list: comma separated device ID list(eg.: 0,1)
Available PPU metrics sampling devices are:
0: PPU, PCI Bus ID: 00000000:10:00.0
1: PPU, PCI Bus ID: 00000000:11:00.0
2: PPU, PCI Bus ID: 00000000:CE:00.0
3: PPU, PCI Bus ID: 00000000:CF:00.0
Device metrics are sampled periodically. The default sampling frequency is 1,000 times per second (1 kHz). Use the --ppu-metrics-frequency option to change the frequency. For example, --ppu-metrics-frequency 10000 sets the sampling frequency to 10 kHz.
asys supports a wide range of device metrics. However, a capacity limit restricts the number of metrics that you can sample in a single run. asys provides several predefined metrics sets. Use the --ppu-metrics-set help option to view the available sets:
root@02892cb56ba5:~# asys profile --ppu-metrics-set help
Possible --ppu-metrics-set values are:
---------------- ---------------------------------------- --------------------------------------------
Identifier Description Enabled Metrics
---------------- ---------------------------------------- --------------------------------------------
summary Collect clock / memory / CU activity / ce__cycles_elapsed.avg.per_second
Bus throughput information. ce__cycles_active.avg.pct_of_peak_sustained_elapsed
gd__dispatch_count.avg.pct_of_peak_sustained_elapsed
ce__warps_active_accumulated.avg.pct_of_peak_sustained_elapsed
ce__warps_inactive_cu_active_accumulated.avg.pct_of_peak_sustained_elapsed
ce__warps_inactive_cu_idle_accumulated.avg.pct_of_peak_sustained_elapsed
cu__cycles_active.avg.pct_of_peak_sustained_elapsed
cu__ws_issue_active.avg.pct_of_peak_sustained_elapsed
cu__we_pipe_tensor_cycles_active.avg.pct_of_peak_sustained_elapsed
dram__exclude_hbm_bytes_read.sum.pct_of_peak_sustained_elapsed
dram__exclude_hbm_bytes_write.sum.pct_of_peak_sustained_elapsed
...
throughput Collect DRAM / PCIe / ICN link kvd__transaction_hit_rate.pct
throughput information. ksd__transaction_hit_rate.pct
l2__transaction_hit_rate.pct
dram__exclude_hbm_bytes_read.sum.pct_of_peak_sustained_elapsed
dram__exclude_hbm_bytes_write.sum.pct_of_peak_sustained_elapsed
pcie__read_bytes.avg.pct_of_peak_sustained_elapsed
pcie__write_bytes.avg.pct_of_peak_sustained_elapsed
icnltx__bytes.sum.pct_of_peak_sustained_elapsed
icnlrx__bytes.sum.pct_of_peak_sustained_elapsed
...
You can define a custom list of metrics to sample. Use the --ppu-metrics-list help option to view descriptions of all supported metrics:
root@02892cb56ba5:~# asys profile --ppu-metrics-list help
Possible --ppu-metrics-list values are:
ce__cycles_active.avg
Display Name:
ce__cycles_active.avg
Unit: cycle
Description:
# of cycles active on CE across CEs
...
kvd__transaction_hit_rate.pct
Display Name:
kvd__transaction_hit_rate.pct
Unit: %
Description:
(%) hit rate of KVD cacheable requests
...
Use the --ppu-metrics-list option to specify a custom list of metrics, separating them with a comma (,). asys samples the union of the metrics specified with --ppu-metrics-list and the metrics in the set specified with --ppu-metrics-set. For example, --ppu-metrics-list ce__cycles_active.avg,kvd__transaction_hit_rate.pct samples CE utilization and the KVD cache hit rate:
asys profile -t hggc --ppu-metrics-device all --ppu-metrics-set none --ppu-metrics-list ce__cycles_active.avg,kvd__transaction_hit_rate.pct python test_linear.py
A custom metrics list specified with --ppu-metrics-list must not exceed the device's sampling capacity limit. Use the --check-ppu-metrics-list option to validate the list, separating metrics with a comma (,):
root@02892cb56ba5:~# asys profile --check-ppu-metrics-list ce__cycles_active.avg,kvd__transaction_hit_rate.pct,pu__we_average_warps_issue_stalled_compute_sfu_raw_per_issue_active.ratio
Check sampling metrics list result: PASS.
Metrics list is suitable for PPU sampling capacity.
Tips: asys may fail to sample device runtime metrics if the PPU performance data sampling resources are already in use by another application. Sampling can fail for the following reasons:
-
Another asys application is already sampling device runtime metrics.
-
Another acu application is collecting tracking data.
-
DCGM is collecting profiling metrics. To pause DCGM collection, run
dcgmi profile --pause. -
You can use ppu-smi to query the busy status of the PPU performance counter and the HGML GPM service.
-
Use
ppu-smi -qto query the status of the PPU performance counter. -
Use
ppu-smi gpm --get-sample-stateto check if the HGML GPM service is enabled (this service uses the PPU performance counter when enabled). -
Use
ppu-smi gpm -s 0to pause the HGML GPM service output, which releases the PPU performance counter.
-
3. HGTX tracing
Asight Systems supports HGTX tracing, which lets you annotate a timeline. HGTX also supports custom domains and provides push/pop and start/end APIs.
The following example shows how to use HGTX:
#include <nvtx3/nvToolsExt.h>
for (int index = 0; index < 1000; ++index) {
nvtxRangePushA("Loop");
nvtxRangePushA("DoProcess");
DoProcess();
nvtxRangePop();
...
nvtxRangePop();
}
This code pushes two HGTX ranges, Loop and DoProcess, in order. The innermost DoProcess() function invokes some HGGC APIs. Use the following command to collect HGTX data:
asys profile -t hgtx -o test_report sample
After the profiling report is generated, the GUI displays the following:

The timeline for the outer NVTX range appears on top, and the inner NVTX range appears below. The Loop timeline contains the DoProcess timeline, which in turn contains the timeline for the runtime APIs called within it.
Asight Systems can also collect and display user-specified colors:

OS runtime tracing
Use OS runtime tracing (OSRT) to identify why a CPU thread is suspended, for example, due to a pthread_mutex_lock or sleep call. To collect OSRT data, add osrt to the -t trace option.
-
Use the
--osrt-thresholdoption to specify the collection threshold. -
Use the
--osrt-backtrace-thresholdoption to specify the call stack backtrace threshold.
For example:
asys profile -t osrt --osrt-backtrace-threshold 80000 python /test_script/ops/test_linear.py
View the OSRT timeline in the GUI:

5. CPU and thread activity tracking
Asight Systems lets you trace how threads are scheduled across CPU cores. With the asys command-line tool, use the --sample or -s option to collect data on your application's execution across the system's CPUs. It also periodically collects CPU execution call stacks and aggregates this data to provide function-level timing statistics.
For example, to collect CPU execution information and specify the call stack collection period:
asys profile -s process-tree -b dwarf --sample-period 2000000 python test_linear.py
-
-s process-tree: Traces CPU scheduling for the application process and its child and descendant processes. -
-b dwarf: Enables the collection of CPU execution backtrace information. This is enabled by default and can be omitted. -
--sample-period 2000000: Specifies the collection period for each CPU call stack, in CPU execution cycles. -
--sample-backtrace-depth: Specifies the depth of the CPU sampling call stack. The default is 24.
Tips:
-
Enabling CPU execution sampling significantly increases the report size. A smaller
--sample-periodvalue causes higher application performance overhead. -
The operating system may limit the collection frequency specified by the
--sample-periodoption, resulting in a lower actual frequency than configured. -
When a short sampling period is specified with
--sample-period, some sample points may be dropped due to throughput limitations.
5.1 CPU activity
This feature depends on one of the following collection options:
-
--sample process-tree: Collects the process tree. -
--sample system-wide: Samples all processes on the system.
After you enable CPU sampling, you can view the CPU activity:

In the figure above, the CPU Group row shows an overview of all CPU activity. Each node below it represents the workload on a specific core. In the timeline, high activity indicates a busy core, while blank areas signify an idle one. Activity from the main process is dark blue, and from child processes is black. Each CPU core node on the left has a color-coded label that is reused in the thread row.
The timeline's tooltip shows which process and thread are currently executing on the CPU:

Use the "Go to Thread Row" option in the context menu to navigate to the corresponding thread row:

Tip: CPU sampling uses a high sampling rate, which increases the report file size. If you do not need CPU sampling, disable it by passing -s none to the asys command.
5.2 Thread scheduling
This feature depends on one of the following collection options:
-
--sample process-tree: Collects the process tree. -
--sample system-wide: Collects all processes on the system.
The thread timeline with CPU sampling enabled is shown below:

The child nodes of a thread row display calls to various APIs. The thread row itself shows the thread's execution status on CPU cores across five sub-rows:

From top to bottom:
-
CPU utilization: CPU resource usage.
-
CPU core: The core on which the current thread is scheduled. Its color corresponds to the label color of the CPU core node.
-
Thread state, which has three types:
-
Running

-
Not scheduled

-
Waiting

-
-
Calling OSRT

-
Backtrace sample point: Represents a sample point. Its tooltip provides detailed backtrace information.
Hover over an item to view more detailed information.
When CPU sampling is disabled but OSRT collection is enabled, Asight Systems estimates the thread state based on OSRT execution. It considers time slices spent executing in OSRT to be CPU idle, and those spent executing outside of OSRT to be CPU busy.

In this case, there are two possible thread states:
-
Probably running

-
Probably waiting

If only backtrace sampling is enabled, the thread row displays sample points:

You can view timing statistics for functions in your application in the Function View at the bottom of the GUI:

5.3 CPU metrics collection
asys supports periodic collection of various CPU runtime metrics, including hardware and software (operating system) metrics, such as IPC and cache miss rate.

Because CPU metrics collection is a type of system-wide tracking, you must enable --event-sample=system-wide.
You can specify specific hardware metrics by using the --cpu-core-events parameter. Use --cpu-core-events=help to view the specific metrics and their definitions. For example:
asys profile --event-sample=system-wide --cpu-core-events=1,2,3
You can use --os--events to specify specific software (operation system) metrics, and --os-events=help to view the specific metrics and their definitions. For example:
asys profile --event-sample=system-wide --os-events=1,2,3
asys provides several preset CPU collection metric sets. You can use the --cpu-core-events-set option to specify a hardware metric set or the --cpu-core-events-set=help option to view the supported metric sets (the default is summary), for example,
asys profile --event-sample=system-wide --cpu-core-events-set=cache
You can use --os-events-set to specify a software metric set, and use the --os-events-set=help option to view the supported metric sets (the default is summary), for example
asys profile --event-sample=system-wide --os-events-set=fault
CPU metrics are collected periodically, and you can use --sample-period 2000000 to specify the sampling period for each CPU metric in CPU execution cycles (the default is 2,000,000).
6. API call stack tracing
asys supports API call stack tracing for libraries such as HGGC, OSRT, ACDNN, ACBLAS, cuDNN, and cuBLAS. You can configure tracing to collect call stacks only for API calls that exceed a specified runtime duration threshold and control the maximum backtrace depth. With call stack tracing enabled, you can view the data in the GUI's Function View, which displays flame graphs, icicle graphs, and Top Down, Bottom Up, and Flat tables.
6.1 Tracing HGGC call stacks
Use the following command to trace HGGC and collect call stack information:
asys profile -t hggc --hggcbacktrace all:1000 --hggc-backtrace-depth 24 python test_linear.py
-
-t hggc: Enables HGGC tracing. -
--hggcbacktrace all:1000: Collects call stacks for HGGC API calls if their runtime duration exceeds the 1,000-nanosecond (ns) threshold. -
--hggc-backtrace-depth 24: Sets the maximum backtrace depth to 24 frames for HGGC call stacks.
Hover over the timeline to view the call stack:

6.2 Tracing OSRT call stacks
Use the following command to trace OSRT and collect call stack information:
asys profile -t osrt --osrt-backtrace-threshold 80000 --osrt-backtrace-depth 24 python /test_script/ops/test_linear.py
-
-t osrt: Enables OSRT tracing. -
--osrt-backtrace-threshold 80000: Collects call stacks for OSRT API calls if their runtime duration exceeds the 80,000-nanosecond (ns) threshold. -
--osrt-backtrace-depth 24: Sets the maximum backtrace depth to 24 frames for OSRT call stacks.
The call stack appears as follows:

6.3 Tracing ACDNN and ACBLAS call stacks
Use the following command to trace ACDNN and ACBLAS and collect call stack information:
asys profile -t acdnn,acblas --acompute-backtrace-threshold 80000 python /test_script/ops/test_linear.py
-
-t acdnn,acblas: Enables ACDNN and ACBLAS tracing. -
--acompute-backtrace-threshold 80000: Collects call stacks for ACDNN and ACBLAS API calls if their runtime duration exceeds the 80,000-nanosecond (ns) threshold.
The call stack appears as follows:

7. Memory usage tracking
7.1 PPU memory usage tracking
asys can track your application's device memory usage. It collects call stack information for device memory allocation and deallocation, and aggregates this data to generate usage statistics. To enable this feature, use the --hggc-memory-usage option. For example:
asys profile -t hggc --hggc-memory-usage true python test_linear.py
When memory usage tracking is enabled, Asight Systems displays PPU memory usage on the timeline, which lets you analyze memory consumption, as shown in the following figure:

The Device memory usage row displays the PPU memory usage of your application over time. Its features include:
-
Shows the correlation with HGGC APIs.
-
Shows call stacks.
-
Shows memory allocation and deallocation events in the
Events view.
When a PPU memory allocation fails, it appears as a small red dot in the Device memory usage row:

In the Device memory view, you can view the Top down, Bottom up, and Flat tables.
Tips:
-
Use the
--hggc-backtrace-depthoption to control the call stack collection depth. The default depth is 24 frames. For example,--hggc-backtrace-depth 50specifies a maximum depth of 50 frames. -
Device memory freed by the HGGC destructor during process teardown is not collected by this feature.
7.1.1 Memory timeline
To display the memory timeline, expand the Device memory usage row or click the Toggle memory timeline details button on the right, as shown in the following figure:

The figure shows the details of each memory allocation, including its allocation and deallocation times. Very small memory allocations are merged and displayed at the top.
In addition to the normal mode, two other modes are available: group mode and group coloring mode.
Group mode
This mode groups memory allocations by module, such as a PyTorch module or a communication library module. This lets you view the memory usage of a specific module, as shown in the following figure:

Click the button to the right of the mode selection drop-down to open the Grouping Rules dialog and configure the grouping rules:

Grouping rules are applied from top to bottom. Each memory allocation can belong to only one group. Click a color block to change the group's color.
Group coloring mode
This mode combines the normal and group modes. Each memory allocation is displayed individually, but its color matches the group it belongs to, as shown in the following figure:

7.2 Host memory usage sampling
To periodically sample your application's host memory usage, enable the --host-memory-sampling option. You can control the sampling frequency with the --host-memory-sampling-frequency option. For example:
asys profile -t hggc --host-memory-sampling true --host-memory-sampling-frequency 500 python test_linear.py
When you sample a process's host memory, the Asight Systems UI shows how the memory usage for each process changes over time:

Two types of memory usage can be displayed:
-
Resident set size: The actual physical memory usage.
-
Water mark: The peak physical memory usage during the collection period.
Tips: asys collects host memory usage for the application's process tree (the root process and its descendants). Enabling system-wide tracing (-s system-wide) disables host memory sampling.
7.3 Heap memory usage tracking
asys can track your application's usage of heap memory (dynamically allocated memory on the CPU side), such as memory allocated via malloc or new. It collects call stack information for these allocations and aggregates the data to provide usage statistics. To enable heap memory tracking, use the --heap-memory-usage option. For example:
asys profile --heap-memory-usage true python test_linear.py
By tracking heap memory usage, you can use the Asight Systems GUI to view how the heap memory usage of each process changes over time:

Click a point on the Heap memory usage timeline to view a flame graph, icicle graph, and other heap memory usage data up to that point. This helps with memory leak analysis and provides statistics on memory usage and allocation counts. For example:

Tips: To analyze a specific time range, use Filter and Zoom in to select the range. Then, click a point on the Heap memory usage timeline to view memory usage statistics for the period from the start of your selection to that point. This can help you identify a memory leak within that time range.
Use the --heap-sampling-interval-bytes option to adjust the average sampling interval (in bytes) for heap memory tracking. A smaller interval increases the accuracy of tracking smaller allocations but also significantly increases tracing overhead.
Use the --heap-backtrace-depth option to adjust the call stack collection depth, and use the --heap-report-interval option to adjust the aggregation interval for usage information. For example:
asys profile --heap-memory-usage true --heap-sampling-interval-bytes 16777216 --heap-backtrace-depth 50 --heap-report-interval 2 python test_linear.py
-
--heap-memory-usage true: Enables heap memory usage tracking. -
--heap-sampling-interval-bytes 16777216: Sets theaverage sampling intervalto 16 MiB. -
--heap-report-interval 2: Sets the interval for aggregating and recording heap memory usage information to2 ms.
Tips:
-
When you use the
--heap-sampling-interval-bytesoption, asys may merge reports for allocations smaller than the specifiedaverage sampling intervalto reduce tracing overhead. -
Setting
--heap-sampling-interval-bytes=1makes asys track every single allocation. This significantly increases performance overhead and is not recommended for complex applications. -
When multi-node tracing is enabled with
--multi-node-mode, heap memory tracking is not supported.
7.4 Pinned memory usage analysis
asys tracks your application's usage of pinned memory. It collects call stack information for pinned memory allocation and deallocation and provides aggregated usage statistics. This feature is enabled by default when both device memory tracking (--hggc-memory-usage) and host memory sampling (--host-memory-sampling) are enabled. For example:
asys profile -t hggc --hggc-memory-usage true --host-memory-sampling true python test_linear.py
By collecting pinned memory usage data, you can use the Asight Systems GUI to view how pinned memory usage for each process changes over time. You can also view aggregated pinned memory usage statistics for each API in your application, as shown in the figure:

The figure above shows how pinned memory usage changes over time. The tooltip displays details about each memory change, including allocation/deallocation information and the corresponding call stack. Pinned memory events also appear in the Events view. The Host pinned memory view provides flame graphs, icicle graphs, and the Top down, Bottom up, and Flat tables.
Tips:
-
Use the
--hggc-backtrace-depthoption to control the call stack collection depth. The default depth is 24 frames. For example,--hggc-backtrace-depth 50specifies a maximum depth of 50 frames. -
Supports collecting both device and pinned memory usage, where multiple options are separated by a comma
,, for example,--hggc-memory-usage device,pinned. -
Pinned memory freed by the HGGC destructor during process teardown is not collected by this feature.
8. Python tracing
8.1 Collect Python call stacks
8.1.1 Periodic sampling (Python sampling)
asys periodically samples Python script call stacks at runtime, gathering function names, filenames, and line numbers, and displays this information in the Asight Systems GUI:

Use the --python-sampling option to enable periodic sampling of Python backtraces and --python-sampling-frequency to control the sampling frequency. For example:
asys profile --python-sampling true --python-sampling-frequency 1000 python launch.py
-
--python-sampling true: Enables periodic sampling of Python backtraces. -
--python-sampling-frequency 1000: Controls the sampling frequency, with a range of 1 Hz to 1 kHz. The default value is 500 samples per second (500 Hz). -
--python-backtrace-depth: Specifies the call stack depth for Python sampling. The default value is 24.
8.1.2 Backtrace on event (Python backtrace)
asys can capture the current Python call stack when tracing a specific event. Combining this with the C call stack displays the complete call chain.

Enable this feature with --python-backtrace=hggc and control the call stack depth with --python-backtrace-depth. Currently, you can capture Python backtraces for the following events:
-
hggc
For example:
asys profile --python-backtrace=hggc python launch.py -
device memory / pinned memory
For example:
asys profile --hggc-memory-usage=true --host-memory-sampling=true --python-backtrace=hggc python launch.py
Note:
-
asys Python call stack collection currently supports only Python 3.8 to 3.12.
-
Python call stack collection is not supported for applications launched with an aliased Python interpreter (i.e., an executable not named python or python3).
8.2 Trace Python functions (Python function tracing)
asys can trace the execution of Python functions without source code modification, displaying the traces as HGTX ranges:

Use the --python-functions-trace option to specify functions to trace using different modes, as described below:
|
Parameter |
Description |
|
none |
Default value. No functions are traced. |
|
all |
Traces all functions in the Python script. |
|
module:<module_name> |
Traces all functions in the specified module. You can specify a parent module. Separate multiple modules with a comma, for example: |
|
<json_file> |
Traces functions specified in a JSON file. |
Use --python-functions-threshold to set a minimum runtime threshold for tracing functions. The threshold is specified in nanoseconds (ns), and the default value is 80,000.
You can specify functions via a JSON file in the following ways:
-
Specify only the module to trace all functions within it. This also traces functions in its sub-modules. For example, if you specify 'torch', all functions under 'torch.nn' are also traced.
[ { "module": "torch.nn.functional" }, { "module": "threading" } ] -
Specify a module (using its full hierarchical name) and a list of function names under the "functions" key. You can also define a custom domain (the default value is 'Python Hgtx').
[ { "module": "torch.nn.functional", "domain": "Torch Domain", "functions": ["sigmoid","log_softmax"] } ] -
Within a function list for a specified module, you can override properties for individual functions. If you specify a
modulefor a function, it overrides the parent module. If you specify adomain, the function appears in multiple domains.[ { "module": "torch.nn.functional", "domain": "Parent Domain", "functions": ["sigmoid", {"function": "Adadelta.step", "module": "torch.optim.adadelta", "domain": "Child Domain"}] } ]
You can combine the JSON specification methods described above. In case of a conflict, the last specification takes precedence.
For example, to trace all functions in the torch module and set the runtime threshold to 1,000 ns:
asys profile --python-functions-trace module:torch --python-functions-threshold 1000 python xx.py
Note:
-
asys Python function tracing supports Python 3.8 and later.
-
In multi-threaded scenarios, tracing of a child thread may be delayed after its creation.
-
Specifying functions within the
__main__module is not supported. -
Function tracing may be inaccurate around an application fork.
9. PCCL activity tracking
asys collects PCCL activity events to monitor PCCL activity. Enable this collection with the -t pccl option. For example:
asys profile -t pccl hggc python test_pccl.py
The following figure shows the timeline:

The PCCL timeline groups events by channel, and then by pipeline.
10. RDMA network card runtime metrics tracking
asys periodically collects runtime metrics from RDMA network cards, such as bytes sent and received, packet sizes, and congestion control information. The Asight Systems GUI visualizes these metrics over time:

The following metrics can be displayed:
-
network receive speed
-
network send speed
-
network receive packet size
-
network send packet size
-
network receive CNP rate
-
network send CNP rate
-
Send Wait
When you select a time range, the tooltip displays the average network transfer speed for that range, as shown in the following figure:

To enable NIC metrics collection, use the --nic-metrics option. asys then collects runtime metrics from all NIC devices and displays the data for active devices in the GUI. For example:
asys profile --nic-metrics true ./all_reduce_perf
-
--nic-metrics true: Enables NIC metrics collection.
Use the --nic-device-include option to specify a comma-separated list of regular expressions for filtering NIC devices by name. asys collects data from a NIC device if its name matches any of the specified expressions. For example:
asys profile --nic-metrics true --nic-device-include "bond" ./all_reduce_perf
-
--nic-device-include "bond": Collects metrics from NIC devices whose names contain "bond".
asys profile --nic-metrics true --nic-device-include "bond,eth" ./all_reduce_perf
-
--nic-device-include "bond,eth": Collects metrics from NIC devices whose names contain "bond" or "eth".
Use the --nic-metrics-frequency option to control the sampling frequency. The frequency can range from 1 Hz to 100 kHz, and the default is 1 kHz.
asys profile --nic-metrics true --nic-metrics-frequency 10000 ./all_reduce_perf
Note:
-
Due to RDMA driver interface limitations, the actual sampling frequency might be lower than the configured rate. If you set a frequency higher than the maximum supported rate, collection will run at the highest possible rate.
-
Start your Docker container with the
--network host --device=/dev/infinibandoptions.




