Project Page

P2P Grid

Introduction

Scheduling

Basic concepts

Process migration

Java MPI

System overview

Simulations





Organic Computing as a concept to control parallel computations in P2P Grids

Java Massage Passing Interface (JMPI)

A message passing interface for Java, called Java Massage Passing Interface (JMPI), offers portability of to applications and allows processes to communicate with each other by passing messages. The JMPI was designed according to “Java for MPI”, a standardized interface for message passing in distributed Java applications that was defined by the Java Grande Forum. Since MPI is the most popular programming model in cluster computing, applications from computer clusters can be ported easily to the system.

An example of a JMPI application is given below. This application performs a parallel computation of an integral and was executed on nodes of the P2P grid within our research group.

1  import mpi.Comm;
2  import mpi.MPI;
3
4  public class Integral {
5     public migratory static double parIntegral ( double a, double b, long n ,int rank ,
        int tasks ) throws javago.NotifyGone{
6        double result = 0.0
7        double h =( b−a ) / n ;
8        long l ;
9        a = a+h/2 ;
10       for (l=rank; l<n; l+=tasks) result += f (a+l*h) ;
11       return h*result;
12    }
13    public migratory static double f (double x)throws javago.NotifyGone{
14       return (x*x) ;
15    }
16    public migratory static void main ( String[] args ) throws javago.NotifyGone{
17       String address = args[0];
18       try {
19          go( " jgp://" + address + ":12000/" ) ;
20       }
21       catch ( Exceptione ) {
22          System.out.println("migration failed") ;
23       }
24       Object buffer ;
25       int myrank, nprocs, src;
26       double result, x, T;
27       long n =1000000;
28       MPI.init( args, 1 );
29       nProcs = Comm.size( );
30       myRank = Comm.rank( );
31       result = parIntegral(0.0, 1.0, n, myRank, nProcs) ;
32       if (myRank >0){
33          buffer = result;
34          Comm.send(buffer, 0, 1, MPI.DOUBLE, 0, 0) ;
35       else {
36          for(src=1; src<nProcs; ++src ) {
37             x =( Double ) Comm.recv(buffer, 0, 1, MPI.DOUBLE, src, 0) ;
38             result+=x;
39          }
40       }
41    MPI.finish();
42    }
43 }


top next: system overview orco


Last modified: Thu Feb 05 20:33:00 CET 2009