I have an MPI program to calculate a sorting time. I run it with mpirun -np 2 mpiSort
. So this gives me the sorting time by 2 processes.
I want to get the sorting time for 5 times to average them. How do I do that automatically?
If I do a loop in the mpiSort
program. It actually executes 5(times) x 2(processes) = 10 times.
Edit: The mpiSort
does the sort in parallel. Basically, I'm trying to do mpirun -np 2 mpiSort
without typing it 5 times. Because I want to do the same for 4 cores, 8 cores.
You could run on five cores using
mpirun -np 5 mpiSort
and add anMPI_gather
at the end. Is the sort code actually using MPI (i.e. callsMPI_init
at the beginning?). Assuming you are, you can run on 5 cores and simply average at the end with a reduce,where
time
is each processes sort time.