gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 19:29:18 26 4
gpt4 key购买 nike

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

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使这个工作正常:
#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");
}
但是运行它,当调用 MPI_Initialize() 时会崩溃。
ubuntu@ubuntu:~/mpi-hello-world/mpitutorial/tutorials/mpi-hello-world/code$ mpirun -np 2 ./mpi_hello_world
Starting...
Starting...

===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 7855 RUNNING AT ubuntu
= EXIT CODE: 139
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions
有什么建议么?!?

最佳答案

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

sudo apt remove mpi mpich
sudo apt install mpi mpi-default-dev
之后 make运行顺利(它以前做过),然后执行也顺利运行!
mpirun -np 2 ./mpi_hello_world
一切都很好。
感谢@Gilles 的提示。
(我或多或少地随机选择了 mpi 而不是 mpich,简单的网络搜索并没有显示为我们计划做的简单事情选择一个或另一个的明确理由。)

关于ubuntu - MPI_Init() 在 Raspberry Pi 4 上立即崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68175980/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com