24小时热门版块排行榜    

查看: 907  |  回复: 4

xiaoshizi_

新虫 (初入文坛)

[求助] MPI并行接收数据大小不匹配报错 已有1人参与

在集群上跑一个程序,在并行这一块一直通不过。计算第一步就报错如下:
Warning! Rndv Receiver is expecting 4200768 Bytes But, is receiving 2720 Bytes
Warning!*******************************3500640************************3944*******
同上******************
用了几个核就有几个类似的Warning
程序中用的MPI 命令主要有MPI_SEND,MPI_RECV,MPI_PACK,MPI_UNPACK,MPI_ISEND等,请指教下问题大概出在哪里
另外我对MPI_ISEND和SEND两个命令的区别不是很懂,只知道个大概是阻塞式和非阻塞式的区别,请大神尽量通俗易懂的解释下区别,MPI_ISEND必须和MPI_IRECV搭配吗?能不能和MPI_RECV搭配?
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
xiaoshizi_: 金币+15, 有帮助 2016-12-10 19:48:26
MPI_Send vs MPI_Recv
CODE:
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
  // Initialize the MPI environment
  MPI_Init(NULL, NULL);
  // Find out rank, size
  int world_rank;
  MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
  int world_size;
  MPI_Comm_size(MPI_COMM_WORLD, &world_size);

  // We are assuming at least 2 processes for this task
  if (world_size < 2) {
    fprintf(stderr, "World size must be greater than 1 for %s\n", argv[0]);
    MPI_Abort(MPI_COMM_WORLD, 1);
  }

  int number;
  if (world_rank == 0) {
    // If we are rank 0, set the number to -1 and send it to process 1
    number = -1;
    MPI_Send(&number, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
  } else if (world_rank == 1) {
    MPI_Recv(&number, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
    printf("Process 1 received number %d from process 0\n", number);
  }
  MPI_Finalize();
}

https://blogs.cisco.com/performance/send_isend_or_sendrecv

The semantics of a send-receive operation is what would be obtained if the caller forked two concurrent threads,
one to execute the send, and one to execute the receive, followed by a join of these two threads.
2楼2016-12-09 04:21:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xiaoshizi_

新虫 (初入文坛)

引用回帖:
2楼: Originally posted by FMStation at 2016-12-09 04:21:38
MPI_Send vs MPI_Recv

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

int main(int argc, char** argv) {
  // Initialize the MPI environment
  MPI_Init(NULL, NULL);
...

能不能回复得更直接和具体一点,问题可能主要出在哪一块上。谢谢

发自小木虫Android客户端
3楼2016-12-10 19:48:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
xiaoshizi_: 金币+10, 有帮助 2016-12-12 21:28:49
for example, even processes send, then receive, odd processes receive first, then send
4楼2016-12-10 21:29:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
xiaoshizi_: 金币+15, 有帮助 2016-12-12 21:29:11
Warning! Rndv Receiver is expecting 4200768 Bytes But, is receiving 2720 Bytes

??????4200768 Bytes
???H??2720 Bytes

1. send - receive ?????
2. deadlock
5楼2016-12-10 22:45:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 xiaoshizi_ 的主题更新
信息提示
请填处理意见