pycharm远程调用mpi报错MPI_Init_thread help-orte-runtime: No such file or directory help-mpi-runtime.txt:

我在服务器里面安装openmpi,系统是ubuntu的
官网下载https://www.open-mpi.org/software/ompi/v4.1/

tar -zxvf openmpi-4.1.4.tar.gz
cd openmpi-4.1.4
mkdir build
../configure --prefix=/usr/local/mpi  如果不加--prefix默认会安装到/usr/local/mpi这个目录
make -j20
make install

安装完成之后在/usr/local/mpi将有如下五个文件夹

bin  etc  include  lib  share

其中我们使用的mpirun目录就在bin目录里面,lib文件夹存放编译好的so

安装python版本,使用python接口

pip install mpi4py

然后在服务器里面进行调用
from mpi4py import MPI
在这里插入图片描述
如果正常说明安装没有问题,
但是我使用pycharm进行远程运行from mpi4py import MPI的时候遇到一个错误:

--------------------------------------------------------------------------
Sorry!  You were supposed to get help about:
    opal_init:startup:internal-failure
But I couldn't open the help file:
    /build-result/hpcx-v2.9.0-gcc-inbox-ubuntu20.04-x86_64/ompi/share/openmpi/help-opal-runtime.txt: No such file or directory.  Sorry!
--------------------------------------------------------------------------
--------------------------------------------------------------------------
Sorry!  You were supposed to get help about:
    orte_init:startup:internal-failure
But I couldn't open the help file:
    /build-result/hpcx-v2.9.0-gcc-inbox-ubuntu20.04-x86_64/ompi/share/openmpi/help-orte-runtime: No such file or directory.  Sorry!
--------------------------------------------------------------------------
--------------------------------------------------------------------------
Sorry!  You were supposed to get help about:
    mpi_init:startup:internal-failure
But I couldn't open the help file:
    /build-result/hpcx-v2.9.0-gcc-inbox-ubuntu20.04-x86_64/ompi/share/openmpi/help-mpi-runtime.txt: No such file or directory.  Sorry!
--------------------------------------------------------------------------
*** An error occurred in MPI_Init_thread
*** on a NULL communicator
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
***    and potentially your MPI job)
[yjy-yjy-dev-face-totjhz:56409] Local abort before MPI_INIT completed completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!

Process finished with exit code 1

解决办法:将/usr/local/mpi/lib加入LD_LIBRARY_PATH环境变量,从而让pycharm能找到mpi所在so的位置
在这里插入图片描述
1)点击Edit Configurations,然后加入环境变量
pycharm远程调用mpi报错MPI_Init_thread help-orte-runtime: No such file or directory help-mpi-runtime.txt:_第1张图片
2)点击Environment variables右侧的小书图片编辑环境变量LD_LIBRARY_PATH的值,或者直接手动填入LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpi/lib
如果添加了lib路径还是报错,可能是因为OPAL路径找不到,添加下面的环境变量即可OPAL_PREFIX=/opt/hpcx/ompi
最后添加的环境变量如下:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpi/lib;OPAL_PREFIX=/opt/hpcx/ompi

你可能感兴趣的:(pycharm,pycharm,MPI_Init_thread,opal-runtime,No,such,file,help-orte-runti)