MPI_Init() 在 Raspberry Pi 4 上立即崩溃

时间:2021-06-29 09:25:44

标签: ubuntu mpi raspberry-pi4

在全新的 Raspberry Pi 4 Ubuntu 上运行干净的 Ubuntu,

pairs = {1: "apple", "orange": [2, 3, 4],  1: False, None: "True"}

ubuntu@ubuntu:~/mpi-hello-world/mpitutorial/tutorials/mpi-hello-world/code$ uname -a Linux ubuntu 5.4.0-1028-raspi #31-Ubuntu SMP PREEMPT Wed Jan 20 11:36:14 UTC 2021 armv7l armv7l armv7l GNU/Linux

使这个工作正常:

sudo apt install mpi mpich

但是运行它,当 MPI_Initialize() 被调用时instacrash。

#include <mpi.h>
#include <stdio.h>

int main(int argc, char** argv) {
  // Initialize the MPI environment. The two arguments to MPI Init are not
  // currently used by MPI implementations, but are there in case future
  // implementations might need the arguments.
  fprintf(stderr,"Starting...\n");
  MPI_Init(NULL, NULL);
  fprintf(stderr,"MPI_Init accomplished...\n");
  // Finalize the MPI environment. No more MPI calls can be made after this
  MPI_Finalize();
  fprintf(stderr,"MPI_Finalize done!\n");
}

有什么建议吗?!?

1 个答案:

答案 0 :(得分:0)

是的,问题是混合了 mpi 和 mpich!这解决了它:

sudo apt remove mpi mpich
sudo apt install mpi mpi-default-dev

之后make运行顺利(之前是这样),然后execute也顺利运行!

mpirun -np 2 ./mpi_hello_world

一切都很好。 感谢@Gilles 的提示。

(我或多或少地随机选择了 mpi 而不是 mpich,简单的网络搜索并没有显示出明确的理由为我们计划做的简单事情选择一个或另一个。)