nansencenter / DAPPER

Data Assimilation with Python: a Package for Experimental Research
https://nansencenter.github.io/DAPPER
MIT License
341 stars 119 forks source link

Updating QG F90 typing #92

Closed cgrudz closed 2 years ago

cgrudz commented 2 years ago

f2py was giving warnings / errors over the size of arrays exceeding stack sizes on my cluser environment, yet I couldn't seem to find a way to change the stack size with ulimit commands or to pass a -fmax-stack-var-size= or a frecursive build option to gfortran through f2py as per the warning message. Changing the typing to allocatable and allocating the arrays in their instance as per https://www.scivision.dev/gfortran-stack-to-static-warning/ fixed these compile issues. Example issue is copied below:

qgflux.f90:71:34:

   71 |     real(8), dimension(N, M) :: J1, J2
      |                                  1
Warning: Array 'j1' at (1) is larger than limit set by '-fmax-stack-var-size=', moved from stack to static storage. This makes the procedure unsafe when called recursively, or concurrently from multiple threads. Consider using '-frecursive', or increase the '-fmax-stack-var-size=' limit, or change the code to use an ALLOCATABLE array. [-Wsurprising]
qgflux.f90:71:38:
patnr commented 2 years ago

I won't pretend to understand, since I don't really know Fortran. It seems like a weird warning, given current computing limits, even with recursion in the picture. I tested the PR, including checking that the same output is generated by the simulator -- all good. Thanks a lot!