c++ - c++中的mpi all to all v
问题描述
我正在尝试生成 4 个整数并使用 alltoall 将它们全部发送到 P0 我有这个:(堆栈溢出不喜欢 linux 行结尾)
int * sendbuf=new int [4];
for(int x=0;x<4;x++){sendbuf[x]=12/4*x;}
int* sendcounts =new int [4];
sendcounts[0]=4;
sendcounts[1]=0;
sendcounts[2]=0;
sendcounts[3]=0;
int* displs=new int [4];
sendcounts[0]=0*sizeof(int);
sendcounts[1]=4*sizeof(int);
sendcounts[2]=4*sizeof(int);
sendcounts[3]=4*sizeof(int);
int * recvbuf=new int [16];
for(int x=0;x<16;x++){recvbuf[x]=0;}
int* recvcounts=new int [4];
recvcounts[0]=4;
recvcounts[1]=4;
recvcounts[2]=4;
recvcounts[3]=4;
int* rdispls=new int [4];
rdispls[0]=0;
rdispls[1]=4;
rdispls[2]=8;
rdispls[3]=12;
MPI_Alltoallv(sendbuf,sendcounts,displs,MPI_INT,recvbuf,recvcounts, rdispls,MPI_INT,MPI_COMM_WORLD);
if(id==0)
{
for(int x=0;x<16;x++){cout<<recvbuf;}
}
我收到一条消息被截断的错误,我做错了什么?
解决方案
推荐阅读
- javacard - How to change java card default key with my own keys?
- c - 八进制转十六进制的C程序
- docker - Docker - 我是否也应该为 --cache-from 保存基本映像?
- python - How to remove this controller error from Odoo v10
- msdeploy - MsDeploy 无法在 bin 目录中创建文件夹 - 根据日志,将其视为文件
- c# - The data area passed to a system call is too small when saving with C# EF6
- apache - Apache RewriteRule 不适用于正斜杠
- docker - Docker 构建命令中断,无法标记图像/直接执行
- css - 在 css 选择器之后放置在弹出模式 wrt 到悬停元素位置之前
- laravel - This site can’t be reached for AWS Elastic Beanstalk Environment URL