- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个简单的 MPI 应用程序,用于在输入所需值时将值从进程 0 传递到其他进程,但它在“else”上触发断点。
我错过了什么?
#include "stdafx.h"
#include "mpi.h"
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
int rank;
int value;
int size;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
do
{
if (rank == 0)
{
printf("Enter the value: ");
scanf_s("%d", &value);
MPI_Send(&value, 1, MPI_INT, rank + 1, 0, MPI_COMM_WORLD);
}
else
{
MPI_Recv(&value, 1, MPI_INT, rank - 1, 0, MPI_COMM_WORLD,
&status);
if (rank < size - 1)
MPI_Send(&value, 1, MPI_INT, rank + 1, 0, MPI_COMM_WORLD);
}
printf("Process %d got %d ", rank, value);
} while (value >= 0);
MPI_Finalize();
return 0;
}
这是调试的输出:
'MPIHelloWorld.exe' (Win32): Loaded 'C:\WINDOWS\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'MPIHelloWorld.exe' (Win32): Loaded 'C:\WINDOWS\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'MPIHelloWorld.exe' (Win32): Loaded 'C:\Program Files (x86)\Bonjour\mdnsNSP.dll'. Cannot find or open the PDB file.
MPIHelloWorld.exe has triggered a breakpoint.
MPIHelloWorld.exe has triggered a breakpoint.
The thread 0x3308 has exited with code 0 (0x0).
The thread 0x1dfc has exited with code 0 (0x0).
The thread 0x2e5c has exited with code 0 (0x0).
The program '[4400] MPIHelloWorld.exe' has exited with code 0 (0x0).
更新:
当我按下 CTRL + 5 时,我在控制台中收到此错误消息:
作业中止:[行列]留言
[0] fatal error MPI_Send 中的 fatal error :无效等级值为 1,但必须为非负且小于 1
最佳答案
好的,我终于找到答案了!
我无法使用 Cluster Debugger for MPI,因为我运行的是 Visual Studio 2015问题是只有 1 个进程在运行。
我打开了 CMD 并使用“mpiexec.exe -n 4 myMpiApp.exe”运行了我的应用程序,它成功了。
关于c++ - 为什么我的 MPI 应用程序会触发断点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44030662/
我是一名优秀的程序员,十分优秀!