Compilation problem with test cases including AGRIF: DOME VORTEX

Hi,
With NEMO v5, I can compile ans run some test case as OVERFLOW. But I got compilation error when AGIF is used. Here what I get when I try :
./makenemo -r DOME -n MY_DOME -m X64_APP_INTEL_IMPI


Build stage BLD_AGRIFLIB

->Parse configuration: 0 second
->Setup destination: 0 second
->Setup build: 0 second
->Pre-process: 0 second
->Scan dependency: 0 second
->Generate Fortran interface: 0 second
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
In file included from /scratch/sennsi01/nemo_5.0-beta/ext/AGRIF/LIB/UtilFortran.c:38:
/scratch/sennsi01/nemo_5.0-beta/ext/AGRIF/LIB/decl.h:535:13: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C23, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
535 | extern void Write_Closing_Module();
| ^
/scratch/sennsi01/nemo_5.0-beta/ext/AGRIF/LIB/UtilFortran.c:266:6: note: conflicting prototype is here
266 | void Write_Closing_Module(int forend)
| ^
/scratch/sennsi01/nemo_5.0-beta/ext/AGRIF/LIB/UtilFortran.c:674:52: warning: format specifies type ‘char *’ but the argument has type ‘listname *’ (aka ‘struct listname *’) [-Wformat]
674 | fprintf(stderr, " var->v_initialvalue: %s\n",var->v_initialvalue);
| ~~ ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]
fortran.tab.c:3463:16: error: call to undeclared function ‘fortran_lex’; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
3463 | yychar = yylex ();
| ^
/scratch/sennsi01/nemo_5.0-beta/ext/AGRIF/LIB/fortran.c:64:25: note: expanded from macro ‘yylex’
64 | #define yylex fortran_lex
| ^
fortran.y:1510:41: warning: passing arguments to ‘Write_Closing_Module’ without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
1510 | Write_Closing_Module(1);
| ^
fortran.y:2417:60: warning: format specifies type ‘char *’ but the argument has type ‘listname *’ (aka ‘struct listname *’) [-Wformat]
2417 | printf(“AUTRE = %s %s\n”,(yyvsp[-7].l)->var->v_nomvar,(yyvsp[-7].l)->var->v_initialvalue_array);
| ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fortran.y:3983:41: warning: passing arguments to ‘Write_Closing_Module’ without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
3983 | Write_Closing_Module(1);
| ^
fortran.y:4663:41: warning: passing arguments to ‘Write_Closing_Module’ without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
4663 | Write_Closing_Module(0);
| ^
fortran.lex:51:9: warning: ‘YY_BUF_SIZE’ macro redefined [-Wmacro-redefined]
51 | #define YY_BUF_SIZE 64000
| ^
fortran.yy.c:159:9: note: previous definition is here
159 | #define YY_BUF_SIZE 16384
| ^
5 warnings and 1 error generated.
fcm_internal compile failed (256)
make: *** [/scratch/sennsi01/nemo_5.0-beta/tests/MY_DOME/BLD_AGRIFLIB/Makefile:391: fortran.o] Error 1
make -s -f /scratch/sennsi01/nemo_5.0-beta/tests/MY_DOME/BLD_AGRIFLIB/Makefile -j 1 all failed (2) at /scratch/sennsi01/nemo_5.0-beta/ext/FCM/bin/…/lib/Fcm/Build.pm line 597.
->Make: 3 seconds

I see an error from icx. I surprised to see a reference to this c++ compiler as there is no c++ in NEMO.
Could you give us the contain of your arch-X64_APP_INTEL_IMPI.fcm file?
You should have:
%CC icc

Thank you!
I have some issues to put icc in my apptainer container, but I tried with cc and it worked. I’ll work to get icc and recompile with it after.

if cc works, go for it !
AGRIF uses a C compiler for the preprocessing of the the file. It has no impact on the compiled routines that are in fortran.

1 Like

