Using MindStudio to Develop Ascend Operators
Background
MindStudio is an IntelliJ-based development toolchain platform that provides application development and debugging and model conversion tools. It also supports network porting, optimization, and profiling, facilitating application development.
MindStudio provides an IDE for TBE- and AI CPU-based operator programming and development, facilitating operator porting on different platforms and accelerating the adaptation to the Ascend AI Processor.
ModelArts has integrated notebook instances based on MindStudio images. You can use MindStudio to develop operators on ModelArts.
For more information about MindStudio, see MindStudio Documentation.
Prerequisites
- A notebook instance based on MindStudio is available with whitelist configured for remote access. The notebook instance must be in the Running state. For details, see Creating a Notebook Instance.
Figure 1 Creating a notebook instance based on MindStudio
- The address such as dev-modelarts-cnnorth4.huaweicloud.com and port number of the development environment are available. To obtain this information, go to the notebook instance details page.
Figure 2 Instance details page
- The key pair is available. A key pair is automatically downloaded after you create it. Securely store your key pair. If an existing key pair is lost, create a new one. You can create a key pair on the Create Notebook page.
Using MobaXterm to Connect to and Open the MindStudio Environment
The procedure is as follows:
- Download MobaXterm and install it. There is no requirement on the version.
- Open MobaXterm and click Sessions. In the Session settings window, configure SSH and click OK to connect to the notebook instance environment.
Figure 3 Configuring SSH in MobaXterm
- Remote host: address for accessing a notebook instance. Obtain the address on the page providing detailed information of the target notebook instance. For example, dev-modelarts-cnnorth4.huaweicloud.com.
- Port: port number for accessing a notebook instance. Obtain the port number on the page providing detailed information of the target notebook instance.
- Specify username: ma-user
- Use private key: key pair file created and saved during notebook instance creation
If you fail to remotely connect to a notebook instance using MobaXterm, check whether the notebook instance is in the Running status or the whitelist for remote access is correctly configured.
- After connecting to the notebook instance using MobaXterm, run the following command to open MindStudio:
sh MindStudio/bin/MindStudio.sh
Figure 4 Connecting to a notebook instance
- In the window shown in Figure 5, retain the default settings and click OK.
- Click
on the right of CANN-Toolkit Path and select the latest version of ascend-toolkit. In this example, the version is /home/ma-user/Ascend/ascend-toolkit/5.0.2.1. ascend-toolkit is continuously upgraded. This version number is only an example.
Figure 6 Selecting ascend-toolkit
- Click Finish. On the MindStudio project creation page, click New Project to create a project.
Figure 7 Selecting ascend-toolkit
- On the Create Ascend Operator Project page, set Project Location to /home/ma-user/work.
Figure 8 Creating an Ascend operator project
It is a good practice to use /home/ma-user/work for storing project files.
This directory is persistent. After a notebook instance is stopped, the content in this directory is not lost.
- Click Next and configure the project by referring to Creating an Operator Project.
- Select the /home/ma-user/work directory and click Save.
Figure 9 Saving the project files
- Click Finish. The operator project is created.
Figure 10 Project creation completed
- Before operator development, set the Python library on which the operator project depends by referring to Setting the Python Library.
For more information about MindStudio, see MindStudio User Guide.
Backing Up Files Before Stopping a Notebook Instance
After a notebook instance is stopped, the corresponding container environment is deleted. Only the content in the /home/ma-user/work directory is persistently stored. Modifications in other directories are lost.
Backup method
Copy the files to the /home/ma-user/work directory before stopping a notebook instance.
The files to be copied are as follows:
- Self-built projects in the /home/ma-user/ AscendProjects directory
- OM file, configuration file, and evaluation report in the /home/ma-user/modelzoo/ directory after model conversion
- SSH configuration in the /home/ma-user/.mindstudio directory
- Other modified content
After a notebook instance is restarted, copy the above files to the original directory so that the instance can run properly.
Last Article: MindStudio
Next Article: ModelArts CLI Command Reference

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.