In the Windows Scenario
If the local Windows time is later than the time of the remote compilation environment, adjust the time to make them consistent. Then, choose on the toolbar to perform incremental build.
Building an Application Project
- If the new application project is of the Python version, you do not need to build the project. In this case, the Build function on the MindStudio project page cannot be used.
- During remote build, the project folder is copied to the remote environment, excluding the dump, model, and profiling directories in it.
- Before build, confirm the environment variables in the set_env.cmake file under the project directory and replace the installation path of the CANN package.
- (Optional) Modify the src/CMakeLists.txt file in the project directory.
- include_directories: Add the directories of the header files to be included.
The following is an example:
include_directories( directoryPath1 directoryPath2 )
- link_directories: Add the directories of the library files to be linked with.
The following is an example:
link_directories( directoryPath3 directoryPath4 )
- add_executable: Add the directory of the .cpp file.
The following is an example:
add_executable( main directoryPath5 directoryPath6 )
- target_link_libraries: Add the library files on which application build depends.
The following is an example:
target_link_libraries( main ascendcl libName1 libName2)
- install: Install the build output main to a specified path.
The following is an example:
install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
- include_directories: Add the directories of the header files to be included.
- (Optional) Specify CMakeLists.txt as the configuration file for project build.
Find the CMakeLists.txt file in the directory on the left of the project page, right-click the file, and choose Load CMake Project from the shortcut menu to specify it as the configuration file for project build, as shown in Figure 1.
- Set build configurations.
On the MindStudio project page, choose from the top menu bar to enter the build configuration page. For details, see In the Windows Scenario (the figure shows a configuration example).
- Click
to add a configuration. - The configuration option marked with (default) in the list is the default one. To switch the default option to a custom option, select the custom option and click
. For details about the toolchain configuration, see Toolchains. - Click OK to save the configuration.
Figure 2 Build configuration
- Click
- Select one of the following build methods based on the application scenario.
- On the MindStudio project page, choose and clear build configurations. (The Clean CMake Project function supports only local build.)
- On the MindStudio project page, choose to use the default configurations for full build.
- On the MindStudio project page, choose or click
on the toolbar to use the default configurations for incremental build.
Running an Application Project
- During remote running, the project folder is copied to the remote environment, excluding the dump and profiling directories in it.
- For a Python project, add an SSH Interpreter and select a remote environment interpreter in the run configuration to run the project remotely. For detailed configuration, see Python SDK Settings.
- On the MindStudio project page, choose from the top menu bar.
- Click + in the upper left corner, choose CMake Application, and create and configure the run parameters of the application project. Figure 3 shows a configuration example.
Table 1 Run configuration options Configuration Option
Description
Executable
Select the path of the build executable file to the last level.
Program arguments
Run parameters.
Working directory
Working directory. (If relative paths are configured in the project, select a relative working directory here, which defaults to the directory where the executable file is located.)
Environment variables
Enter the path of the dynamic load library (DLL).
You can also click
, and click
on the displayed page. Then, enter the path.Environment from path
Enter a path or click
on the right to select the environment variable configuration file. The configuration file is filled in with one or more lines of <variable name>=<variable value>, for example:APATH=/usr/local/xxx X_PATH=/xxx/xxx
- After the configuration is complete, click Apply to save the run configuration and click OK to close the run configuration dialog box.
- On the MindStudio project page, choose Run > Run... from the top menu bar.
In the dialog box displayed, select the created run configuration and run the application.
- If no error message is displayed and the message "Running *** finished" is displayed, the execution is complete.
- If an error message is displayed during application execution, view the detailed logs of the operating environment. For details, see the Log Reference.
- The default log path is $HOME/ascend/log. For details, see the "Log Files" section.
- The default log level is ERROR. For details about how to query or change the log level, see the "Log Level Setting" section.

