1

I never used MPI before and now for my project in Julia I need to learn how to write my code in MPI and have several codes with different parameters run in parallel and from time to time send some data from each calculation to the other ones.

And I am absolutely blank how to do this in Julia and I never did it in any language before. I installed library MPI but didn't find good tutorial or documentation or an available example for that.

halfer
  • 19,824
  • 17
  • 99
  • 186
B B
  • 23
  • 4
  • 1
    Do you really need MPI or just distributed parallelism? Julia's standard parallelism is distributed. I would only used MPI if the project requires some of the low-level asynchronous message passing that MPI allows (you to shoot yourself in the foot with). – Chris Rackauckas Feb 19 '18 at 08:49
  • I need a code to run for different inputs at the same time ,and I need message passing, so basically I want the parallel codes to exchange their energy values every some minutes – B B Feb 19 '18 at 10:44
  • 1
    Julia's native parallelism does that though, which is why I am wondering why you are specifically choosing to use MPI which is much more difficult. – Chris Rackauckas Feb 19 '18 at 11:55
  • This should get you started before asking specific questions: https://docs.julialang.org/en/stable/manual/parallel-computing – Steve Feb 19 '18 at 12:00
  • Doesn't Julia's builtin distributed support merely use sockets? In any HPC setting, a programmer would want to use native MPI (to leverage IB, for instance). – markhahn Dec 09 '19 at 03:13

1 Answers1

1

There are different ways to do parallel programming with Julia.

If your problem is very simply, then it might sufficient to use parallel for loops and shared arrays:

https://docs.julialang.org/en/v1/manual/parallel-computing/

Note however, you cannot use multiple computing nodes (such as a cluster) in this case.

To me, the other native constructs in Julia are difficult to work with for more complex programs and in my case, I needed to restructure (significantly) my serial code to use them.

The advantage of MPI is that you will find a lot of documentation of doing MPI-style (single-program, multiple-data) programming in general (but not necessarily documentation specific to julia). You might find the MPI style also more obvious. On a large cluster it is also possible that you will find optimized MPI libraries.

A good starting points are the examples distributed with MPI.jl:

https://github.com/JuliaParallel/MPI.jl/tree/master/examples

Alex338207
  • 1,825
  • 12
  • 16