C2C FFT returning Nan on random runs


I am using cufftExecC2C for a forward FFT. I wrote this block of code a few weeks ago and it worked great. But now every 1-4 separate runs cufftExecC2C return Nan.

I think the problem is rooted in cufftPlan1d so I used cufftPlanMany. cufftPlanMany had the same behaviour.

I am also using cufftSetStream to stream. But when I comment this out it still has the same behaviour.

Any suggestions?