0_event_status【免费下载链接】runtime本项目提供CANN运行时组件和维测功能组件。项目地址: https://gitcode.com/cann/runtimeDescriptionThis sample demonstrates Event status query flow after creation, after recording, and after synchronization.Product SupportThis sample supports the following products:ProductSupportedAscend 950PR/Ascend 950DTYesAtlas A3 training series products/Atlas A3 inference series productsYesAtlas A2 training series products/Atlas A2 inference series productsYesCompile and RunDownload the sample code to the environment where CANN software is installed. Switch to the sample directory.cd ${git_clone_path}/example/1_basic_features/event/0_event_statusSet environment variables.# Replace ${install_root} with the CANN installation root directory. The default installation is in the /usr/local/Ascend directory. source ${install_root}/cann/set_env.sh export ASCEND_INSTALL_PATH${install_root}/cann # Set SOC_VERSION and ASCENDC_CMAKE_DIR # -SOC_VERSION: Ascend AI processor model, such as Ascend910_9362, Ascend910B2, and so on # -ASCENDC_CMAKE_DIR: The sample involves calling AscendC operators. Configure the AscendC compiler ascendc.cmake path, such as /usr/local/Ascend/cann/x86_64-linux/tikcpp/ascendc_kernel_cmake source ${git_clone_path}/example/set_sample_env.shRun the following command to execute the sample.bash run.shCANN RUNTIME APIThe key functionality points and their key interfaces involved in this sample are as follows:InitializationCallaclInitinterface for initialization configuration.CallaclFinalizeinterface for deinitialization.Device ManagementCallaclrtSetDeviceinterface to specify the Device for computation.CallaclrtResetDeviceForceinterface to forcefully reset the current computation Device and reclaim Device resources.Context ManagementCallaclrtCreateContextinterface to create Context.CallaclrtDestroyContextinterface to destroy Context.Stream ManagementCallaclrtCreateStreaminterface to create Stream.CallaclrtSetStreamFailureModeinterface to set the operation when Stream execution encounters errors. Default is continue on error, can be set to stop on error.CallaclrtDestroyStreamForceinterface to forcefully destroy Stream.Event ManagementCallaclrtCreateEventinterface to create Event.CallaclrtRecordEventinterface to record Event.CallaclrtSynchronizeEventinterface to block and wait for Event to complete.CallaclrtQueryEventStatusinterface to query Event status.CallaclrtDestroyEventinterface to destroy Event.Memory ManagementCallaclrtMallocinterface to allocate memory on Device.CallaclrtFreeinterface to release memory on Device.Data TransferCallaclrtMemcpyinterface to implement data transfer through memory copy.Sample Output[INFO] After create event, current event status is 0. [INFO] Applied resource successfully, beging assigning task. [INFO] Begin a long task. [INFO] 0 is incompleted, 1 is completed. [INFO] After record but before synchronize, current event status is 0. [INFO] After synchronize, current event status is 1. [INFO] The answer is 1. [INFO] Resource cleanup completed.【免费下载链接】runtime本项目提供CANN运行时组件和维测功能组件。项目地址: https://gitcode.com/cann/runtime创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考