CROCO w/ GPU compilation error

Hi, I wanto to compile croco-v2.1.3 so I’ve added #define openacc in cppdefs.h and selectec nvfortran as a compiler in jobcomp.

The following error appears. Any idea how to solve it?

nvfortran -c -g -fast -r8 -i4 -mcmodel=medium -Mbackslash -I/usr/include -acc -Minfo=accel get_bulk_.f -o get_bulk.o
set_bulk_tile:
2056, Generating update device(wspd(:,:))
2079, Generating update device(wspd(:,:),vwnd(:,:),uwnd(:,:),tair(:,:),rhum(:,:),radlw(:,:),prate(:,:),radsw(:,:),srflx(:,:))
cpp -traditional -DLinux -DXLF -P -I/usr/include -ICROCOFILES/AGRIF_INC bulk_flux.F > bulk_flux_.f1
python3 ./change_loops.py bulk_flux_.f1 bulk_flux_.tmp
cat bulk_flux_.tmp | ./mpc > bulk_flux_.f && \rm bulk_flux_.tmp
FORTRAN STOP
nvfortran -c -g -fast -r8 -i4 -mcmodel=medium -Mbackslash -I/usr/include -acc -Minfo=accel bulk_flux_.f -o bulk_flux.o
NVFORTRAN-S-0155-DO loop expected after ACC LOOP (bulk_flux_.f: 636)
0 inform, 0 warnings, 1 severes, 0 fatal for bulk_flux_tile
make: *** [Makedefs:15: bulk_flux.o] Error 2

Regards,

Andrés

Hi @AndresSepulveda
Remove this line: L-733 (!$acc loop seq ). It’s not needed here.

Try again to compile. pls let me know.
Thank you! best regards.

I was able to compile thanks. Now I have a problem reading the .in file

  Boundary File:  croco_bry.nc

Initial State File: croco_ini.nc Record: 1
Restart File: croco_rst.nc nrst = 89280 rec/file: 0
History File: croco_his.nc Create new: T nwrt =**** rec/file = 0
1 ntsavg Starting timestep for the accumulation of output
time-averaged data.
2880 navg Number of timesteps between writing of time-averaged
data into averages file.
Averages File: croco_avg.nc rec/file = 0

READ_INP ERROR while reading block with keyword ‘primary_history_fields’.

READ_INP ERROR: A total of 1 configuration errors discovered.

which is wierd because it is pretty standard

primary_history_fields: zeta UBAR VBAR U V wrtT(1:NT)
T T T T T 40T
auxiliary_history_fields: rho Omega W Akv Akt Aks Bvf Visc3d Diff3d HBL HBBL Bostr Bustr Bvstr Wstr Ustr Vstr Shfl Swfl rsw rlw lat sen HEL
F F T F T F F F F T T T F F T T T T T 10
*T

Hi,

in or nml I don’t think it will change but read_inp.F can.
Thank you with best regards.

The is there. It got lost in the copy paste. Seems it doesn’t like them. I’ve added just two T’s (for temperature and salinity) and removed the othet 10*T

Now it crashes with something related to the bulk_flux.F (I am using ONLINE)

FATAL ERROR: data in PRESENT clause was not found on device 1: name=stau(imin:imax,jmin:jmax) host:0x117f581a0
file:/home/andres/croco-v2.1.3/Tunisia_GPU/Compile/bulk_flux_.f bulk_flux_tile line:546

my bulk_flux.F file is from the latest oficial release

Hi,
after closer look at it, I find it.
add after this line (line 73) its only in v2.1.3 as well as the master branch. but master have few new var (aer, cer, etc).

# ifdef CFB_STRESS
!$acc&               ,stau
# endif

Please check its working or not (as you mention some of the card).
let me know.
Thank you with best regards.

No luck yet, this error shows

nvfortran -c -g -fast -r8 -i4 -mcmodel=medium -Mbackslash -I/usr/include -acc -Minfo=accel get_bulk_.f -o get_bulk.o
set_bulk_tile:
2164, Generating update device(wspd(:,:))
2187, Generating update device(wspd(:,:),vwnd(:,:),uwnd(:,:),tair(:,:),rhum(:,:),radlw(:,:),prate(:,:),radsw(:,:),srflx(:,:))
cpp -traditional -DLinux -DXLF -P -I/usr/include -ICROCOFILES/AGRIF_INC bulk_flux.F > bulk_flux_.f1
python3 ./change_loops.py bulk_flux_.f1 bulk_flux_.tmp
cat bulk_flux_.tmp | ./mpc > bulk_flux_.f && \rm bulk_flux_.tmp
FORTRAN STOP
nvfortran -c -g -fast -r8 -i4 -mcmodel=medium -Mbackslash -I/usr/include -acc -Minfo=accel bulk_flux_.f -o bulk_flux.o
NVFORTRAN-S-0038-Symbol, stau, has not been explicitly declared (bulk_flux_.f: 497)
NVFORTRAN-S-0050-Assumed size array, stau, is not a dummy argument (bulk_flux_.f: 522)
NVFORTRAN-W-0119-Redundant specification for stau (bulk_flux_.f: 522)
0 inform, 1 warnings, 2 severes, 0 fatal for bulk_flux_tile
make: *** [Makedefs:15: bulk_flux.o] Error 2s

Here is the modification done

!$acc declare create( cff  , cff2
!$acc&               ,rho0i, cpi  , RH   , Hlv     , wspd0
!$acc&               ,TseaC, TseaK, Qsea , Tvstar
!$acc&               ,TairC, TairK, Q    , rhoAir  , Bf
!$acc&               ,delW , delT , delQ , ddelW , ddelT , ddelQ
!$acc&               ,Cd   , Ch   , Ce   , iexns , iexna
!$acc&               ,Wstar, Tstar, Qstar, Wstar0  , Tstar0, Qstar0
!$acc&               ,psi_u, ZoLu, psi_t, ZoLt    , patm
!$acc&               ,hfsen, hflat, hflw , upvel   , evap
# ifdef CFB_STRESS
!$acc&               ,stau
# endif
!$acc&               )

Hi,
sorry. it’s my apology.
you need to add it here in line - 122 after.

!$acc declare create( aer, cer
# ifdef CFB_STRESS
!$acc&               ,stau
# endif
!$acc&               )

And revert your earlier change to the line-73.
ordering problem. because declared here.
Thank you with best regards.

Thanks for all the help, a problem persists.

allocated block device:0x7fbd1fe00000 size:2097152 thread:1
deleted block device:0x7fbbfe000000 size:69069312 threadid=1
FATAL ERROR: data in PRESENT clause was not found on device 1: name=stau(imin:imax,jmin:jmax) host:0x116f12f20
file:/home/andres/croco-v2.1.3/Tunisia_GPU/Compile/bulk_flux_.f bulk_flux_tile line:546

Fri 10 Jul 2026 09:20:53 PM UTC

Here are the files that I’ve modified

bulk_flux.f (35.2 KB)

bulk_flux_.f (40.2 KB)

Now it runs!

Seems the IF has to be declared this way

!$acc declare create( aer, cer )

# ifdef CFB_STRESS

!$acc declare create( stau )

# endif

(solution by Claude Code)

1 Like

Ok. Thank you.
It seems cpp -traditional pass through mpc.
best regards.