Mpich programming, mpich
I. Introduction
Build An MPI Programming Environment by installing MPICH to develop parallel programs. MPICH is an application implementation of MPI (Message-Passing Interface). It supports the latest MPI-2 Interface standard and is a tool for parallel operation.
Ii. installation and configuration
http://www.cnblogs.com/liyanwei/archive/2010/04/26/1721142.htmlhttp://blog.csdn.net/yujiflying/article/details/7206961
3. program example
//hello.c#include "mpi.h"#include <stdio.h>#include <math.h>int main (int argc, char **argv){ int myid, numprocs; int namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &myid); MPI_Comm_size (MPI_COMM_WORLD, &numprocs); MPI_Get_processor_name (processor_name, &namelen); fprintf (stderr, "Hello World! Process %d of %d on %s\n", myid, numprocs, processor_name); MPI_Finalize (); return 0;}
Compile
mpicc -o hello hello.c
Run
Hello World! Process 1 of 4 on jack-laptopHello World! Process 3 of 4 on jack-laptopHello World! Process 2 of 4 on jack-laptopHello World! Process 0 of 4 on jack-laptop