⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 allredmany.c

📁 MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程环境.
💻 C
字号:
#include <stdio.h>#include "mpi.h"#include "test.h"/* * This example should be run with 2 processes and tests the ability of the * implementation to handle a flood of one-way messages. */int main( int argc, char **argv ){  double wscale = 10.0, scale;  int numprocs, myid,i,namelen;  char processor_name[MPI_MAX_PROCESSOR_NAME];  MPI_Init(&argc,&argv);  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);  MPI_Comm_rank(MPI_COMM_WORLD,&myid);  MPI_Get_processor_name(processor_name,&namelen);  /* fprintf(stderr,"Process %d on %s\n",          myid, processor_name); */  for ( i=0; i<10000; i++) {    MPI_Allreduce(&wscale,&scale,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);  }  MPI_Finalize();  return 0;}

⌨️ 快捷键说明

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