My question concerns the use of the PGI compiler on CPU, not on GPU.
I have a scientific code in Fortran that is compiled with ifort, and now I’m using pgf90 (because of CUDA Fortran), but the final results are different. I want to produce the same results as ifort using pgf90.
The code is compiled with the flag -mieee-fp using ifort, and I tried the flag -Kieee using pgf90, but the results don’t match. I also tried -tp=px, but it didn’t have any effect. Is there another flag to make the results be the same. I need to use the ifort results as reference, so I don’t want to change the flags used with ifort.
The example below illustrates the differences. Although the difference is small in this case, these values are intermediary values in a numerical method that tests for convergence, and the final results differ by either hundreds or thousands.
System: Intel Core i7 7820x, Linux CentOS 7.5.1804
Compilers: Intel Fortran 126.96.36.1991 (ifort), PGI Fortran 19.10-0 (pgf90)
Compilation: Intel -> ifort -o prog.ifort prog.f90 -mieee-fp; PGI -> pgf90 -o prog.pgf90 prog.f90 -Kieee
program precision real x1, x2, x3, val x1 = 0.00999999977648258209228515625 x2 = 539.693969726562499999999999999999999999 x3 = 150.0 val = x1*x2*x3*3600.0 write(*,'(F30.20)') val end program precision