使用nvcc执行OpenMPI代码(OPAL错误)时出错

问题描述 投票:1回答:1

我试图在NVIDIA Jetson TX2上运行OpenMPI代码。但是当我运行mpiexec时,我得到一个OPAL错误。

编制说明:

$ nvcc -I/home/user/.openmpi/include/ -L/home/user/.openmpi/lib/ -lmpi -std=c++11 *.cu *.cpp -o program
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

执行错误消息:

$ mpiexec -np 4 ./program 
[user:05728] OPAL ERROR: Not initialized in file pmix2x_client.c at line 109
*** An error occurred in MPI_Init
*** on a NULL communicator
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
***    and potentially your MPI job)
[user:05728] 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!
[user:05729] OPAL ERROR: Not initialized in file pmix2x_client.c at line 109
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
*** An error occurred in MPI_Init
*** on a NULL communicator
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
***    and potentially your MPI job)
[user:05729] 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!
--------------------------------------------------------------------------
mpiexec detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:

  Process name: [[7361,1],0]
  Exit code:    1
--------------------------------------------------------------------------

我使用以下说明安装了OpenMPI 3.1.2版:

$ ./configure --prefix="/home/user/.openmpi" --with-cuda
$ make; sudo make install

我也根据这个$PATH的指示设置了我的$LD_LIBRARY_PATH和我的link变量

我能够在我的笔记本电脑(Intel i7)上成功执行该程序。在查找错误时,我发现一些链接表明我重新安装了OpenMPI。我已多次尝试这样做(包括新下载的库)但没有任何成功。

任何帮助将不胜感激!

编辑

我按照评论中的要求尝试运行以下最小代码(main.cpp):

#include <iostream>
#include "mpi.h"
#include <string>

int main(int argc, char *argv[]) {
  int rank, size;
  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &size);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  std::cout << rank << '\n';
  MPI_Finalize();
  return 0;
}

为了编译它,我重新使用上一个命令并得到了同样的错误:

$ nvcc -I/home/user/.openmpi/include/ -L/home/user/.openmpi/lib/ -lmpi -std=c++11 main.cpp -o program

但是如果我用mpic++编译它,它能够完美地运行。

$ mpic++ main.cpp -o ./program
$ mpiexec -np 4 ./program 
0
1
3
2
compiler-errors mpi openmpi nvcc nvidia-jetson
1个回答
1
投票

这是您安装的唯一OpenMPI版本吗?我的猜测是你在构建和运行之间使用不同的MPI版本。检查which mpirun并搜索mpirun的实例。如果你在Ubuntu上做

sudo updatedb
locate mpirun

如果你调用正确的mpirun(用于构建的版本相同),那么错误应该消失。

© www.soinside.com 2019 - 2024. All rights reserved.