Wednesday, July 16, 2014

How to install OpenMPI-Java

I have been trying out message passing frameworks for Java that can be used in HPC clusters. In this blog, I’m trying to provide installation instructions to quickly setup and try out Open MPI Java in a Linux environment.


  • Build essentials
  • gcc

Installation Steps:

  1. Create a directory which you want to install openmpi

           $mkdir /home/charith/software/openmpi-build
    3. Extract downloaded gzipped file and change into the extracted directory  
          $tar -xvvzf openmpi-1.8.1.tar.gz
          $cd openmpi-1.8.1
    4. Configure the build environment with java enabled, using the following command
         $./configure --enable-mpi-java --with-jdk-bindir="path to java bin directory " --with-jdk-headers="path to the java directroy which have jni.h" --prefix="Path to installation directory"

        $./configure --enable-mpi-java --with-jdk-bindir=/home/charith/software/jdk1.6.0_31/bin --with-jdk-headers=/home/charith/software/jdk1.6.0_31/include --prefix=/home/charith/software/openmpi-build

     5. Compile and install OpenMPI
          $make all install

Now you are done with the installation. You should be able to find mpi.jar which contains compile time dependencies to compile MPI Java programs in openmpi-build/lib directory.

Compiling and Running a OpenMPI Java Program

You should be able to find some example MPI Java programs in the extracted openmpi-1.8.1/examples directory. is one such example.

To compile the program

$javac -cp "path to mpi.jar"

To run the program you can use mpirun command. (Do not forget to add the openmpi-build/bin directory to your PATH)
$mpirun -np 5 java Hello   


jose pablo gamboa vargas said...

can't find mip.jar library. I installed open MPI with java but couldn't find it inside or with google

Charith Wickramarachchi said...

Once you finish $make all install it should be in openmpi-build/lib directory