New URL for NEMO forge!

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#415 (runtime array allocation error with AGRIF) – NEMO

Opened 14 years ago

Closed 13 years ago

Last modified 6 years ago

#415 closed Bug (fixed)

runtime array allocation error with AGRIF

Reported by: sga Owned by: nemo
Priority: low Milestone:
Component: AGRIF Version: trunk
Severity: Keywords: AGRIF MPI allocation/deallocation


Hello, I have a problem when running using trunk revision 1397 with ORCA2/LIM2 under MPI. I have modified the code, but I don't think it is the cause of the problem (famous last words!). During initialisation, the model gives me an allocation error.

I've tracked it to the deallocation of nrank_znl in routine lib_mpp.F90. When running with key_agrif, the code first tries to deallocate before allocating. If I comment this out (and the similar line for nrank_ice) the problem goes away. However, I guess this represents a memory leak since each time through, the agrif pointer is just getting reset each time to a new allocated lump of memory. Because in AGRIF world (after conv) nrank_znl has become a pointer, the ALLOCATED function won't work. Instead, ASSOCIATED does seem to work.

So my suggested solution is to use code like:

#if ! defined key_agrif

IF (ALLOCATED(nrank_znl)) DEALLOCATE(nrank_znl)


IF (ASSOCIATED(nrank_znl)) DEALLOCATE(nrank_znl)


for nrank_znl, nrank_ice and nrank_north.

However, finer minds than mine may have a better plan!

I also noticed while hunting for this bug that a number of newer routines have local allocatable arrays that are not deallocated. These are: trcadv_muscl.F90, trcbio.F90, trcexp.F90 and trcsed.F90. In each routine they are the arrays treated when l_trdtrc is true.

Finally, when experimenting on a mac with gfortran, I found that the compiler didn't like the '#include <mpif.h>' syntax, because it seems to assume that mpif.h must be in a system include directory (and in my case it isnt). Is there any reason to use this syntax rather than the double quotes? I also found that conv didn't seem understand the '!$AGRIF_DO_NOT_TREAT' declaration if there were any spaces before it on the line. I added a sed instruction to my makefile to cope with this, so it may not be a real problem.


Commit History (2)


Use fortran include for mpif.h instead of C style, see ticket #415


Correct some incompatibility with AGRIF, see #415 first part

Change History (3)

comment:1 Changed 13 years ago by rblod

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 7 years ago by nicolasmartin

  • Keywords allocation added; ALLOCATABLE removed

comment:3 Changed 6 years ago by nemo

  • Keywords allocation/deallocation added; allocation removed
Note: See TracTickets for help on using tickets.