Skip to content

Adding debug flags for cce compiler#1073

Open
mjs2369 wants to merge 3 commits intomainfrom
cce_flags
Open

Adding debug flags for cce compiler#1073
mjs2369 wants to merge 3 commits intomainfrom
cce_flags

Conversation

@mjs2369
Copy link
Contributor

@mjs2369 mjs2369 commented Mar 10, 2026

Description:

Adds debugging flags to the mkmf.template.cce

Includes the following flags:

-g
When specified the debug level is determined by the optimization level. If specified with no optimization level -O, the default is optimized debugging.

-O0
Disables all optimizations including floating point optimizations

Note that by selecting this optimization level, it automatically specifies the -hfp0 flag, which:
Controls the level of floating point optimizations, where n is a value between 0 and 4, with 0 giving the compiler minimum freedom to optimize floating point operations and 4 giving it maximum freedom. The higher the level, the less the floating point values conform to the IEEE standard.

-m2
Specifies the minimum compiler message levels to enable.
The -m messages levels are as follows:
0: Error, Warning, Caution, Note, and Comment
1: Error, Warning, Caution, and Note
2: Error, Warning, and Caution
3: Error and Warning (default)
4: Error

-rl
Lists source code and includes lint style checking. The listing includes the COMMON block report (see the -rc option for more information about the COMMON block report).

-Rbcdsp
Specifies any of a group of runtime checks for your program. 
b:
Enables checking of array bounds. Bounds checking is not performed on arrays dimensioned as (1).
c:
Enables conformance checking of array operands in array expressions.
d:
Enables a run time check for the !dir$ collapse directive and checks the validity of the loop_info count information.
p:
Generates run time code to check the association or allocation status of referenced POINTER variables, ALLOCATABLE arrays, or assumed-shape arrays.
s:
Enables checking of character substring bounds.

-Ktrap=inv,divz,ovf,unf
Enable traps for the specified exceptions.
Here, I’ve selected to use the following options:
inv: Trap on invalid operation.
divz: Trap on divide-by-zero.
ovf: Trap on overflow (i.e. the result of an operation is too large to be represented).
unf: Trap on underflow (i.e. the result of an operation is too small to be represented). I noticed that the unf option was not used in the gfortran mkmf.template - should it stay in here?

-hbounds
Enables checking of array bounds.

Fixes issue

fixes #1059

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

Built lorenz_96 and ran filter, with the full set of debugging flags listed

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

@mjs2369 mjs2369 requested a review from hkershaw-brown March 10, 2026 23:07
Copy link
Member

@hkershaw-brown hkershaw-brown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but you have the debugging flags as the default FFLAGS

@hkershaw-brown
Copy link
Member

This is just a note on the cce compiler, cce backtrace does not get the path correct,

ftn -g -O0 -m2 -rl -Rbcdsp -Ktrap=inv,divz,ovf,unf -hbounds -I/glade/u/apps/derecho/25.10/spack/opt/spack/netcdf/4.9.3/cce/19.0.0/zcl2/include  -c	/glade/u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90


ftn-1723 ftn: CAUTION RECEIVE_FROM, File = ../../../../../../u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90, Line = 262, Column = 44 
  Dummy argument "TIME" has the intent(out) attribute, but is never assigned a value or used as an actual argument.
hkershaw@derecho1:~/Temp/DART/models/lorenz_96/work(cce_flags)$ pwd
/glade/u/home/hkershaw/Temp/DART/models/lorenz_96/work
hkershaw@derecho1:~/Temp/DART/models/lorenz_96/work(cce_flags)$ ls ../../../../../../u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90
ls: cannot access '../../../../../../u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90': No such file or directory

Not sure if this is just /glade/ tripping it up

@hkershaw-brown
Copy link
Member

unf: Trap on underflow (i.e. the result of an operation is too small to be represented). I noticed that the unf option was not used in the gfortran mkmf.template - should it stay in here?

Probably not, there are a lot of places in dart where numbers get too small to be represented so become 0 ( or denormal number), which is ok. It is a good question though because (particularly in the qceff I think) there are calculations where we probably should understand a lot more about what the compiler is doing qceff issues. There some f08 ieee features that might be helpful looking at these routines and when you should trap vs undeflow, vs denormal, vs -+0, or whatever, but I'd do this in isolation (test code) rather than in runs of filter.

@hkershaw-brown hkershaw-brown added the release! bundle with next release label Mar 11, 2026
@mjs2369
Copy link
Contributor Author

mjs2369 commented Mar 11, 2026

This is just a note on the cce compiler, cce backtrace does not get the path correct,

ftn -g -O0 -m2 -rl -Rbcdsp -Ktrap=inv,divz,ovf,unf -hbounds -I/glade/u/apps/derecho/25.10/spack/opt/spack/netcdf/4.9.3/cce/19.0.0/zcl2/include  -c	/glade/u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90


ftn-1723 ftn: CAUTION RECEIVE_FROM, File = ../../../../../../u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90, Line = 262, Column = 44 
  Dummy argument "TIME" has the intent(out) attribute, but is never assigned a value or used as an actual argument.
hkershaw@derecho1:~/Temp/DART/models/lorenz_96/work(cce_flags)$ pwd
/glade/u/home/hkershaw/Temp/DART/models/lorenz_96/work
hkershaw@derecho1:~/Temp/DART/models/lorenz_96/work(cce_flags)$ ls ../../../../../../u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90
ls: cannot access '../../../../../../u/home/hkershaw/Temp/DART/assimilation_code/modules/utilities/null_mpi_utilities_mod.f90': No such file or directory

Not sure if this is just /glade/ tripping it up

I'm seeing something slightly different on my end, but still wrong

ftn-1438 ftn: CAUTION TEST_INTERPOLATE_RANGE, File = ../../../DART11.21.1/DART/models/model_mod_tools/test_interpolate_oned.f90, Line = 144, Column = 75 
  This argument produces a copy out to a temporary variable.
masmith@derecho2:/glade/derecho/scratch/masmith/DART11.21.1/DART/models/lorenz_96/work> pwd
/glade/derecho/scratch/masmith/DART11.21.1/DART/models/lorenz_96/work
masmith@derecho2:/glade/derecho/scratch/masmith/DART11.21.1/DART/models/lorenz_96/work> ls ../../../DART11.21.1/DART/models/model_mod_tools/
ls: cannot access '../../../DART11.21.1/DART/models/model_mod_tools/': No such file or directory

@mjs2369 mjs2369 requested a review from hkershaw-brown March 11, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release! bundle with next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mkmf.template.cce is missing debugging flags

2 participants