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

Availability and Restrictions


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

Version Oakley
0.38 X
0.44  X*
* Current default version

You can use module spider mpj-express to view available modules for a given machine. Feel free to contact OSC Help if you need other versions for your work.

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.


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

Publisher/Vendor/Repository and License Type

Bryan Carpenter et al., Open source



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 "", which we use in our example batch script:

import mpi.*;
public class HelloWorld
     public static void main(String[] args) 
                     throws Exception
          int me = MPI.COMM_WORLD.Rank();
          int size = MPI.COMM_WORLD.Size();
            ("Hi from " + me + " of " + size + "\n");

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.44

# Change to the directory you submitted the job from

# 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.

# Start MPJ

# Launch your parallel program -np $PBS_NP -dev native HelloWorld

# Shutdown MPJ

Further Reading

See Also