Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Question about MPI_Barrier
From: jody (jody.xha_at_[hidden])
Date: 2010-10-21 02:37:41


Hi

I don't know the reason for the strange behaviour, but anyway,
to measure time in an MPI application you should use MPI_Wtime(), not clock()

regards
  jody

On Wed, Oct 20, 2010 at 11:51 PM, Storm Zhang <stormzhg_at_[hidden]> wrote:
> Dear all,
>
> I got confused with my recent C++ MPI program's behavior. I have an MPI
> program in which I use clock() to measure the time spent between to
> MPI_Barrier, just like this:
>
> MPI::COMM_WORLD.Barrier();
> if if(rank == master) t1 = clock();
> "code A";
> MPI::COMM_WORLD.Barrier();
> if if(rank == master) t2 = clock();
> "code B";
>
> I need to measure t2-t1 to see the time spent on the code A between these
> two MPI_Barriers. I notice that if I comment code B, the time seems much
> less the original time (almost half). How does it happen? What is a possible
> reason for it? I have no idea.
>
> Thanks for your help.
>
> Linbao
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>