并行计算学习笔记(MPI)
NSC-W
没有谁是一座孤岛,每本书都是一个世界。
展开
-
并行计算学习笔记(MPI)
/*MPI点到点阻塞式通信C语言版*/#include "mpi.h" /*MPI头函数,提供了MPI函数和数据类型定义*/#include <stdio.h>int main( int argc, char** argv ){ int rank; /*进原创 2017-03-29 08:35:15 · 1597 阅读 · 0 评论 -
MPI通信域划分及新通信域各进程间的点对点阻塞式通信
/*通信域划分及新通信域各进程间的点对点阻塞式通信*/#include <stdio.h> #include <mpi.h> #define MAX_STRING 100main (int argc, char **argv) { int oldrank,oldsize; //旧进程标识,旧通信域进程总数目 int newrank,new原创 2017-04-02 11:58:55 · 1732 阅读 · 0 评论 -
MPI广播
/*------------------------MPI广播---------------------------*/// Broadcasts a message from the process with rank "root" // to all other processes of the communicator,include itself.// 以某个进程作为根进程将bu原创 2017-04-02 18:04:27 · 1139 阅读 · 0 评论 -
MPI散播(MPI_Scatter)
/*MPI散播: Sends data from one process to all other processes in a communicator 通过一个进程向同一个通信域的所有进程发送数据特点: 分段发送,比如int[100],每次发送n个数据,向每个进程发送的区间为[int[rank*n],int[rank*n+n]) 发送段数:该通信域进程总数*原创 2017-04-04 11:18:09 · 10188 阅读 · 0 评论 -
MPI聚集 (MPI_Gather)
/*----------------------------MPI_Gather-------------------------*///功能:// Gathers together values from a group of processes// 将一个进程组的值聚集在一起//特点:// 根进程将收到的数据按进程号排序// 根进程数据接收缓存的大小为该组中每个进程发送缓存大原创 2017-04-04 11:23:19 · 4084 阅读 · 0 评论 -
MPI归并
/*Reduces values on all processes to a single value将所有进程的值归并为一个值*/#include "stdio.h" #include "mpi.h" #include "stdlib.h" int main(int argc, char * argv[]){ int myid, nprocs; int i;原创 2017-04-05 08:23:48 · 760 阅读 · 0 评论 -
MPI点对点非阻塞式通信
/*MPI进程间点对点非阻塞通信*/#include "mpi.h" /*MPI头函数,提供了MPI函数和数据类型定义*/#include <stdio.h>int main(int argc, char** argv){ int rank; //进程标识 int size; //进程总数 int senddata; //待发送数据缓存 int re原创 2017-04-05 08:30:28 · 2307 阅读 · 0 评论