Mpi timing

Hi,

I am learning the MPI.jl package. At some point I thought I understand how JIT works, but maybe not. I may need someone help me clarify some basic concepts regarding the MPI usages and Julia:

  1. By executing commands like mpirun -np 4 julia example_mpi.jl, the source code needs to be compiled everytime. Is that correct?

  2. If the code needs to be compiled everytime before the MPI execution, then what is the proper way of doing timings? I feel like the Wtime() function which is the wrapper over MPI_Wtime() is giving me the expected timings compared with the native C implementations.

  3. For large jobs with N iterations/timesteps, the compilation for Julia functions only happens once at the start, so we will see close to C’s performance with a large N. Is this correct? For small runs, if I just type time mpirun -np 2 julia example_mpi.jl in the command line, I can see much larger timing compared with an equivalent MPI C program with time mpirun -np 2 a.out

  4. Is there a way of running MPI parallelized program inside REPL?

Thanks!

This should also make it easier to avoid precompilation while timing.
I’d also recommend profiling and benchmarking your code without mpi to make sure your code is getting “close to C’s performance” before adding multiprocessing into the mix, so that you don’t have too many variables at a time.

I’m late to this thread, but on point 4: tmpi is an option https://github.com/Azrael3000/tmpi/. It allows starting multiple REPLs using MPI and controlling them together or individually.

3 Likes