Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Urgent help is required for inserting the flag in Fortran compiler (-fpe0)

csp

CSP
Member
Dear all,
I am trying to modify some routines in the SCAM module (specifically in the ndrop.F90 module). But after compiling successfully and running the (almost) complete simulation time, the simulation is crashing with the report saying.
Code:
NetCDF: Numeric conversion not representable
pio_support::pio_die:: myrank=          -1 : ERROR: 
pionfwrite_mod::write_nfdarray_double:         250 : 
NetCDF: Numeric conversion not representable
Image              PC                Routine            Line        Source             
cesm.exe           0000000002425357  Unknown               Unknown  Unknown
cesm.exe           0000000002276C71  pio_support_mp_pi         118  pio_support.F90
cesm.exe           0000000002274C2E  pio_utils_mp_chec          74  pio_utils.F90
cesm.exe           000000000232D823  pionfwrite_mod_mp         250  pionfwrite_mod.F90.in
cesm.exe           00000000023080AE  piodarray_mp_writ         650  piodarray.F90.in
cesm.exe           000000000230A7C0  piodarray_mp_writ         221  piodarray.F90.in
cesm.exe           000000000230AD31  piodarray_mp_writ         291  piodarray.F90.in
cesm.exe           000000000102F3D4  cam_grid_support_        3312  cam_grid_support.F90
cesm.exe           0000000000531E35  cam_history_mp_du        4731  cam_history.F90
cesm.exe           000000000051420C  cam_history_mp_ws        5055  cam_history.F90
cesm.exe           0000000000501071  cam_comp_mp_cam_r         402  cam_comp.F90
cesm.exe           00000000004F1640  atm_comp_mct_mp_a         455  atm_comp_mct.F90
cesm.exe           0000000000434E9E  component_mod_mp_         728  component_mod.F90
cesm.exe           000000000041AD0A  cime_comp_mod_mp_        3465  cime_comp_mod.F90
cesm.exe           0000000000434AE7  MAIN__                    125  cime_driver.F90
cesm.exe           00000000004170A2  Unknown               Unknown  Unknown
libc-2.31.so       00007FD1F128C083  __libc_start_main     Unknown  Unknown
cesm.exe           0000000000416FAE  Unknown               Unknown  Unknown
MPI_Abort: error code = 1
 max rss=473.5 MB
 max rss=536.9 MB
I am unable to figure out this issue, so I am wondering if is there any way to detect NANs in the simulations and stop at that particular line. For instance, could I use the flag
Code:
-fpe0
for compiling the code?
I am struggling with this issue for a quite long time, thus any comment/suggestion would be very helpful, many thanks in advance.
 

peverley

Courtney Peverley
Moderator
Hi!

The first thing to try would be to turn on debug like this:

./xmlchange DEBUG=TRUE

Turning on debug will turn on various flags (depending on your compiler) and one of those should be the floating point exception flag you mention. Let me know if this doesn't help!

Courtney
 
  • Like
Reactions: csp

csp

CSP
Member
@peverley , wow!!! amazing, that worked. I am really and sincerely thankful to you for your help and reply. It worked exactly worked in the way I was expecting. You definitely saved my days or maybe months to figure out my silly mistakes. Will it be possible to get more information about more flags that we used in that script, I tried to open and see that file but could not get anything. Any further details about the script and/or flags used would be welcomed.
Again, million tons thanks to you.
PS: I was trying to post this yesterday, but maybe because of an internet issue and/or server problem with this website, this page was not opening.
 

peverley

Courtney Peverley
Moderator
It wasn't on your end, the forum was down for a couple of hours yesterday.

I think, based on context, that you're using the Intel Fortran compiler. (If not, please let me know what you're using).

That said, for the Intel Fortran compiler, the following flags are added when DEBUG is on:

" -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created"

Also: another good way to debug issues like this is to switch compilers - you can often get different output and some compilers catch errors earlier/later on than others.

Let me know if anything else comes up!

Courtney
 
  • Like
Reactions: csp

csp

CSP
Member
Many thanks, Courtney @peverley for your kind reply and help. Your help and prompt replies are really very much acting as the thrust for my work, really appreciate that. However, do you know from where exactly these commands are written/launched and is it possible to tweak them for instance instead of using
Code:
-check
could I use
Code:
-check all
and could I include the following flag also:
Code:
-ftrapuv
Any further comment would be very helpful, have a nice weekend :)
 

peverley

Courtney Peverley
Moderator
Hi again,

You can do this by modifying the intel.cmake file within the CAM source code (NOT in your case directory - any changes to this file will be overwritten). The location of intel.cmake may vary based on your version of CAM, but you can do

find . -name intel.cmake

at the base level of your CAM directory to find it. Once you've found it, go to the following line and add/change any flags you want. From there, you'll need to get a re-setup your case and do a clean build with:

./case.setup --reset
./case.build --clean-all
./case.build

Then, when you run your case (assuming DEBUG is on), it will use your amended flags.

Courtney

PS if you're not using the intel fortran compiler, you'll need to edit the relevant <COMPILER>.cmake file instead of intel.cmake
 
  • Like
Reactions: csp

csp

CSP
Member
Hi,
@peverley Many thanks Courtney, for your kind help and support, I tried to search intel.cmake using the command you mentioned:
Code:
find . -name intel.cmake
but it is unable to locate that file. Unfortunately, I am unable to figure this out -- not very sure what I am missing.
I am in fact using the intel compiler for CAM. Sorry for again bothering you with this trivial issue.
 

peverley

Courtney Peverley
Moderator
Ah, ok. That predates the intel.cmake file. I'm not super well-versed in that version, but looking at the documentation here: 2.1.2 Using the Build/Run Scripts in the "bld" Directory

You can use the configure script in the bld directory with "-cam_bld <CASE_DIRECTORY/bld> -fflags "<FLAGS TO APPEND>" and that will hopefully work. You may have to play with it a bit (for instance, where the cam_bld directory should point to). Remember to do a clean build after you make changes.
 
  • Like
Reactions: csp
Top