Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java MPI in MATLAB*P Max Goldman Da Guo.

Similar presentations


Presentation on theme: "Java MPI in MATLAB*P Max Goldman Da Guo."— Presentation transcript:

1 Java MPI in MATLAB*P Max Goldman Da Guo

2 Overview Allow nodes to communicate during mm mode computation
Implement MPI primitives in Java Interface to these methods in MATLAB*P Why Java? MATLAB already runs a JVM Java well suited to network programming

3 Results Basic implementation that works
And some not-so-basic things that work Performance looks promising Error handling needs improvement Some quirks

4 Basic Architecture Node 0 MATLAB Node 1 Node … mm mode Frontend MATLAB
Backend C/C++ JVM Java sockets

5 Creating the Network Problem: each node needs to know every other IP address One-time communication through frontend Each node opens a socket to every other node

6 Passing Data Java functions operate on double[] buffers
Conversion is done automagically Pass-by-value across the Java-MATLAB interface, so methods return buffers In MPI spec, functions take output pointers Everything comes back as a column! Didn’t want to add another wrapper, so users must use columns or reshape themselves

7 Making the Call mmpi(fname, varargin)
Function fname can contain MPI calls Will be passed directly to mm(…) Forces MPI to be separated from *p code Eliminates confusion due to e.g. different indexing Can use mmpi(…) any number of times Function does not have to go all the way from init to fnlz

8 Making the Call Part II Inside mmpi Then pass control to mm
First check network, build if needed Then pass control to mm function result = simpletest(arg) import mpi.*; MPI.init; if MPI.COMM_WORLD.rank == 0; data = [42]; MPI.COMM_WORLD.send(data, 1, 1, 13); result = 0; elseif MPI.COMM_WORLD.rank == 1 got = MPI.COMM_WORLD.recv(1, 0, 13); result = got(1); end MPI.fnlz; Quirks

9 MPI Functions (Methods)
Class MPI init and fnlz – “finalize” reserved in Java Class Comm (MPI.COMM_WORLD) send – basic send recv – basic receive bcast reduce scatter gather scan – uses parallel prefix } use a binary tree algorithm

10 Tests Calculate the sum of numbers

11 Tests (cont.) Find the approximate value of Pi =

12 Tests (cont.) Find maximum value in random numbers

13 Tests (cont.) “Scan” example

14 Demo


Download ppt "Java MPI in MATLAB*P Max Goldman Da Guo."

Similar presentations


Ads by Google