1 / 14

Java MPI in MATLAB*P

Java MPI in MATLAB*P. Max Goldman Da Guo. 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. Results.

nelliee
Download Presentation

Java MPI in MATLAB*P

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. mm mode Frontend MATLAB JVM Node 0 MATLAB JVM Backend C/C++ Node 1 MATLAB JVM Node … MATLAB JVM Java sockets Basic Architecture

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

  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 • First check network, build if needed • Thenpasscontrolto 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. } use a binary tree algorithm 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

  10. Tests • Calculate the sum of numbers 1--40000

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

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

  13. Tests (cont.) • “Scan” example

  14. Demo

More Related