App Running

The sample procedure applies to the following products:

  • Atlas inference products
  • Atlas training products
  • Atlas A2 training products/Atlas A2 inference products
  • Atlas A3 training products/Atlas A3 inference products

Model Conversion

  1. Log in to the development environment as the HwHiAiUser user (running user) and deploy the test case.
  2. Obtain the ATC tool and set environment variables by referring to ATC Instructions.
  3. Run the following command in the acl_operator_add/test_data path to generate a single-operator model file. Ascendxxx indicates the Ascend AI Processor version. Replace it with the actual one.
    atc --singleop=config/add_op.json --soc_version=Ascendxxx --output=op_models
    • --output: specifies the directory for storing the generated .om file, that is, the ./op_models directory.
    • Before running the atc command, ensure that you have the write permission on the acl_operator_add/test_data directory.
    • To query the soc_version parameter, perform the following steps:
      • Products except for Atlas A3 training products/Atlas A3 inference products: Run the npu-smi info command on the server where Ascend AI Processor is installed to obtain the Chip Name information. The actual value is AscendChip Name. For example, if Chip Name is xxxyy, the actual value is Ascendxxxyy.
      • Atlas A3 training products/Atlas A3 inference products: Run the npu-smi info -t board -i id -c chip_id command on the server where Ascend AI Processor is installed to obtain the Chip Name and NPU Name information. The actual value is Chip Name_NPU Name. For example, if the value of Chip Name is Ascend910 and the value of NPU Name is 1234, the actual value is Ascend910_1234.

        Note that:

        • id: device ID, which is the NPU ID obtained by running the npu-smi info -l command.
        • chip_id: chip ID, which is obtained by running the npu-smi info -m command.

    After the model conversion is successful, the following file is generated:

    The single-operator model file 0_Add_3_2_8_16_3_2_8_16_3_2_8_16.om is generated in the op_models directory of the current directory.

    The operator model file is named in the format of No. + opType + input description (dataType_format_shape) + output description.

  4. As the HwHiAiUser running user, upload the sample directory in the development environment to the operating environment.

App Running

  1. Log in to the operating environment.
  2. Configure the operating environment by referring to Environment Variable Configuration.
  3. Run the following command in acl_operator_add/test_data:
    python3 ../src/acl_execute_add.py
  4. Check the execution result. You should find the following information upon execution success:
    factor_a:
    [[85 19 20 27 74 27 47 73 69 82 81 78 25 45  1 84]
     [46 52 93 42  7 69 38 68 68 57 58 64 53 14 55 95]
     [35 87 81 50  5  8 97 58 14 18 92 91 97 86 91 11]
     [35 71 23  0 74 66  2 80 74 44 20 53 70 67 67 56]
     [ 6 52  5 66  9 86  8 14 60 65 16 80 82 56 90 59]
     [50 24 79 53 13 94  6 46 46 68 39 76 56 56  9 28]
     [92  7 67 43 39 20  2 52 17  5 46  0  6 98 31 25]
     [ 8 37 45 29 23 19 35 25 90 71 70 15 90 55 15 29]]
    factor_b:
    [[29  9 73 35 34  5 52 22 74 84 11 85 73 68 70 59]
     [57 73 78 90 75 46 28  4 69 81  2 15  9 21 76  7]
     [90 59 81 57 80 33 92 98 15 86 98 22  9 25 35 70]
     [94 54 15 65  2 62 32 55 32 91  3 38 96 51 24 86]
     [96 84 33 32 86 61 24 66 47 80 76  4 86 29 39 20]
     [48 97 68  4 42 19 60 43 72  0 68 65 80 43 38 54]
     [83 10 54 90 60 35 84 22 22  5 70 67 79 78 45 41]
     [51 19 66 74  4 72 54 23 32 42  9 49 93 52 50 83]]
    init resource stage:
    init resource success
    gen input data stage:
    gen input data success
    gen output data stage:
    gen output data success
    execute stage:
    execute success
    get operator result stage:
    shape: (8, 16)
    ACL output:
     [[114  28  93  62 108  32  99  95 143 166  92 163  98 113  71 143]
     [103 125 171 132  82 115  66  72 137 138  60  79  62  35 131 102]
     [125 146 162 107  85  41 189 156  29 104 190 113 106 111 126  81]
     [129 125  38  65  76 128  34 135 106 135  23  91 166 118  91 142]
     [102 136  38  98  95 147  32  80 107 145  92  84 168  85 129  79]
     [ 98 121 147  57  55 113  66  89 118  68 107 141 136  99  47  82]
     [175  17 121 133  99  55  86  74  39  10 116  67  85 176  76  66]
     [ 59  56 111 103  27  91  89  48 122 113  79  64 183 107  65 112]]
    get operator result success
    release source stage:
    release source success