Steps to write a nested parallel Java application using MPJ Express and Java OpenMP (JOMP). JOMP can be downloaded from
here.
Step 1: Write
- Edit the HybridApp.jomp - the source code is shown in the Figure below. Here we rely on MPJ Express for node parallelism and JOMP for thread parallelism.
Step 2: Translate and Compile
Once we have written our application, we need to translate the .jomp file to .java. Later the Java file is compiled using the Java compiler.
- The code is translated from .jomp to .java by using the command:
aamir@barq:~/tmp/jomp> java -cp $MPJ_HOME/lib/mpj.jar:jomp1.0b.jar jomp.compiler.Jomp HybridApp
- Compile the Java application:
aamir@barq:~/tmp/jomp> javac -cp $MPJ_HOME/lib/mpj.jar:.:jomp1.0b.jar HybridApp.java
Step 3: Execute
- Write machines file:
chenab1
chenab2
- Start MPJ Express daemons:
aamir@barq:~/tmp/jomp> mpjboot machines
- Run the hybrid code:
aamir@barq:~/tmp/jomp> mpjrun.sh -wdir ~/tmp/jomp -cp $MPJ_HOME/lib/mpj.jar:.:jomp1.0b.jar -np 2 -Djomp.threads=2 -dport 11050 HybridApp
Hello from process <1:0>
Hello from process <1:1>
Hello from process <0:0>
Hello from process <0:1>
- Halt MPJ Express daemons:
aamir@barq:~/tmp/jomp> mpjhalt machines