Creating an Application Project

Creating a Template Project

  1. Navigate to the project creation window.
    • On the MindStudio IDE welcome page, choose Projects from the left menu and click New Project on the right.
      Figure 1 Project creation page
    • On the MindStudio IDE project page, click in the upper left corner of the project page. On the menu bar, choose File > New > Project...
  2. In the New Project window, select Ascend App and specify the project type. See Figure 2. Then click Next to enter the project configuration page. (If the project type name is not completely displayed, hover the cursor on the name to display the complete name.)

    CANN Version: indicates the activated CANN version. You can click Change on the right to change the CANN version. For details, see Switching/Activating a CANN Package.

    AscendCL Project is an empty project of AscendCL, containing only the development framework but no specific code logic.

    If CANN is not configured in MindStudio IDE, some application projects may not be properly displayed.

    Figure 2 AscendCL application project
  3. Access the project configuration page and set project parameters listed in Table 1.
    Table 1 Project parameters

    Parameter

    Description

    Project name

    Project name (user-defined).

    The name contains a maximum of 64 characters and must start and end with a digit or letter. Only letters, digits, hyphens (-), and underscores (_) are allowed.

    Project location

    Default path for saving a project (user-defined). (For users who use MindStudio IDE for the first time, the default value is $HOME/MindstudioProjects)

    More Settings

    Module name: module name, the same as the Project name.

    Content root: path in the root directory.

    Module file location: module file path.

    Click the check box on the right of Project format. A drop-down list is displayed.
    • .idea (directory-based) (default option): During project creation, an .idea option is created to save the project information.
    • .ipr (file-based): project configuration file used to save the project configuration information.
  4. Click Create. A project is created. The directory of a created project is organized as follows (for reference only).
    • AscendCL Project (C/C++):
      ├── Project name
      │   ├── build
      │   │    ├──cmake            // Directory of CMake dependencies.
      │   ├── out                    // Directory of executable files generated after build.
      │   ├── src
      │   │    ├── CMakeLists.txt   // Build script.
      │   │    ├── main.cpp         // Implementation file of the main function, which does not have code logic.
      │   ├── CMakeLists.txt        // Build script that calls the CMakeLists file in the src directory.
    • AscendCL Project (Python): No code directory is available.

Importing an Application Project

  1. You can import a project file in either of the following ways:
    • On the MindStudio IDE welcome page, click Open, select the project to be imported, and click OK.
    • In the upper left corner of the MindStudio IDE project page, click the menu bar, choose File > Open... from the top menu bar or click on the toolbar, and select an existing project to open it.

      If a project has code risks, the trust window is displayed when you open the project.

      • If the project source code is trusted and secure, click Trust Project. (You can select Trust projects in <workspace_directory> to trust all projects in the directory.)
      • If the project is not trusted and you only want to view the source code, click Preview in Safe Mode to preview the project in safe mode.
      • To cancel opening the project, click Don't Open.
  2. If there is already an active project in the window, a confirmation message is displayed.
    • Click This Window to open the newly created project in the current window.
    • Click New Window to open the newly created project in a new window.
  3. After a project is imported, the project directory is displayed in a tree structure (subject to the actual result).