今天来分享“MPICH:MPII_Init_thread(222): gpu_init failed”这个问题的解决方式

前言

如果在安装MPICH的时候没有注意要一些选项,那么当使用mpicxx mpi_send.cpp -o send && mpirun -n 2 ./send进行编译输出的时候,就会得到一段报错:MPICH:MPII_Init_thread(222): gpu_init failed
这个问题在国内外没有一个人指出答案,希望后续有人搜到,能够帮助到你。

问题原因

这个问题在于,我们在安装MPICH的时候,如果我们安装了CUDA或者HIP,那么MPICH它对于GPU是默认自动启动支持的。

回顾文档,重要的安装细节包括:

GPU support is automatically enabled if CUDA, ZE, or HIP runtime is
detected during configure. To specify where your GPU runtime is
installed, use:--with-cuda=<path> or --with-ze=<path> or --with-hip=<path>

(我认为在这要指定是因为cuda这些安装不是正常位置,安装程序没有找到)

If the lib/ and include/ are not in the same path, both can be specified
separately, for example: --with-cuda-include= and --with-cuda-lib=
In addition, GPU support can be explicitly disabled by using:--without-cuda or --without-ze or --without-hip

(如果当初加了这个指令,那么安装后就不会自动启用GPU支持了。这里是产生问题的根本原因)

解决方案

如果没有注意到上面,默认就启动了GPU支持。只要程序没有关于GPU相关的调用函数,就会报错。那么如何挽救呢?难道重装吗?
不用不用,只要设置一个环境变量即可:MPIR_CVAR_ENABLE_GPU=0

环境配置 高性能

版权属于:染念
作品采用:本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
更新于: 2024年01月13日 14:44
3
发表评论


180 文章数
673 评论量
4 分类数
184 页面数
已在风雨中度过 7年76天8小时10分
目录
来自 《MPICH:MPII_Init_thread(222): gpu_init failed》
© 2024 染念Blog
浙ICP备19020194号-1
暗黑模式
暗黑模式
评论
返回顶部
© 2024 染念Blog
浙ICP备19020194号-1
暗黑模式
暗黑模式
评论
返回顶部