【发布时间】:2017-02-26 06:37:46
【问题描述】:
我刚刚开始学习 MPI,我并不清楚我遇到问题的原因。
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
int main(int argc, char *argv[])
{
int myRank, size;
double myLeftBound, myRightBound;
MPI_Status status1;
MPI_Status status2;
MPI_Request request1;
MPI_Request request2;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (myRank == 0)
{
int counter;
for (counter = size - 1; counter >= 0; counter--)
{
myLeftBound = 0;
myRightBound = 1;
MPI_Isend(&myLeftBound, 1, MPI_DOUBLE, counter, 2 * counter, MPI_COMM_WORLD, &request1);
MPI_Isend(&myRightBound, 1, MPI_DOUBLE, counter, 2 * counter + 1, MPI_COMM_WORLD, &request2);
}
}
MPI_Recv(&myLeftBound, 1, MPI_DOUBLE, 0, myRank * 2, MPI_COMM_WORLD, &status1);
MPI_Recv(&myRightBound, 1, MPI_DOUBLE, 0, myRank * 2 + 1, MPI_COMM_WORLD, &status2);
printf ("I received my left boundary %f\n, I'm %d\n", myLeftBound, myRank);
MPI_Finalize();
return 0;
}
其中一个输出如下(进程数为 4)
我收到了我的左边界 0.000000
,我是 1
我收到了我的左边界 0.000000
,我是 2 岁
我收到了我的左边界 0.000000
,我 3 岁
文件 src/mpid/ch3/src/ch3u_buffer.c 第 77 行的断言失败:FALSE memcpy 参数内存范围重叠,dst_=0x7ffcc26963d0 src_=0x7ffcc26963d0 len_=8
内部 ABORT - 进程 0
进程 0 出了什么问题?
【问题讨论】:
标签: c mpi blocking nonblocking