Hi Meddi,
As per my understanding, you have written a mex code that utilizes the FFTW library and are facing issues while using parallelization.
Without the actual code, it is quite difficult to tell the error upfront, but from the explanation that you have provided, you can try the below workarounds for debugging out the issue:
- This could be because a worker crashed; if this has happened, then analyze the crash log and see whether the mex code is causing this crash or not. If the mex code is the reason, then try running the mex code locally to see if it works fine. You can refer to the following documentation link to read more about it: https://in.mathworks.com/support/search.html/answers/336076-how-do-i-troubleshoot-the-lost-connection-to-worker-x-parallel-error.html?fq%5B%5D=asset_type_name:answer&fq%5B%5D=category:matlab-parallel-server/index&page=1
- It might be possible that a deadlock was occurring while the workers were trying to access a particular resource. If this is the case, then you need to write thread-safe implementations. You can read more about this issue at the following link: https://in.mathworks.com/support/search.html/answers/273509-parfor-loop-just-hangs-cpu-usage-goes-to-zero.html?fq%5B%5D=asset_type_name:answer&fq%5B%5D=category:parallel-computing/parallel-computing-fundamentals&page=1
- Additionally, you can refer to the following link, which has some example code where "parfor" is used along with the FFTW: https://in.mathworks.com/help/coder/ug/synchronize-access-to-fftw-planning-in-generated-standalone-code.html
I hope this helps!