redtst.c

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· C语言 代码 · 共 22 行

C
22
字号
#include "mpi.h"#include <stdio.h>#include "test.h"int main( int argc, char **argv ){  int rank, value, result;  MPI_Init (&argc, &argv);  MPI_Comm_rank (MPI_COMM_WORLD, &rank);  value = (rank == 0) ? 3 : 6;  MPI_Allreduce (&value, &result, 1, MPI_INT, MPI_BOR, MPI_COMM_WORLD);  if (rank == 0) printf ("Result of 3 BOR 6 is %d, result of 3|6 is %d\n",                          result, 3|6);  Test_Waitforall( );  MPI_Finalize ();  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?