NCAR / DART

Data Assimilation Research Testbed
https://dart.ucar.edu/
Apache License 2.0
187 stars 140 forks source link

Create mkmf.template.nvhpc #557

Closed ann-norcio closed 9 months ago

ann-norcio commented 10 months ago

Description:

Created mkmf.template.nvhpc in build_templates to run quickbuild.sh with nvhpc compiler for all models on Derecho. Modified compiler flag FFLAGS = -O -Mbackslash $(INCS) to include -Mbackslash, which addresses issue #555

Fixes issue

Fixes: #554 #555

Types of changes

Documentation changes needed?

Tests

Copy mkmf.template.nvhpc and set as your mkmf.template. Set compiler to nvhpc module load nvhpc. Then, run quickbuild.sh on DART/models/lorenz_63/work.

Checklist for merging

Checklist for release

Testing Datasets

hkershaw-brown commented 10 months ago

Nice work testing out all the Derecho compilers and finding this, Ann.

There's code in dart that relies on IEEE standard that for a NaN, a /= a is .true. Background reading if you're interested (#176, #341)

Can you trying building and running the following code on Derecho with nvhpc:

code test_nan.f90

program test_nan

implicit none
real :: a, x

x = -1
a = sqrt(x)

print*, a

print*, a /= a
print*, a == a

if (a /= a) then
  print*, "you have a NaN"
endif

end program test_nan

You can compile and run it like this:

ftn -Kieee test_nan.f90 -o test_nan
./test_nan

vs

ftn test_nan.f90 -o test_nan
./test_nan

We want to make sure a /= a gives .true. for a NaN (we may need to add -Kieee to the compile flags in your mkmf.template.)

And bonus points, can you add some suggested flags if you want to turn on debugging for nvhpc?

hkershaw-brown commented 10 months ago

@hkershaw-brown the nan test should go in a developer test, since we are relying on the IEEE behaviour.