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

  1. MPI Tutorial
  2. MPI2 Tutorial
  3. Tut範例集
  4. MPI bcast範例

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的用法:

  1. MPI_Init:
  2. MPI_Comm_rank:
  3. MPI_Bcast:
  4. MPI_Finalize:

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?