Unidata / netcdf-c

Official GitHub repository for netCDF-C libraries and utilities.
BSD 3-Clause "New" or "Revised" License
520 stars 262 forks source link

ncdump failure on intel oneapi compiler #2959

Open edwardhartnett opened 3 months ago

edwardhartnett commented 3 months ago

This is with the latest code from main (updated today).

The intel oneapi compiler seems to have broken some infinities(?):

cd ncdump
bash-4.4$ bash -x ./run_back_comp_tests.sh 
...
+ echo '*** Testing that this version can read data produced by old versions of netCDF.'
*** Testing that this version can read data produced by old versions of netCDF.
+ echo '*** checking ref_nc_test_netcdf4_4_0.nc...'
*** checking ref_nc_test_netcdf4_4_0.nc...
+ /scratch1/BMC/gsd-hpcs/ed/netcdf-c-4.9.3-rc1/ncdump/ncdump -n ref_nc_test_netcdf4_4_0 /scratch1/BMC/gsd-hpcs/ed/netcdf-c-4.9.3-rc1/ncdump/ref_nc_test_netcdf4_4_0.nc
+ diff -b -w /scratch1/BMC/gsd-hpcs/ed/netcdf-c-4.9.3-rc1/ncdump/ref_nc_test_netcdf4.cdl tst_nc_test_netcdf4_4_0.cdl
19c19
<               i:f = -3.402823e+38f, 3.402823e+38f, -Infinityf, Infinityf ;
---
>               i:f = -3.402823e+38f, 3.402823e+38f, -inff, inff ;
163c163
<               :Gf = -3.402823e+38f, 3.402823e+38f, -Infinityf, Infinityf, 531.f ;
---
>               :Gf = -3.402823e+38f, 3.402823e+38f, -inff, inff, 531.f ;
233c233
<  f3 = -3.402823e+38, 3.402823e+38, -Infinityf ;
---
>  f3 = -3.402823e+38, 3.402823e+38, -inf ;
245c245
<  f4 = -3.402823e+38, 3.402823e+38, -Infinityf, Infinityf ;
---
>  f4 = -3.402823e+38, 3.402823e+38, -inf, _ ;
DennisHeimbigner commented 3 months ago

Presumably this is the same issue as this: https://github.com/Unidata/netcdf-c/issues/2700

WardF commented 3 months ago

So I suppose the stanza introduced in https://github.com/Unidata/netcdf-c/pull/2935/files is either not being entered, or the -fhonor-infinities flag is not doing what is expected. @edwardhartnett can you pass -fhonor-inifinities to the compiler and see if that addresses the issue on your end? If so, I'll check the conditional, if not, I'll look more into compiler flags.

edwardhartnett commented 3 months ago

I will try when I can log in again - some problem with the system this morning.

The Intel oneapi is freely available and can be tested in the CI. We do that with the NCEPLIBS libraries here at NOAA. My colleague @AlexanderRichert-NOAA has made a GitHub action which installs the Intel compilers on a test instance. Take a look here, I think you could just use it directly, or take your own copy: https://github.com/NOAA-EMC/ci-install-intel-toolkit

WardF commented 3 months ago

I will take a look at integrating that, thanks!

WardF commented 3 months ago

I'm working on the next Fortran release, so that might be a good time to integrate modern alternatives to gfortran.

edwardhartnett commented 3 months ago

But it should be noted that the problem described in this issue was in the C library...

WardF commented 3 months ago

It should be noted indeed, and should have been obvious; as you can tell, I've been focused on the Fortran release XD. Yes, I will take a look at this in the C library.

edwardhartnett commented 3 months ago

I'm also going to do some netcdf-fortran tests after the netcdf-c testing I'm doing.

I was just reflecting on the value of unit tests to the netCDF project. Here we have code written in some cases 15 or 20 years ago, still working very well on new compilers, new systems, all with a small staff - and netCDF continues to add new features at an impressive rate. After all this time, the original v2 test code still runs perfectly. It's a record any software project would envy...