c - Difference between MPI_Wtime and actual wall time -


i implemented mimd genetic algorithm using c , openmpi each process takes care of independent subpopulation (island model). so, population of size 200, 1-process run operates on whole population while 2 processes evolve populations of size 100.

so, measuring execution time mpi_wtime, i'm getting expected execution time running on 2-core machine ubuntu. however, disagrees both ubuntu's time command , perception alone: it's noticeable running 2 processes takes longer reason.

$time mpirun -n 1 genalg execution time: 0.570039 s (mpi_wtime)  real    0m0.618s user    0m0.584s sys     0m0.024s   $time mpirun -n 2 genalg execution time: 0.309784 s (mpi_wtime)  real    0m1.352s user    0m0.604s sys     0m0.064s 

for larger population (4000), following:

$time mpirun -n 1 genalg execution time: 11.645675 s (mpi_wtime)  real    0m11.751s user    0m11.292s sys     0m0.392s   $time mpirun -n 2 genalg execution time: 5.872798 s (mpi_wtime)  real    0m8.047s user    0m11.472s sys     0m0.380s 

i similar results whether there's communication between processes or not, , tried mpi_barrier. got same results gettimeofday, , turning gcc optimization on or off doesn't make difference.

what possibly going on? should run faster 2 processes, mpi_wtime suggests, in reality it's running slower, matching real time.

update: ran on pc , didn't have issue.

the code:

void runga(int argc,char* argv[]) {     (initializations)      if(myrank == 0)         t1 = mpi_wtime();      genalg();     individual* ind = best_found();     mpi_barrier(mpi_comm_world);     if(myrank != 0)         return;      t2 = mpi_wtime();     exptime = t2-t1;      printf("execution time: %f s\n",exptime); } 

my guess (and her/his) time give sum of time used cores. it's more cost : have 2 processes on 2 cores, cost time time1+time2 because second core used process, "lost" time on second core. mpi_wtime() display actual time spend human.

it's maybe explanation why real time lower user time in second case. real time closer mpi time sum of user ans sys. in 1st case initialization time take time , false result.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -