yambo-code / yambo

This is the official GPL repository of the yambo code
http://www.yambo-code.eu/
GNU General Public License v2.0
99 stars 39 forks source link

fft_3d is not thread safe #145

Open sangallidavide opened 3 weeks ago

sangallidavide commented 3 weeks ago

https://github.com/yambo-code/yambo/blob/master/src/wf_and_fft/fft_3d_fftw.F is not thread safe if fftw_plan=0.

In yambo, by chance, the subroutine, when called inside multi-thread loops, seems to always be in the situation with fftw_plan\=0.

Still, the subroutine is not thread safe and it is called deep insided OpenMP loops

andrea-ferretti commented 3 weeks ago

I think a possible fix is to have a routine dedicated to the initialization of the FFTs, to be explicitly called in the drivers before the parallel regions where scatterBamp (to make an example is called). At present this is sorted out by WF_load (which, most of the time, initializes FFTs), but it looks as a fragile situation.