root/examples/Hello.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /*
   2     Licensed under the Apache License, Version 2.0 (the "License");
   3     you may not use this file except in compliance with the License.
   4     You may obtain a copy of the License at
   5 
   6        http://www.apache.org/licenses/LICENSE-2.0
   7 
   8     Unless required by applicable law or agreed to in writing, software
   9     distributed under the License is distributed on an "AS IS" BASIS,
  10     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11     See the License for the specific language governing permissions and
  12     limitations under the License.
  13 */
  14 /*
  15  * Author of revised version: Franklyn Pinedo
  16  *
  17  * Adapted from Source Code in C of Tutorial/User's Guide for MPI by
  18  * Peter Pacheco.
  19  */
  20 /*
  21  * Copyright (c) 2011      Cisco Systems, Inc.  All rights reserved.
  22  *
  23  */
  24 
  25 import mpi.*;
  26 
  27 class Hello {
  28     static public void main(String[] args) throws MPIException {
  29 
  30 
  31         MPI.Init(args);
  32 
  33         int myrank = MPI.COMM_WORLD.getRank();
  34         int size = MPI.COMM_WORLD.getSize() ;
  35         System.out.println("Hello world from rank " + myrank + " of " + size);
  36 
  37         MPI.Finalize();
  38     }
  39 }

/* [<][>][^][v][top][bottom][index][help] */