/*------------------------MPI广播---------------------------*/
// Broadcasts a message from the process with rank "root"
// to all other processes of the communicator,include itself.
// 以某个进程作为根进程将buffer广播给同通信域中的所有进程.
#include "mpi.h"
#include <stdio.h>
#define N 3
int main(int argc, char *argv[])
{
int i, myrank, nprocs;
int buffer[N]; //广播数据缓存
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
MPI_Comm_size(MPI_
MPI广播
最新推荐文章于 2024-01-28 21:30:03 发布