8000 GitHub - victorskl/mpjexpress-tute: Parallel Programming with Java using MPI/MPJ
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

victorskl/mpjexpress-tute

Repository files navigation

Notes for Windows

Download MPJ Express, extract package, setup MPJ_HOME environment variable. Just follow the guide.

Build and Run on Local Development

  • Open cmd.exe
  • build HelloWorld
  • run 4 HelloWorld

Notes for Linux/SLURM HPC Cluster

All bash shell scripts are written for Spartan cluster in mind! But it may still apply for similar Linux/SLURM HPC setup.

  • Compile by bash compile.sh HelloWorld.java
  • Submit job by sbatch job.sh

For Java program with external library dependency:

  • Compile by bash compile-with-dependency.sh HelloJson.java
  • Submit job by sbatch job-with-dependency.sh

Notes for External Library Dependencies

To compile with a particular library, you provides the classpath -cp flag as follow:

On Windows

javac -cp .;./lib/gson-2.8.0.jar;%MPJ_HOME%/lib/mpj.jar HelloJson.java
mpjrun.bat -cp lib/gson-2.8.0.jar -np 4 HelloJson

On Linux

javac -cp .:./lib/gson-2.8.0.jar:$MPJ_HOME/lib/mpj.jar HelloJson.java
mpjrun.sh -cp lib/gson-2.8.0.jar -np 4 HelloJson

Compile Multiple Class Files

If your project have a handful of class files to compile, then use asterisk.

javac -cp .;./lib/gson-2.8.0.jar;%MPJ_HOME%/lib/mpj.jar *.java

Many Dependencies

If your project have many dependencies (i.e. using handful of libraries) then you should consider using Maven. This is the prefer way of setting up a good practice Java project!

Notes for DataTypeExample

DataTypeExample.java is to test the idea on decomposing Java Map/HashMap data structure to MPI friendly primitive data type and array, sending back and ford while using MPI Scatter, Gather and Reduce routines. Assumption is, we can retain the order of Map's key. To study the code, build and run with small values to observe.

build DataTypeExample
run 2 DataTypeExample

Example output: note that Data Char Array is randomized each invocation.

Data Char Array: [ A C D C C A A A D B A B A C A C C A D C ]

Rank 0 received 10 elements.[A, C, D, C, C, A, A, A, D, B]
Rank 1 received 10 elements.[A, B, A, C, A, C, C, A, D, C]
Rank 1 occurrence Map: [A, B, C, D] [4, 1, 4, 1]
Rank 0 occurrence Map: [A, B, C, D] [4, 1, 3, 2]
Rank 0 sorted Map: [A, B, C, D] [4, 1, 3, 2]
Rank 1 sorted Map: [A, B, C, D] [4, 1, 4, 1]
Rank 0 decomposed array: [4, 1, 3, 2]
Rank 1 decomposed array: [4, 1, 4, 1]
Occurrence of character [A, B, C, D] is: [8, 2, 7, 3] respectively!

Sort by highest character occurrence count:
A:8
C:7
D:3
B:2

Clone and read in how things are done in details!

About

Parallel Programming with Java using MPI/MPJ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0