Basic HTML version of Foils prepared July 6 99

Foil 9 Minimal mpiJava program

From Object serialization for Marshalling Data in a Java Interface to MPI ACM Java Grande Meeting -- June 12-13 99. by Bryan Carpenter,Geoffrey C. Fox, Sung-Hoon Ko, Sang Lim


1 import mpi.*
2 class Hello {
3 static public void main(String[] args) {
4 MPI.Init(args) ;
5 int myrank = MPI.COMM_WORLD.Rank() ;
6 if(myrank == 0) {
7 char[] message = "Hello, there".toCharArray() ;
8 MPI.COMM_WORLD.Send(message, 0, message.length, MPI.CHAR, 1, 99) ;
9 }
10 else {
11 char[] message = new char [20] ;
12 MPI.COMM_WORLD.Recv(message, 0, 20, MPI.CHAR, 0, 99) ;
13 System.out.println("received:" + new String(message) + ":") ;
14 }
15 MPI.Finalize() ;
16 }
17 }

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Jul 6 1999