MPJ-Express

MPJ-Express is a Java library that provides message passing capabilities for parallel computing in Java applications.

MPJ-Express is available on Oakley.

Availability & Restrictions

MPJ-Express is available without restriction to all OSC users.

The following versions of MPJ-Express are available on OSC systems:

Version Glenn Oakley
0.38   X


Note: We have modified MPJ-Express slightly from the default distribution to work nicely with our infrastructure. Installing your own copy of a newer version will not work. Please contact OSC Help if you need a newer version of this library.

Usage

Set-up

To set up your environment for using the MPJ-Express libraries, you must load the appropriate module. On Oakley this is pretty straightforward:

module load mpj-express

Building With MPJ-Express

When you load the MPJ-Express module, we will modify your CLASSPATH to ensure the JAR files are located.

Batch Usage

Programs built with MPJ-Express can only be run in the batch environment at OSC. For information on writing batch scripts, see Batch Processing at OSC.

If you have loaded a Java module when compiling, be sure to load that same module in your batch script to avoid version mismatches.

Here is a basic "Hello World" program, which needs to be in a file called "HelloWorld.java", which we use in our example batch script:

 

public class HelloWorld
{
     public static void main(String[] args) 
                     throws Exception
     {
          MPI.Init(args);
          int me = MPI.COMM_WORLD.Rank();
          int size = MPI.COMM_WORLD.Size();
          System.out.println
            ("Hi from " + me + " of " + size + "\n");
          MPI.Finalize();
     }
}

 

Below we have included a sample batch script:

 

#PBS -N mpj-world
#PBS -l walltime=0:05:00
#PBS -l nodes=2:ppn=12
#PBS -S /bin/bash

# Set environment
module load mpj-express/0.38

# Change to the directory you submitted the job from
cd $PBS_O_WORKDIR

# Set up the directory for the daemon logs to go in
export MPJ_LOG="$PBS_O_WORKDIR/log"
mkdir $MPJ_LOG

# Re-compile our application - not strictly necessary,
# if the source is unchanged.
javac HelloWorld.java

# Start MPJ
mpjboot

# Sleep a bit to the the daemons start
sleep 10

# Launch your parallel program
cat $PBS_NODEFILE | uniq > machines
NPROCS=`cat $PBS_NODEFILE | wc -l`
mpjrun.sh -np $NPROCS -dev niodev HelloWorld

# Shutdown MPJ
rm -f machines
mpjhalt

 

Further Reading

See Also

Supercomputer: 
Service: 
Technologies: