Latency Test

Function

The latency test is used to test the latency of CPU and NPU links.

Test Procedure

If you want to test the SuperPoD P2P latency using MPI, install and configure MPI in the environment in advance by referring to Installing and Configuring the MPI in CANN HCCL Performance Tester and configure the environment variables by referring to Compilation in CANN HCCL Performance Tester. Note that only Open MPI 4.1.5 is supported. Do not use parameters, configurations, and environment variables that are not mentioned in the description and examples. For details about other Open MPI execution parameters, environment variables, and configuration files, see Open MPI documentation.

Ensure that the entered IP address is valid.

Parameters

You can run either of the following commands to list the parameters of the latency test command:

ascend-dmi -l -h

ascend-dmi --latency --help

Table 1 lists only a test-specific parameter. For details about other common parameters, see Common Parameters.

Table 1 Parameters

Parameter

Description

Mandatory

Restrictions

[-l, --latency]

Measures the chip latency.

Yes

-

[-t, --type]

Specifies the data flows to be tested.

Data flows can be divided into the following directions for the latency test: If no data flow direction is specified, the latency test results for both the h2d and d2h directions will be returned by default.

  • h2d: measures the latency of transferring data from the host-side memory to the device-side memory via the PCIe bus.
  • d2h: measures the latency of transferring data from the device-side memory to the host-side memory via the PCIe bus.
  • p2p: measures the latency from the source device to the destination device.
  • Ascend 950PR and 950DT products: Yes
  • Other products: No
  • The Ascend 950PR and 950DT products supports only p2p.
  • For the Atlas 350 accelerator card, if --memory-semantics is specified as UBMemory, the P2P latency test of the PCIe link is not supported.

[-s, --size]

Size of the data to be transferred. The default value is 512 bytes. The value range of the data to be transferred is as follows:

  • Ascend 950PR and 950DT products: 512 to 131072 bytes
  • Other products: 512 bytes to 1 MB (1024 x 1024 bytes)

It is recommended to specify a size that is a power of 2 based on 512 (e.g., 512, 1024, 2048, 4096, etc.). If the specified size is not a power of 2 based on 512, the size used during the actual test will automatically be rounded up to the closest power of 2 of 512.

No

-

[-d, --device]

Specifies the device ID for the latency test. The device ID refers to the logical ID of the Ascend AI processor.

  • If a device ID is specified, the latency test result of the corresponding device ID is returned by default.
  • If no device ID is specified, the latency test result of device 0 is returned by default.
  • This parameter cannot be specified together with [-ds, --ds, --device-src] and [-dd, --dd, --device-dst].

No

The Ascend 950PR and 950DT products does not support this parameter currently.

[-ds, --ds, --device-src]

Specifies the ID of the source device for the P2P latency test. This parameter must be specified together with [-dd, --dd, --device-dst].

If this parameter is not specified:

  • If [-sp, --sp, --super-pod] is specified, the SuperPoD latency test result from device 0 to device 0 is returned by default.
  • If [-sp, --sp, --super-pod] is not specified, the intra-node P2P latency test results of all devices are returned by default.

No

-

[-dd, --dd, --device-dst]

Specifies the ID of the destination device for the P2P latency test. This parameter must be specified together with [-ds, --ds, --device-src].

If this parameter is not specified:

  • If [-sp, --sp, --super-pod] is specified, the SuperPoD latency test result from device 0 to device 0 is returned by default.
  • If [-sp, --sp, --super-pod] is not specified, the intra-node P2P latency test results of all devices are returned by default.

No

-

[-sp, --sp, --super-pod]

If this parameter is specified, the SuperPoD latency test is performed. This parameter can be used only when [-t, --type] is set to p2p.

No

The Ascend 950PR and 950DT products do not support this parameter currently.

[-ms, --ms, --memory-semantics]

Specifies the transfer semantics. The value can be URMA or UBMemory. If this parameter is not specified, the default value UBMemory is used.

No

  • This parameter is supported only by the Ascend 950PR and 950DT products in P2P mode.
  • For the Atlas 350 accelerator card, -ms cannot be set to URMA.

Note:

  • In this document, the input or output device ID is the logic ID.
  • You can run the npu-smi info -m command to obtain the logic ID by viewing the value of Chip Logic ID on the GUI. The NPU ID is the physical chip ID.

Examples

The table below describes the parameters in the preceding command output.

Table 2 Parameters of the command output in normal format

Parameter

Description

Device Id

ID of the device under test. In the preceding command output, 0 indicates the latency of device 0. 0 -> 1 indicates the intra-node/SuperPoD P2P latency of the source device whose ID is 0 and the destination device whose ID is 1.

Data Size

Size of data to be transmitted, in byte.

Device to Host Latency

Direction of the latency data flow, in ns.

Host to Device Latency

Peer to Peer Latency

SuperPoD Peer to Peer Latency

Table 3 Parameters of the command output in JSON format

Parameter

Description

device_id

ID of the device under test. In the preceding command output, 0 indicates the latency of device 0.

src_device_id

ID of the source device under test.

dst_device_id

ID of the destination device under test.

latency

Latency test result, in ns.

size

Size of data to be transmitted, in byte.

type

Data flow direction of the latency test.