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

image

image

Then go to MPJ bin folder and right click on “installmpjd-windows.bat” and run as administrator.image

 

 

 

 

 

 

 

For : Run “ %MPJ_HOME%/bin/installmpjd-windows.bat”

image

After that go to Control-Panel->Administrative Tools->Services-> MPJ Daemon and start the service.

image

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

image

Use “mpjrun.bat -np 4 HelloWorld” to excute the file

image

give no of proceess to run and see the results

image

 

Now You know simple MPJ Express works…

0

Add a comment

I am
I am
Archives
Total Pageviews
Total Pageviews
2 0 5 7 7 0 6
Categories
Categories
Loading