Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

compile complex and real double precision

diedro
Beginner
1,078 Views

Dear all,

I usually compile in this way:

ifort -fpp -r8 *.f90

In this way I have double precision with my real number.

Is there any way to do the same thing with complex number?

Thanks a lot

 

0 Kudos
9 Replies
Lorri_M_Intel
Employee
1,078 Views

Using the "-r8" switch also affects the size of complex variables.

Are you seeing something different?

                --Lorri

0 Kudos
diedro
Beginner
1,078 Views

Dear all, Dear Lorri,

I am working with complex number and MPI and I have noticed some difference in my results when I use MPI or not. I do not know if there is a problem in my code or this difference is normal. The difference is less than 1.e-19.

Thanks

 

 

 

0 Kudos
TimP
Honored Contributor III
1,078 Views

If you set -r8 you must call explicitly the d and z blas functions and the like. R8 doesn't adjust mkl calls.

0 Kudos
TimP
Honored Contributor III
1,078 Views

If you want to eliminate minor variations in results under MPI you should look into the MKL conditional numerical reproducibility feature.

0 Kudos
diedro
Beginner
1,078 Views

Dear All, Dear Tim,

I do not use any mkl libraries in this case.

I have notice that this difference does not affect my results. 

I think that this small differences are normal, am I right?

Thanks

0 Kudos
TimP
Honored Contributor III
1,078 Views

-fp-model source specifically disables optimizations where round-off varies with alignment.  If, instead, you want to assure all ranks achieve full performance and reduce these variations, you would set -align array32byte.

0 Kudos
Nick_Papior
Beginner
1,078 Views

-r8 does not correct the MPI data type. You need to specify the correct data type when using MPI.

Note that I think it is BAD practice to force the compilation of programs with such flags. Do so by other means to ensure that it always works.

0 Kudos
diedro
Beginner
1,078 Views

Dear Nick, Dear all,

I know that, indeed I use:

  SELECT CASE(KIND(realtest))
    CASE(4)
        MPIdata%AUTO_REAL = MPI_REAL               !Single precision used for real
        MPIdata%AUTO_COMP = MPI_COMPLEX
    CASE(8)
        MPIdata%AUTO_REAL = MPI_DOUBLE_PRECISION   !Double precision used for real
        MPIdata%AUTO_COMP = MPI_DOUBLE_COMPLEX
  END SELECT

So I do not know there is a bug or not

Thanks

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,078 Views

A difference of 1e-19 is less than the precision capability of a double (~16 decimal places).

The order in which operations are performed will make such differences

MPI rank 1 or single may accumulate iterating an entire array

MPI rank 2 may accumulate iterating two halves of the array, then reducing the two partial sums.

The two results may differ when the numbers exceed the precision capability and/or where they differ greatly in magnitude.

Jim Dempsey

0 Kudos
Reply