MPI@Ubuntu-5.10
在Ubuntu-5.10安裝了libmpich1.0, libmpich1.0-dev(含有檔頭mpi.h),以及mpich-bin(含有mpirun),mpi-doc(含有wegpages, Shared Memory的pdf檔, manpages...等等)
現在要學的MPICH,己經到了mpich2
Assignment#1:
#include#include "mpi.h" int main(int argc, char *argv[]) { int rank, size; MPI_Init( &argc, &argv ); MPI_Comm_size( MPI_COMM_WORLD, &size ); MPI_Comm_rank( MPI_COMM_WORLD, &rank ); printf( "Hello world from process %d of %d\n", rank, size ); MPI_Finalize(); return 0; }
Makefile:
ALL: Hello Hello: Hello.c mpicc -o helloworld helloworld.c clean: /bin/rm -f helloworld *.o
主要是先要去瞭解一些API的用法:
- MPI_Init:
- MPI_Comm_rank:
- MPI_Bcast:
- MPI_Finalize: