NCAR / DART

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

cce noah_hydro #599

Closed hkershaw-brown closed 9 months ago

hkershaw-brown commented 11 months ago

cce complaining about noad_hydro_mod. Not sure if this is a code error or the compiler falling over.

ftn -O2  -I/glade/u/apps/derecho/23.06/spack/opt/spack/netcdf/4.9.2/cce/15.0.1/cuko/include  -c /glade/derecho/scratch/hkershaw/build_everything/DART.cce/models/wrf_hydro/noah_hydro_mod.f90
   Error message      ::  _expr_type: Invalid table type
   Error detected     ::  File '/home/jenkins/crayftn/pdgcs/v_expr_utl.c', line 7360
   Initiated from     ::  Line 1280 (v_main.c)
   Optimizer built    ::  2023-01-20 (production)

   File               ::  /glade/derecho/scratch/hkershaw/build_everything/DART.cce/models/wrf_hydro/noah_hydro_mod.f90
   Function           ::  getchannelgridcoords
   at or near line    ::  660

   Compiler hash      ::  66f7391d6a03cf932f321b9f6b1d8612ef5f362c
   Target             ::  x86-milan

Creating internal compiler error backtrace (please wait):
[0x00000000c75a43] linux_backtrace ??:?
[0x00000000c76931] pdgcs_internal_error(char const*, char const*, int) ??:?
[0x0000000125c2d0] _expr_type(EXP_INFO) ??:?
[0x000000011d67e7] expr_mult(TYPE) ??:?
[0x00000000f7edd2] expr_replace_section(EXP_INFO, int, int, int, int, AS_LOOP*) v_as_conv.c:?
[0x00000000f7ef37] expr_replace_section(EXP_INFO, int, int, int, int, AS_LOOP*) v_as_conv.c:?
[0x00000000f7eb01] expr_replace_section(EXP_INFO, int, int, int, int, AS_LOOP*) v_as_conv.c:?
[0x00000000f7e519] replace_array_reduction(int, int, int, int, int, AS_LOOP*, TYPE, EXP_INFO, void (*)(TYPE), EXP_OP) v_as_conv.c:?
[0x00000000f7ffa3] expr_replace_section(EXP_INFO, int, int, int, int, AS_LOOP*) v_as_conv.c:?
[0x00000000f7eb22] expr_replace_section(EXP_INFO, int, int, int, int, AS_LOOP*) v_as_conv.c:?
[0x00000000f81e3a] convert_array_syntax_stmt(AS_STMT*, int, int) v_as_conv.c:?
[0x00000000f82f5a] build_loops_for_statements(int, int*, unsigned long) v_as_conv.c:?
[0x00000000f8813f] process_array_syntax_stmts() [clone .part.0] v_as_conv.c:?
[0x00000000f8a076] array_syntax_conversion() ??:?
[0x00000000873320] pdgcs_main ??:?
[0x00000000809fc2] PDGCS_do_proc ??:?
[0x0000000074bbf3] cvrt_proc_to_pdg m_cvrt.c:?
[0x0000000074c50f] m_cvrt_to_pdg ??:?
[0x000000007831b4] m_start_ipa ??:?
[0x00000000674da7] main ??:?
[0x007f23f98a329c] ?? ??:0
[0x00000000729d09] _start /home/abuild/rpmbuild/BUILD/glibc-2.31/csu/../sysdeps/x86_64/start.S:120

Note:  This is a non-debug compiler.  Technical support should
       continue problem isolation using a compiler built for
       debugging.

ftn-7991 ftn: INTERNAL GETCHANNELGRIDCOORDS, File = ../../../build_everything/DART.cce/models/wrf_hydro/noah_hydro_mod.f90, Line = 660 
  INTERNAL COMPILER ERROR:  "_expr_type: Invalid table type" (/home/jenkins/crayftn/pdgcs/v_expr_utl.c, line 7360, version 66f7391d6a03cf932f321b9f6b1d8612ef5f362c)
make: *** [Makefile:72: noah_hydro_mod.o] Error 1

models/noah models/wrf_hydro

mjs2369 commented 11 months ago

@mgharamti Helen and I were going over this issue and just wanted to clarify the intent behind the line producing this error:

https://github.com/NCAR/DART/blob/99ebec56a6efdd243ed026da24b29a1a45bb8cdd/models/wrf_hydro/noah_hydro_mod.f90#L660

The line is summing the value of all of the elements in the CH_NETRT array that are greater than or equal to 0, but all the elements in the array are set to 1, so it's essentially just counting the number of elements that fit that criteria. This can be done in a much simpler way n_link = count(CH_NETRT>=0), and using this line instead fixes the error and allows the module to compile successfully.

I just wanted to see if you can confirm that this is what the original line intended to do, since it is a complicated way to do this and is difficult to follow. Thanks!

mgharamti commented 10 months ago

@mjs2369 you're right. This is just counting the positive (and zero) links. And I agree with you; what a very complicated way to do it! I like your solution a lot more.

mjs2369 commented 9 months ago

Closed as completed via #619