From e139f4427aac2ca7b5716326be0cc6d9f270a1fe Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 26 Sep 2013 22:48:02 +0000 Subject: [PATCH] New examples for the updated MPI Java bindings This commit was SVN r29269. --- examples/Hello.java | 4 ++-- examples/Ring.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/Hello.java b/examples/Hello.java index 25ac348e5b..eba78c2381 100644 --- a/examples/Hello.java +++ b/examples/Hello.java @@ -30,8 +30,8 @@ class Hello { MPI.Init(args); - int myrank = MPI.COMM_WORLD.Rank(); - int size = MPI.COMM_WORLD.Size() ; + int myrank = MPI.COMM_WORLD.getRank(); + int size = MPI.COMM_WORLD.getSize() ; System.out.println("Hello world from rank " + myrank + " of " + size); MPI.Finalize(); diff --git a/examples/Ring.java b/examples/Ring.java index 68f08b098f..5309d3cb5c 100644 --- a/examples/Ring.java +++ b/examples/Ring.java @@ -19,8 +19,8 @@ class Ring { int prev; int message[] = new int [1]; - int myrank = MPI.COMM_WORLD.Rank() ; - int size = MPI.COMM_WORLD.Size() ; + int myrank = MPI.COMM_WORLD.getRank() ; + int size = MPI.COMM_WORLD.getSize() ; /* Calculate the rank of the next process in the ring. Use the modulus operator so that the last process "wraps around" to @@ -37,7 +37,7 @@ class Ring { message[0] = 10; System.out.println("Process 0 sending " + message[0] + " to rank " + next + " (" + size + " processes in ring)"); - MPI.COMM_WORLD.Send(message, 0, 1, MPI.INT, next, tag); + MPI.COMM_WORLD.send(message, 1, MPI.INT, next, tag); } /* Pass the message around the ring. The exit mechanism works as @@ -49,14 +49,14 @@ class Ring { and can quit normally. */ while (true) { - MPI.COMM_WORLD.Recv(message, 0, 1, MPI.INT, prev, tag); + MPI.COMM_WORLD.recv(message, 1, MPI.INT, prev, tag); if (0 == myrank) { --message[0]; System.out.println("Process 0 decremented value: " + message[0]); } - MPI.COMM_WORLD.Send(message, 0, 1, MPI.INT, next, tag); + MPI.COMM_WORLD.send(message, 1, MPI.INT, next, tag); if (0 == message[0]) { System.out.println("Process " + myrank + " exiting"); break; @@ -67,7 +67,7 @@ class Ring { to be received before the program can exit */ if (0 == myrank) { - MPI.COMM_WORLD.Recv(message, 0, 1, MPI.INT, prev, tag); + MPI.COMM_WORLD.recv(message, 1, MPI.INT, prev, tag); } MPI.Finalize();