[object Object][object Object][object Object]

msMemScope collects memory events and conducts memory leak detection, memory comparison, memory block monitoring, memory usage breakdown, and inefficient memory identification based on the collected events. This document describes how to use msMemScope and its functions through a simple PyTorch script.

[object Object]

For details, .

[object Object]
  1. Set environment variables.

    1. Run the following command as the CANN running user to configure environment variables.

      [object Object]

      Note: [object Object] is the CANN installation directory.

    2. Run the following command to configure environment variables when using msMemScope to collect memory data.

      [object Object]

      Note: [object Object] is the msMemScope installation directory.

    3. Run the following commands to set environment variables to use msMemScope's Python APIs. You are advised to add the following commands to the environment variable setting script.

      [object Object]
  2. Access the repository and then run the following command to go to the [object Object] directory in the repository.

    [object Object]

    In the [object Object] directory, the following code examples are provided:

    • Python:
    • CLI:
  3. Use msMemScope in either of the following ways. Python APIs are recommended.

    • Python APIs

      The [object Object], [object Object], [object Object], and [object Object] APIs are provided.

      [object Object]undefined

      Run the following command to execute the script:

      [object Object]
    • CLI: Run the following command to execute the script using msMemScope:

      [object Object]

    For more information about tool parameters, see .

  4. Check the output result file.

    For details about the output file and memory analysis, see and .