Collecting Host-side System Data

Function

msprof supports the profiling of host-side system data, including the CPU usage, memory usage, disk I/O usage, and network I/O usage. After the collection, it automatically parses the profile data and flush corresponding files to disks.

Command Format

You can collect host-side system data when profiling running AI tasks.

msprof [options] <app>
You can also collect host-side system data when profiling AI processor system data.
msprof --output=<path> --sys-devices=<ID> --sys-period=<period> [options]

Command-line Options

Table 1 Command-line options

Option

Optional/Required

Description

--host-sys

Either --host-sys or --host-sys-usage must be specified.

Profiling of the system on the host side. The value can be cpu, mem, disk, network, or osrt. If multiple values are selected, separate them with commas (,). To set this option, you must set host-sys-pid or pass a user application. The values are described as follows:

  • cpu: process CPU usage
  • mem: process memory usage
  • disk: process disk I/O usage
  • network: network I/O usage
  • osrt: process syscall and pthreadcall

Example: --host-sys=cpu,mem,disk,network

NOTE:
  • To collect host-side disk profile data, install the third-party open-source tool iotop. To collect osrt profile data, install the third-party open-source tools perf and ltrace. For details about how to install the tools, see Installing perf, iotop, and ltrace. After the installation is complete, refer to Configuring User Permissions to configure user permissions. You need to reconfigure the permissions each time you reinstall the CANN software package.
  • Using ltrace to collect the osrt profile data may cause high CPU usage. In addition, using this tool is related to the application's pthread locking and unlocking, which may affect the process running speed.
  • Kylin V10 SP1 of the x86_64 architecture supports the --host-sys=osrt option, while Kylin V10 SP1 of the AArch64 architecture does not.
  • The --host-sys=network option is not supported in the virtualization environment of EulerOS 2.9.

--host-sys-usage

Either --host-sys or --host-sys-usage must be specified.

Profiling of the system and all processes on the host side. The value can be cpu or mem, or a combination of them. If multiple values are selected, separate them with commas (,). If the host-sys-pid option is also configured, the CPU or memory usage of a specified process on the host is collected. The values are described as follows:

  • cpu: CPU usage of the system and all processes.
  • mem: memory usage of the system and all processes.

Example: --host-sys-usage=cpu,mem

--host-sys-pid

Optional

PID of the host application to profile.

This option does not need to be set in collection depending on AI job runtime Profiling.

--host-sys-usage-freq

Optional

CPU and memory usage profiling frequency (Hz). The value defaults to 50 and must be in the range [1, 50].

Example

Log in to the operating environment and run the following command in any directory:
msprof --output=/home/projects/output --host-sys=cpu /home/projects/MyApp/out/main

Or:

msprof --output=/home/projects/output --sys-devices=<ID> --sys-period=<period> --sys-hardware-mem=on --host-sys-pid=<pid> --host-sys=cpu

Find the PROF_XXX directory generated in the directory specified by --output to store the automatically parsed profile data. For details about the result files, see Table 1.