0% found this document useful (0 votes)
306 views16 pages

Setup MPJ Express

This document provides instructions for setting up MPJ Express on Ubuntu Linux. It outlines downloading and extracting the MPJ Express package, setting environmental variables to configure the MPJ home path, editing the BASHRC file, compiling the MPJ Express library, writing a simple Hello World program using MPI, compiling the program, and running it across 4 processes. The goal is to demonstrate a basic MPI program execution on the newly setup MPJ Express framework.

Uploaded by

Swapnil Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
306 views16 pages

Setup MPJ Express

This document provides instructions for setting up MPJ Express on Ubuntu Linux. It outlines downloading and extracting the MPJ Express package, setting environmental variables to configure the MPJ home path, editing the BASHRC file, compiling the MPJ Express library, writing a simple Hello World program using MPI, compiling the program, and running it across 4 processes. The goal is to demonstrate a basic MPI program execution on the newly setup MPJ Express framework.

Uploaded by

Swapnil Shinde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Welcome to the tutorial on -

Setup of MPJ Express


You must have ….

1. Ubuntu Linux

2. JDK installed

3. Any suitable code editor (prefer eclipse)

4. Software Package Required - MPJ Express


Download MPJ Express

http://mpj-express.org/download.php

Click on Software to download


Source Forge Website

● Redirected to this page

● Select latest version 44

● Choose TAR source file


Download Source File

Pop-up for downloading selected


package
Select Proper setup location

Move the downloaded folder to Desktop

Extract the contents of TAR folder on Desktop location


Understand MPJ Directory/Folder Path

Open new Terminal (Ctrl + Alt + T)

Go to the location where MPJ package is kept

i.e. on Desktop

Type pwd command to get path of the folder

Remember that path or Copy it somewhere


Set Environmental Variables

1. Need to set MPJ Home variable that gives PATH of supporting files
required for compilation and execution.

2. Open new Terminal (Ctrl + Alt + T)

3. Type : sudo gedit ~/.bashrc

4. Enter password and get into the text editor window


Edit BASHRC File

Add following two lines in the file -

export MPJ_HOME=/home/swapnil/Desktop/mpj-v0_44

export PATH=$MPJ_HOME/bin:$PATH

Note that in MPJ_HOME variable, after '=' there is the path of Desktop mpj
folder which was obtained in last step through command pwd
Real Picture

See the edited file

Save file

Close file
Compile the MPJ Express library

Go to this terminal window

Execute following command

$MPJ_HOME; ant

Observe the output mentioned in the next slide


Check for Correct installation & working
import mpi.*;
Type simple Hello World program in
public class HelloWorld {
java
public static void main(String args[]) throws Exception {

(please ignore coding constructs.It MPI.Init(args);

will be covered in next tutorial) int me = MPI.COMM_WORLD.Rank();

int size = MPI.COMM_WORLD.Size();


Save file as HelloWorld.java
System.out.println("Hi from <"+me+">");

MPI.Finalize();

}
Compile Program

Go to the directory where HelloWorld.java is saved

Compile using javac command given as follows

javac -cp .:$MPJ_HOME/lib/mpj.jar HelloWorld.java


Run Program

Run the compiled source code using following command

mpjrun.sh -np 4 HelloWorld

Output:
Thanks!
Sample MPI based assignments
are available at :

www.thelearningsolutions.com

You might also like