mpi错误

来源:互联网 发布:怎样测试端口是否打开 编辑:程序博客网 时间:2024/06/08 19:14
int nproc;MPI_Comm_size( MPI_COMM_WORLD, &nproc);MPI_Comm_rank( MPI_COMM_WORLD, &rank);int allName[nproc];int num=rank+1; MPI_Gather(&num, 1, MPI_INT, allName,nproc, MPI_INT, 0,MPI_COMM_WORLD); if(0==rank)        {for(i=0;i<nproc;i++)            printf("%d  ", allName[i]);        printf("\n");        }

输出结果竟然是:
1 0 -1269137776 32712

MPI_Gather(&num, 1, MPI_INT, allName,nproc, MPI_INT, 0,MPI_COMM_WORLD);//nproc 应该换为1
0 0
原创粉丝点击