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.
To run the program you can use mpirun command. (Do not forget to add the openmpi-build/bin directory to your PATH)
Pre-Requests:
-
Build essentials
-
gcc
Installation Steps:
-
Download OpenMPI 1.8 $wget http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.1.tar.gz
-
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"
Build essentials
gcc
Installation Steps:
- Download OpenMPI 1.8 $wget http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.1.tar.gz
- 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"
Example:
$./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
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. Hello.java is one such example.
To compile the program
To compile the program
$javac -cp "path to mpi.jar" Hello.java
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
Comments