Installing, Uninstalling, and Upgrading FeatureRetrieval

  • You are advised to install and run the package as a common user. The MindX SDK depends on the dynamic library of the user with low-level permission for the CANN package. When the root user is used to run programs, the dynamic library with links may be tampered with by the low-permission user.
  • Currently, FeatureRetrieval is designed and released based on the open form. The HDC communication mechanism in the open form is controlled by the HwHiAiUser user group. The abuse of the HwHiAiUser user group permission may cause the feature retrieval service to be unavailable or information to be disclosed.
  • The security risks brought by malicious tampering and attacks on the open-form file system, including the HDC communication mechanism, are not within the security risk scope managed by Huawei. Before installing and using the software, ensure that you have known the preceding information.
  • Events are recorded in the $HOME/log/mxIndex/deployment.log log file during installation, upgrade, or uninstallation.

FeatureRetrieval is released as a binary shared library, which can be installed through the RUN package in the path defined by a local user. For details, see the following.

Installing FeatureRetrieval

The currently supported Ascend hardware platforms are the Ascend 310 AI Processor and Atlas inference products.

  1. Log in to the installation environment as the installation user of the software package.
  2. Upload the software package to any directory (for example, /home/package) in the installation environment and go to the directory where the package is stored.
  3. Grant the execute permission on the software package.
    chmod +x Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run
  4. Check the consistency and integrity of the software package.
    ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --check

    If the following information is displayed, the software package has passed the verification:

    Verifying archive integrity...  100%   SHA256 checksums are OK. All good.    
  5. Create an installation path for the software package.
    • If you need to specify the installation path, create it first. The installation path /home/work/FeatureRetrieval is used as an example.
      mkdir -p /home/work/FeatureRetrieval
    • If you do not specify an installation path, the software is installed in the path where the software package is located by default.
  6. Install the software package. Ensure that the entire installation process is performed by the root user and only the root user is allowed to access the installation and decompression paths.
    • Installation path specified: The installation path /home/work/FeatureRetrieval is used as an example.
      • For the Ascend 310 AI Processor:
        ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --install --install-path=/home/work/FeatureRetrieval --platform=310
      • For the Atlas inference products:
        ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --install --install-path=/home/work/FeatureRetrieval --platform=310P
    • Installation path not specified: Use the path where the software package is located.
      • For the Ascend 310 AI Processor:
        ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --install --platform=310
      • For the Atlas inference products:
        ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --install --platform=310P
    After the installation is complete, the mxIndex-{version} directory is generated. If the following information is displayed, the software has been installed:
    Uncompressing ASCEND MXINDEX RUN PACKAGE  100%   

    For details about the parameters in the installation command, see Table 1.

    Table 1 Parameter description

    Parameter

    Description

    --help | -h

    Queries help information.

    --check

    Queries the integrity of the software package.

    --install

    Installs mxIndex in the current directory.

    --install-path=<path>

    Sets the custom installation directory for mxIndex.

    --version

    Queries the version of the mxIndex installation package.

    --upgrade

    Upgrades mxIndex to the target version.

    --platform

    Specifies the NPU type. The value can be 310 (default) or 310P, indicating the Ascend 310 AI Processor and Atlas inference products, respectively.

  7. Install FeatureRetrieval.
    1. Go to the installation directory mxIndex-{version}.
      cd mxIndex-{version}
    2. Go to the ops directory and set the ASCEND_HOME and ASCEND_VERSION environment variables before building operators. The default values are /usr/local/Ascend and ascend-toolkit/latest, respectively.
      export ASCEND_HOME=/usr/local/Ascend          # Ascend home path
      export ASCEND_VERSION=ascend-toolkit/latest   # atc/opp/toolkit installation path
      export ASCEND_OPP_PATH=/usr/local/Ascend/ascend-toolkit/latest/opp # opp installation path
      • ASCEND_HOME indicates the path of components such as driver/ascend-toolkit.
      • ASCEND_VERSION indicates the current Ascend version. If the installation path of the ATC tool is /usr/local/Ascend/ascend-toolkit/latest, you do not need to set ASCEND_HOME and ASCEND_VERSION. In addition, you must have the write permission on the ASCEND_OPP_PATH directory.
    3. Run the script based on the actual system architecture.
      • Run custom_opp_aarch64.run for the ARM architecture.
      • Run custom_opp_x86_64.run for the x86_64 architecture.
      ./custom_opp_{arch}.run
    4. Go to the tools directory and build operators. For details about how to build customized operators, see Custom Operator.
      • For the Ascend 310 AI Processor:
        cd ../tools && python3 run_generate_model.py
      • For the Atlas inference products:
        cd ../tools && python3 run_generate_model.py -t 310P
    5. Move the operator model file to the modelpath directory in the source directory. (Ensure that the generated operator OM file is not tampered with.)
      mv op_models/* ../modelpath
    6. Deploy the environment. (The install.sh script must be executed by the root user. Ensure that all files in the mxIndex installation directory are not tampered with.)
      • For the Ascend 310 AI Processor, <driver-untar-path> is the directory generated after the Ascend310-driver-{software version}-minios.aarch64-src.tar.gz file is decompressed.
        cd .. && bash install.sh -d <driver-untar-path>
      • For the Atlas inference products, <driver-untar-path> is the directory generated after the Ascend310P-driver-{software version}-minios.aarch64-src.tar.gz file is decompressed.
        cd .. && bash install.sh -d <driver-untar-path> -t 310P

        For the Atlas inference products, secure boot is also required.

        • The install.sh script encapsulates the steps in File System Customization > Packing the File System > Deploying the Modified File System in the CANN Software Installation (Open Form, Atlas inference products). After the script is executed, the Ascend310P.cpio.gz file is generated in the current path (for example, /usr/local/filesys_modify). (Use the actual file name.)
        • After the script is executed, continue the operations by referring to "Preprocess the file system image before signing it" to complete the secure boot function of the Atlas 300I Pro inference card.
    7. Reboot FeatureRetrieval.
      reboot

Uninstalling FeatureRetrieval

  1. Go to the installation directory mxIndex-{version}.
    cd mxIndex-{version}
  2. Go to the script directory.
    cd script
  3. Grant the execute permission on the uninstall.sh file and execute it for uninstallation.
    chmod +x uninstall.sh
    ./uninstall.sh

Upgrading FeatureRetrieval

To upgrade FeatureRetrieval, run the following command:

  • For the Ascend 310 AI Processor:
    ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --upgrade --platform=310
  • For the Atlas inference products:
    ./Ascend-mindxsdk-mxindex_{version}_linux-{arch}.run --upgrade --platform=310P