open_mpi_with_java_binding

Ceci est une ancienne révision du document !


MPI Java Binding

Open MPI (since 1.7 version) provides Java wrappers to a native MPI through the Java Native Interface (JNI).

Load Java MPI binding :

$ module load mpi/openmpi/icc/1.7.5 
$ module load lang/java

For convenience, the mpijavac wrapper compiler has been provided for compiling Java-based MPI applications. It ensures that all required MPI libraries and class paths are defined. You can see the actual command line using the –showme option.

Once your application has been compiled, you can run it with the standard mpirun command line:

$ mpirun [options] java [your-java-options] my-app-class

For convenience, mpirun has been updated to detect the Java command and ensure that the required MPI libraries and class paths are defined to support execution. You therefore do NOT need to specify the Java library path to the MPI installation, nor the MPI classpath. Any class path definitions required for your application should be specified either on the command line or via the CLASSPATH environmental variable. Note that the local directory will be added to the class path if nothing is specified. As always, the java executable, all required libraries, and your application classes must be available on all nodes.

import mpi.*;
public class HelloWorld {
 
public static void main(String args[]) throws Exception {
 
 MPI.Init(args);
 
 int me = MPI.COMM_WORLD.getRank();
 
 int size = MPI.COMM_WORLD.getSize();
 
 System.out.println("Hi from <"+me+">");
 
 MPI.Finalize();
}
 
}
mpijavac HelloWorld.java
mpirun -np 4 java HelloWorld
#!/bin/bash -l
 
#$ -V
#$ -N MPI_Java
 
#$ -pe mpi 16
 
#$ -o $JOB_NAME.$JOB_ID.out
 
module load mpi/openmpi/icc/1.7.5
module load lang/java
 
mpirun -np $NSLOTS java -Xmx512M Ring

Documentation

  • open_mpi_with_java_binding.1453817982.txt.gz
  • Dernière modification : 2016/01/26 14:19
  • de admin