这个问题发生在如果你安装了mpich。
mpich是一个神奇的mpi实现,神奇在哪里呢?
这个问题在国内国外没有一个人指出答案,希望后续有人搜到,能够帮助到你。
mpich神奇在于如果我们安装了CUDA或者HIP,它对于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支持,如果我们在跑MPI例子,没有和cuda联动,那么很恭喜会神奇出现如标题的问题,GPU初始化失败,这个时候只需要增加一个环境变量:MPIR_CVAR_ENABLE_GPU=0就能解君愁。