MindSpore2.2.10 ge图模式报错: Current execute mode is KernelByKernel, the processes must be launched with OpenMPI or ...

1. 系统环境

硬件环境(Ascend/GPU/CPU): Ascend 910
MindSpore版本:22.10
执行模式:静态图
Python版本:3.8
操作系统平台:Linux

2. 报错信息

2.1 问题描述

MindSpore2.2.10 ge图模式误跑到了KBK流程

2.2 报错信息

RuntimeError: Current execute mode is KernelByKernel, the processes must be launched with OpenMPI or ... 

3. 根因分析

开启INFO日志,定位到走到KBK的原因为存在dynamic scalar ops,通过IR图定位到业务代码中有使用int()的强制转换,调用了scalar_cast算子所导致

[INFO] PIPELINE(2963556, ffff8c4e8010,Python):2024-04-08-09:52:08.630.899 [mindspore/ccsrc/pipeline/ji t/ps/action.cc:1258] SetRunModel Run graph mode with kernel by kernel cause graph exist dynamic scalar ops.  
[CRITICAL] PIPELINE(29635s6,ttttöc4e8010, python) : 2024-04-08-09:52:08.633.509 [mindspore/ccsrc/pipeline/jit/ps/action.cc:1328] SetRunModel Current execute mode is kernel bynel, the processes must be launched with OpenMPI or Dynamic Cluster(Without setting MS_HCCL_CM_INIT to 1)  
W29999: [Init][LoadAscendCustomOppPath] ASCEND_CUSTOM_OPP_PATH[/cache/yzs/bev_ms/vendors/ms] is not exist or not abstract path. [FUNC: AddCustomOpstoreContent][FILE:configuion.cc][LINE:641]  
  
This exception is caused by framework's unexpected error. Please create an issue at https://gitee. com/mindspore/mindspore/issues to get help.  
[INFO] DEBUG(2963556, ffff8c4e8010,python):2024-04-08-09: 52:08.633.582 [mindspore/ccsrc/pipeline/jit/ps/debug/trace.cc:117] TraceGraphEval] Length of analysis graph stack empty.  
[INFO] DEBUG(2963556, ffff8c4e8010, python) :2024-04-08-09:52:08.633.641 [mindspore/ccsrc/pipeline/j it/ps/debug/trace.cc:418] GetEvalStackInfo] Get graph analysis informatio egin  
[INFO] DEBUG(2963556, ffff8c4e8010,python) :2024-04-08-09: 52:08.633.670 [mindspore/ccsrc/pipeline/jit/ps/debug/trace .cc:421] GetEvalStackInfo] Length of analysis informatio tack is empty.  
[INFO] PIPELINE(2963556,ffff8c4e8010,python):2024-04-08-09: 52:08.634.289 [mindspore/cc src/include/common/utils/python_utils . h:368] HandleExceptionRethrow] Caught exceptic Current execute mode is kernelbykernel, the processes must be launched with OpenMPI or Dynamic Cluster(Without setting MS_HCCL_CM_INIT to 1)  
  
• Ascend Warning Message:  
W29999: [Init][LoadAscendCustomOppPath] ASCEND_CUSTOM_OPP_PATH[/cache/yzs/bev_ms/vendors/ms] is not exist or not abstract path.[FUNC:AddCustomOpStoreContent][FILE: configuion.cc][LINE:641]  
  
- Framework Unexpected Exception Raised:  
This exception is caused by framework's unexpected error. Please create an issue at https://gitee. com/mindspore/mindspore/issues to get help.  
  
- C++ Cal1 Stack: (For framework developers)  
mindspore/ccsrc/pipeline/jit/ps/action.cc:1328 SetRunMode

c = (int(r[0][0] / x*4, r[0][0]*fov / 1)) 

4. 解决方案

分析代码中int类型转换为冗余操作,去掉后无报错

c = (r[0][0] / x*4, r[0][0]*fov / 1)