环境
卡型号:ascend 910 操作系统版本:openEuler 20.03 CANN版本:nnae6.3 Python版本:3.8 MindSpore版本:2.1.0
mindspore.set_context(device_target='Ascend', device_id=3)
问题
在初次使用lstm算子时,需要加载过长的时间,5min。但只要执行一次后续就会回到正常速度。但如果多执行一些代码,再使用lstm算子又会出现相同的问题。与MindSpore GPU版本首次运行很慢?_MindSpore_昇腾论坛 (hiascend.com) 中问题类似,怀疑是cpu缓存的问题。
后根据profile查看,发现AIcpu的算子StandNormal执行过慢。

原因
设备cpu的问题???
环境
卡型号:ascend 910 操作系统版本:openEuler 20.03 CANN版本:nnae6.3 Python版本:3.8 MindSpore版本:2.1.0
mindspore.set_context(device_target='Ascend', device_id=3)
问题
在初次使用lstm算子时,需要加载过长的时间,5min。但只要执行一次后续就会回到正常速度。但如果多执行一些代码,再使用lstm算子又会出现相同的问题。与MindSpore GPU版本首次运行很慢?_MindSpore_昇腾论坛 (hiascend.com) 中问题类似,怀疑是cpu缓存的问题。
import mindspore.numpy as np import mindspore from mindspore import Tensor, nn import time mindspore.set_context(device_target='Ascend', device_id=3) profiler = mindspore.Profiler(output_path="mindinsight/lstm") t0=time.time() path_encoder = nn.LSTM(input_size=200, hidden_size=100, num_layers=3, batch_first=True) t1=time.time() print(t1-t0) t0=time.time() action=Tensor(np.randn((20480, 1, 200)),mindspore.float32) init_h =Tensor(np.randn((3, 20480, 100)),mindspore.float32) init_c =Tensor(np.randn((3, 20480, 100)),mindspore.float32) t1=time.time() print(t1-t0) t0=time.time() a=path_encoder(action, (init_h , init_c))[1] t1=time.time() print(t1-t0) profiler.analyse() 0.01973128318786621 0.0026705265045166016 207.76069521903992后根据profile查看,发现AIcpu的算子StandNormal执行过慢。

原因
设备cpu的问题???