$24
1. Purpose
In this lab, you will set up your MPI Java execution environment. Follow the professor's explanation about how to use MPI Java (instructions below). Copy, compile and execute ~css434/lab2a/MatrixMult.java.
MatrixMult.java: found in /CSSDIV/classes/434/lab2a if you cannot find it above
Statement of Work
Set up your execution environment:
The process for setting it up to run the first time for each user is
cumbersome. After the initial user set-up it works well without much
fuss.
login as self
make file .mpd.conf vi/emacs/pico .mpd.conf
in it write one line: secretword=<secretword
where <secretword is a secure key you create but not your normal password
save the file
set the correct permissions on this file (other permissions won't work) chmod 600 .mpd.conf
create the mpd.hosts file in your working directly where you run your program. The file should include a list of uw1-320 machines as seen in ~css434/.mpd.hosts:
uw1-320-10.uwb.edu
uw1-320-11.uwb.edu
uw1-320-12.uwb.edu
uw1-320-13.uwb.edu
# edit .bash_profile file as follows:
export PATH=/usr/apps/mpich121-`uname -p`/bin:$PATH
export JAVAPATH=/usr/lib/jvm/default-java
export CLASSPATH=$CLASSPATH:/usr/apps/mpiJava-`uname -p`/lib/classes:.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/apps/mpiJava-`uname -p`/lib
export PATH=/usr/apps/mpiJava-`uname -p`/src/scripts:$JAVAPATH/bin:$PATH
either re-login or type at the command line:
source .bash_profile
test that your setup works on the current host mpd &
mpiexec -n 1 /bin/hostname mpdallexit
if you get an error or warning this is a problem.
You should get the hostname of your current host
Need to be able to ssh without a password to other machines in order to use MPICH. If this is not already set up:
**************************************************************************
**
ssh-keygen -t rsa
**
**
#
at
"Enter
file
in which to save key", to accept default
**
**
#
at
"Enter
passphrase" to keep the passphrase empty.
**
**
#
do
the same thing again
**
**
#
then go to the
.ssh directory
**
**
# and
change
the name of id_rsa.pub to authorized_keys
**
**
cd
.ssh
**
**
mv
id_rsa.pub authorized_keys
(1) **
**
cat id_rsa.pub
authorized_keys
**
**
# ssh
to all
lab machines to set up
**
**
# first ssh need to respond "yes" to "continue connecting"
**
**************************************************************************
Note on (2): this is dangerous, to be safe, it is better to just concatenate the new file to the authorized_keys file.
As demonstrated
The first time a new host is added to the first "ring", it needs to be established by a "yes" response to "continue connecting".
Every time the output hangs, type "yes".
You can get all 32 hosts by starting a ring of 4 and typing "yes" 4 times,
then starting a ring of 8 (the original 4 plus 4 more) and typing "yes" 4 times.
After the initial 8, I had to add one at a time, with the new host always being the last.
1 of 3 , 5:00 PM
OneNote Online https://onenote.officeapps.live.com/o/onenoteframe.aspx?ui=en-US&rs=...
NOTE: SSH seems to be flaky in the lab these days, so chances are that this methodology won't work properly, since you need to ssh successfully to every machine to be able to boot. A suggested workaround is to individually open several terminals to the machines you want, see Figure 1 below. This figure also shows an issue when not all machines join the ring promptly; you can use mpdtrace -l to see what machines are listed.
Figure 1. Open one terminal for each machine you are using
Once you have added all the hosts in this way, you never have to type "yes" again, they were all established for mpich.
CSSmpdboot -n 4 -v
mpdallexit
CSSmpdboot -n 8 -v
mpdallexit
Note that you have to list 8 machine names in your mpd.hosts file
before typing "CSSmpdboot -n 8 -v"
Now, you are ready to run a mpiJava program.
To compile:
javac *.java
To run
CSSmpdboot -n #cpus -v
prunjava #cpus Hello
prunjava #cpus MatrixMult size
To stop
Mpdallexit
NOTE: due to more issues with the Linux lab (unrelated to our class), prunjava may not run. Our classmate Thomas has worked around this issue, which is solved using the following script. If you have an error indicating that prunjava doesn't exist (and a lot of EXPORTS show up in your terminal), copy the script to your linux folder and run ./not_prunjava instead of prunjava in the instructions above, as well as in step 2 below.
2 of 3 , 5:00 PM
OneNote Online https://onenote.officeapps.live.com/o/onenoteframe.aspx?ui=en-US&rs=...
not_prunjava
Evaluate a performance improvement of MatrixMult.java, using 1, 2, and 4 computing nodes.
CSSmpdboot -n 4 -v
prunjava 1 MatrixMult 2000
prunjava 2 MatrixMult 2000
prunjava 4 MatrixMult 2000
Mpdallexit
Related Materials
Quick review for MPI Java in the MPI slides
For details of MPI Java, refer to the following tutorial and specification:
http://www.hpjava.org/courses/arl/lectures/mpi.ppt
http://www.hpjava.org/reports/mpiJava-spec/mpiJava-spec.pdf
What to Turn in
Turn in your execution output of MatrixMult with 1, 2, and 4 computing nodes.
Your execution output, (i.e., output.txt)
Lab2a:
Outputs 1pt
3 of 3 , 5:00 PM