rwesson / ALFA

Automated Line Fitting Algorithm

Home Page:http://www.nebulousresearch.org/codes/alfa/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stack Size Exceeded

adorta opened this issue · comments

Hi!

We've been experiencing a recurring error:

At line 332 of file source/alfa.f90
Internal Error: stash_internal_unit(): Stack Size Exceeded

Checking those lines I see:

332   write (filenameformat(1),"(A,I1,A,I1)") "I",floor(log10(real(axes(1))))+1,".",floor(log10(real(axes(1))))+1
333   write (filenameformat(2),"(A,I1,A,I1)") "I",floor(log10(real(axes(2))))+1,".",floor(log10(real(axes(2))))+1

The problem seems to be related to those I/O operations, while read operations are thread-safe, in this case it seems that write ops are not. Maybe this is caused by our particular libraries (we use Fedora26 and gfortran 7.2.1). I've also compiled with -pthread, but problems are still there.

I have fixed this issue adding an OpenMP Critical section:

332 !$OMP CRITICAL
333   write (filenameformat(1),"(A,I1,A,I1)") "I",floor(log10(real(axes(1))))+1,".",floor(log10(real(axes(1))))+1
334   write (filenameformat(2),"(A,I1,A,I1)") "I",floor(log10(real(axes(2))))+1,".",floor(log10(real(axes(2))))+1
335 !$OMP END CRITICAL

Could you please let us know if there is a better way to fix this issue?

Thanks!