MPJ Express is a message passing library that be can be used by the application developers to develop and execute parallel Java applications on compute clusters or network of computers.MPJ Express can be configured in two ways:
Multicore Configuration: This configuration is used by developers who want to execute their parallel Java applications on multicore or shared memory machines (laptops and desktops).
Cluster Configuration: This configuration is used by developers who want to execute their parallel Java applications on distributed memory platforms including clusters and network of computers.
Now we will try some, first develop parallel applications on desktops/laptops using multicore configuration and then take the same code to distributed memory platforms including clusters. First setup this in PC. I having windows 7 and here is the steps.
Pre-requisites
Java 1.5 (stable) or higher (I have java 1.6)
Download MPJ Express and unpack it.
2. Set MPJ_HOME and MPJ_PATH environmental variables. Right-click My Computer->Properties->Advanced tab->Environment Variables and export the following system variables (User variables are not enough)
Set the value of MPJ_HOME = c:\mpj (assuming mpj is in c:\
Append the c:\mpj\bin directory to the MPJ_PATH variable
Then go to MPJ bin folder and right click on “installmpjd-windows.bat” and run as administrator.
For : Run “ %MPJ_HOME%/bin/installmpjd-windows.bat”
After that go to Control-Panel->Administrative Tools->Services-> MPJ Daemon and start the service.
Open note pad and add below code and save as “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 I am from <"+me+">");
MPI.Finalize();
}
}
open CMD in the file (“HelloWorld.java”) dir and type “javac -cp .;%MPJ_HOME%/lib/mpj.jar HelloWorld.java” to compile the file
Use “mpjrun.bat -np 4 HelloWorld” to excute the file
give no of proceess to run and see the results
Now You know simple MPJ Express works…
Add a comment