Quadruple precision in 15.9.0

Certain portions of our model require quadruple precision. The following code is failing:

#ifndef NAGFOR
INTEGER, PARAMETER :: QR_K = SELECTED_REAL_KIND (32)
#else
INTEGER, PARAMETER :: QR_K = SELECTED_REAL_KIND (2*precision(1.0_wp))
#endif

:

! local variables
REAL(QR_K) :: d1_x, d1_y, d1_z,d2_x, d2_y, d2_z,d3_x, d3_y, d3_z


with:

ftn -I…/include -I…/…/…/src/include -I/opt/cray/netcdf/default/PGI/15.3/include -module …/module -I…/src -I…/support -I…/module -O -g -gopt -Mbounds -Mchkptr -Mchkstk -Mdclchk -Mpreprocess -Mrecursive -Mallocatable=03 -D__LOOP_EXCHANGE -D__ICON__ -D__NO_ICON_TESTBED__ -c …/…/…/src/shr_horizontal/mo_delaunay_types.f90
PGF90-S-0081-Illegal selector - KIND value must be non-negative (…/…/…/src/shr_horizontal/mo_delaunay_types.f90: 321)
0 inform, 0 warnings, 1 severes, 0 fatal for circum_circle_spherical_q128
PGF

Besides SELECTED_REAL_KIND (32) I’ve tried:

QR_K=SELECTED_REAL_KIND(2*precision(1.0_wp)) --> same problem
QR_K=selected_real_kind(33, 4931) --> same problem

USE iso_fortran_env, ONLY: real128
INTEGER, PARAMETER :: QR_K = real128 --> same problem

Is quadruple precision available at all with 15.9.0?

Thanks, --Will

Hi Will,

Actually, we don’t support quad precision. Since there no hardware support, quad precision must either be truncated to REAL*10 (80-bit) or software emulated which can be quite slow. Hence, we’ve never implemented it.

How important is quad precision support to your organization?

Would using a software emulator which supports arbitrary precision such as MPFUN (http://www.davidhbailey.com/dhbsoftware/) be an acceptable solution?

Thanks,
Mat

Hi Mat,

Thanks for the quick reply. Using quadruple precision in climate codes is a common trick: there are particular algorithms which are very sensitive to round-off; if fields are single precision, one ‘ducks’ into double precision. Similarly if the fields are double precision (the usual case), these sensitive calculations are performed in quadruple… But I won’t exaggerate its importance: realistically people should stabilize the algorithm instead.

MPFUN would not be a solution, since quadruple is working with all the other target compilers. Therefore there won’t be motivation among the developers to use a new library just to get the ICON code to compile with PGI. Instead I will work with the developers to find a work around for this particular case.

Thanks again, --Will

Hi Will,

I added an RFE (TPR#22261). Would you prefer quad precision be software emulated or truncated to 80-bit precision?

  • Mat