MPJ Express

From ACENET
Jump to: navigation, search
See also: Java VM
Description
MPJ Express is an open source Java message passing library.
Modulefile
mpj-express
Documentation
MPJ Express homepage
MPJ Express User Guides (select for Linux)
Availability
Glooscap, some hosts at Placentia, due to Java 7 requirements for the version of the OS.

Compilation

Here is how one can compile a Hello World program:

$ module purge
$ module load gcc openmpi/gcc/1.4 java/7 mpj-express
$ javac -cp .:$MPJ_HOME/lib/mpj.jar HelloWorld.java

Here is the content of HelloWorld.java:

import mpi.*;
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+">");
        MPI.Finalize();
    }
}

Running

Note that the mpjrun.sh wrapper script does not properly process Java memory parameters, contrary to the example in section 2.6 of the User Guide. Below are examples with workarounds. Please read the Parallel Jobs and Java pages, before running MPJ Express jobs.

Cluster configuration with the native device

Below is an example of a submissions script. Note the quotation marks around the memory options and the name of the program.

Also note the value of h_vmem, which is much higher than the 2G request for a Java process. The increase is to accommodate the Java memory overhead, the MPI library memory requirements, and the fact that the MPI library uses more memory when communicating over Ethernet, such as on Glooscap.

#$ -cwd
#$ -l h_rt=1:0:0,os=rhel6
#$ -l h_vmem=5G
#$ -pe ompi* 8

module purge
module load gcc openmpi/gcc/1.4 java/7 mpj-express

mpjrun.sh -np $NSLOTS -dev native "-Xms256m -Xmx2g HelloWorld"

# or directly with mpirun
# mpirun java -Xms256m -Xmx2g -cp $MPJ_HOME/lib/mpj.jar:. -Djava.library.path=$MPJ_HOME/lib HelloWorld 0 0 native

The multi-core configuration (single node)

In this configuration, the starter Java process launches another one, and it is impossible to specify Java memory configuration for the both via the wrapper script mpjrun.sh. Here is an example of a submissions script that does it directly:

#$ -cwd
#$ -l h_rt=1:0:0,os=rhel6
#$ -l h_vmem=4G
#$ -pe openmp 4

module purge
module load gcc java/7 mpj-express

java -Xms256m -Xmx2g -jar $MPJ_HOME/lib/starter.jar -np $NSLOTS -Xms256m -Xmx10g HelloWorld