[petsc-users] MPI_Wtime in fortran

Barry Smith bsmith at mcs.anl.gov
Thu Jan 26 09:58:13 CST 2017


   MPI_Wtime() most definitely is suppose to return double precision. So you should not be getting this. Send the complete compiler warning message, cut and paste.

   Make a pure MPI program (no PETSc) that includes mpif.h and calls MPI_Init() MPI_Wtime() do you get a compiler warning message and incorrect values? Are you using some Fortran compiler flag to promote all single to double? This also promotes all double to quad so we don't recommend it. Look in your mpif.h file does it indicate MPI_Wtime() returns double?

    Barry

> On Jan 26, 2017, at 6:41 AM, Praveen C <cpraveen at gmail.com> wrote:
> 
> To be more precise, my code looks something like this
> 
> implicit none
> #include <petsc/finclude/petsc.h90>
> double precision time
> 
> time = MPI_Wtime()
> 
> I get the warning of conversion from REAL(16) to REAL(8) and the value of time is always zero.
> 
> Thanks
> praveen
> 
> On Thu, Jan 26, 2017 at 5:59 PM, Praveen C <cpraveen at gmail.com> wrote:
> Dear all
> 
> In my petsc fortran code, I am using MPI_Wtime to measure times. I include
> 
> #include <petsc/finclude/petsc.h90>
> 
> When compiling, I get warning for MPI_Wtime
> 
> Warning: Possible change of value in conversion from REAL(16) to REAL(8) at (1) [-Wconversion]
> 
> But MPI_Wtime is supposed to return double precision. The values I get from this function also seem to be wrong, always zero.
> 
> Thanks
> praveen
> 



More information about the petsc-users mailing list