Hi,
I step up to the occasion to share a similar AGRIF conv compilation problem (under gcc 14.2.0). It is related to routines /ext/AGRIF/LIB/fortran.c and /ext/AGRIF/LIB/main.c for which we had obscure compiltation errors. Problem has been solved (without knowing why !!!) by moving some definitions (fortran_lex and convert_lex) upwards. Here are the changes for each file:

[jchanut@lir-frontal-1 nemo]$ git diff ext/AGRIF/LIB/fortran.c
diff --git a/ext/AGRIF/LIB/fortran.c b/ext/AGRIF/LIB/fortran.c
index b9bf767d..76eb03c4 100644
--- a/ext/AGRIF/LIB/fortran.c
+++ b/ext/AGRIF/LIB/fortran.c
@@ -377,7 +377,7 @@ extern YYSTYPE fortran_lval;
 
 int fortran_parse (void);
 
-
+extern int fortran_lex (void);
 
 /* Copy the second part of user declarations.  */
 
@@ -10611,7 +10611,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int fortran_lex (void);
+/*extern int fortran_lex (void);*/
 
 #define YY_DECL int fortran_lex (void)
 #endif /* !YY_DECL */ode here

and:

[jchanut@lir-frontal-1 nemo]$ git diff ext/AGRIF/LIB/main.c
diff --git a/ext/AGRIF/LIB/main.c b/ext/AGRIF/LIB/main.c
index 52a9a9e6..219833a9 100644
--- a/ext/AGRIF/LIB/main.c
+++ b/ext/AGRIF/LIB/main.c
@@ -154,7 +154,7 @@ extern YYSTYPE convert_lval;
 
 int convert_parse (void);
 
-
+extern int convert_lex (void);
 
 /* Copy the second part of user declarations.  */
 
@@ -2639,7 +2639,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int convert_lex (void);
+/*extern int convert_lex (void);*/
 
 #define YY_DECL int convert_lex (void)
 #endif /* !YY_DECL */
1 Like

Hi,

I complete a DOME run with the nemo5-beta (no AGRIF and ln_read_cfg = .false.), but even if the NEMO 5 compile, I still get a segmentation fault when I run it, before the 1st time step complete (no time step file).

No AgriF:
AGRIF_FixedGrids.in:
0
281 361 121 169 2 2 2
0

The last line of ocean.outpput (no E R R O R in the file):

      dyn_spg_ts : surface pressure gradient trend
       ~~~~~~~~~~   free surface with time splitting

And then I get a segmentation fault. Any Idea why? No problem when you test it?

Thank you for your time.

Hi,

How did you fix your compilation problem ?
I checked DOME in the 5.0 release, and indeed, there are some issues. DOME is actually not part of our routine tests (the so called “sette” tests), so this has not been detected. It appears that the bdyvol.F90 module located in /tests/DOME/MY_SRC is to be incriminated. They are some unallocated arrays (rnf(:,:) for example), which may explain your error. It’s quite easy to fix the problem by comparing the bdyvol module to the reference one located in /src/OCE/BDY. Fixing that, I however found some weird effects in the volume correction along boundaries (it is assumed that the total volume remains constant by adding a flux correction to the west open boundary that compensate for the inflow to the north).
I will raise a ticket and fix the problem asap.

Jérôme

For the compilation , I replaced icx by cc as compiler in the arch file (as suggested by smasson).

    # %CC                  icx
    # %CFLAGS              -O0 -lstdc++
    %CC                  cc
    %CFLAGS              -O0  

Thank you for the verification on DOME, I’ll use the nemo5-beta until you had time to fix it. Can I be kept in touch once it’s done?

Here is a quick fix if you want to check: Draft: Resolve "DOME experiment does not compile" (!832) · Merge requests · NEMO Workspace / Nemo · GitLab

(Basically replace your /tests/DOME/MY_SRC/bdyvol.F90 file by this one)

Perfect! It work now, thank you for your quick answers!