Hello,

I’m working with a scientific model that implements a numerical method, and I’m currently using the Intel compiler, but now I want to use CUDA Fortran that is available in the PGI compiler.

Some of the model results running on CPU (first tests without using CUDA) didn’t match between the compilers, and after debugging I saw that the problem is the log function that does not return the same value for a particular computation. As the numerical method depends on a convergence condition after many calculations, the errors from the log function are accumulated at each step, thus producing the differences in the final results. I need to use the Intel results as the reference.

Below is a simple program that illustrates one of the computations the method uses, and that differ in results. For val1 results are different, but for val2 don’t. Why val1 produces different results?

System: Intel Core i7 7820x, Linux CentOS 7.5.1804

Compilers: Intel Fortran 19.0.5.281 (ifort), PGI Fortran 19.10-0 (pgf90)

Compilation: Intel -> ifort -o log.ifort log.f90; PGI -> pgf90 -o log.pgf90 log.f90

Results:

Intel

val1: 0.0553500428796

val2: 5.0572290420532

PGI

val1: 0.0553499311209

val2: 5.0572290420532

```
program calclog
real :: val1, val2
val1 = 12.5
val2 = 0.5
write(*,'(A,F16.13)') 'val1: ', log((10.-val1*0.67)/(val1*0.123))
write(*,'(A,F16.13)') 'val2: ', log((10.-val2*0.67)/(val2*0.123))
end program calclog
```

Is it possible for PGI to match Intel results? I’d appreciate any help.

Thanks