From: engrbohn@aol.com (Engr Bohn)
Newsgroups: comp.parallel.mpi
Subject: Re: Why my MPICH/LAM under linux give low float point performance
Message-Id: <1998082914285100.KAA13934@ladder01.news.aol.com>
Date: 29 Aug 1998 14:28:51 GMT
Organization: AOL http://www.aol.com
References: <6s4ek9$74b$1@nnrp1.dejanews.com>


Well, one obvious performance improvement, (but I don't think it would improve
it by anywhere close to a full second) would be to move your "endwtime =
MPI_Wtime();" to before the second "if (myid == 0);", as in a pure serial
algorithm, you wouldn't be asking for this branch resolution (and if you were
running on multiple nodes, there's no harm in all nodes checking the time). 
Frankly, though, I think this'll only shave nanoseconds off your wall-clock
time.  Also consider how long it takes to execute MPI_Wtime(), as opposed to
the standard C library routines that may be optimized for the x86 platform ...
MPICH is written as a highly-portable set of libraries, which means it isn't
necessarily optimized for your platform.

Take care,
cb

On 8/27/98 4:12 PM Eastern Daylight Time, panxing@my-dejanews.com wrote:

>Sorry, there are a little bug in the program, the printf should not be
>timed.
>But I test again, even the printf is not timed, it is slow too.
>
>almost 2seconds .vs. 0.85 seconds, (MPI .vs. normal C)
>>
>> The program is :
>> #include "mpi.h"
>> #include <stdio.h>
>> #include <math.h>
>>
>> void main(argc,argv)
>> int argc;
>> char *argv[];
>> {
>>     int myid, numprocs,n;
>>         register        double mye, x, y, e;
>>      register long i,j;
>>         double startwtime, endwtime;
>>
>>     MPI_Init(&argc,&argv);
>>     MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
>>     MPI_Comm_rank(MPI_COMM_WORLD,&myid);
>>
>>         x=1.0; y=1.00000001;
>>         if (myid == 0)
>>         {
>>             startwtime = MPI_Wtime();
>>         }
>>             for (i =0;i<100000000;i++ )
>>             {
>>                 x =x*y;
>>             }
>>             mye = x;
>>             if (myid == 0)
>>             {
>>                 printf("The my final e is %lf\n", mye);
>>                 endwtime = MPI_Wtime();
>>                 printf("wall clock time = %f\n",
>>                        endwtime-startwtime);
>>             }
>>
>>     MPI_Finalize();
>> }

Christopher A. Bohn           EngrBohn@aol.com
          http://members.aol.com/EngrBohn/
"Oooh!  What does THIS button do!?"

