GPU设备算力不足导致计算结果错误[cublasGemmEx failed]

【现象描述】

按照官网正确安装mindspore 以及cuda驱动和库文件后,运行官网加法示例,输出结果全零。 或者执行matmul算子时报 cuBLAS Error: cublasGemmEx failed等情况。 相关案例:https://bbs.huaweicloud.com/forum/thread-149034-1-1.html

【原因分析】

一般是因为当前使用的GPU设备算力不够引起。 当前mindspore限制显卡算力为最低5.3,显卡算力的可在Nivida官网查询。

【解决方法】

在mindspore-1.6版本之后,mindspore对使用者的GPU显卡进行了算力识别,如使用者的GPU算力小于5.3,会有相应的日志提醒。

The device with Cuda compute capability 5.2 is lower than the minimum required capability 5.3, this may cause some unexpected problems and severely affect the results. Eg: the outputs are all zeros. Device with a compute capability > 5.3 is required, and it is recommended to use devices with a compute capability >= 7

由于是算力由硬件设备决定,暂无法通过软件方式规避,因此直接的解决方式是升级显卡设备。 或者使用CPU设备进行mindspore的使用。