Mex files and parallel processing
29 views (last 30 days)
I have a function that uses parfor and I could successfully run it on my local cluster. When running, I could see that the local cluster was starting and was active.
From this file, I created a mex file. The mex file is created on my local machine (Win) and then I run it by using the local cluster (so, always Win). However, when the mex is running, the local cluster does not start. When I first start it, it goes in idle mode while the mex is running. So I assume that the mex file does not run in parallel.
The mex file is compiled for C language, and the default compiler is MinGW64. Shouldn't this be fine for parallel computation of mex files?
>> mex -setup
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
Walter Roberson on 26 Aug 2021
Edited: Walter Roberson on 26 Aug 2021
Historically, MINGW did not support OpenMP, which is what parfor compiles into if you ask to generate code for parfor.
If I recall correctly, you need one of the Microsoft compilers -- but if I recall correctly, any of the Community or Express editions since 2011 should work (but not SDK 7.1), provided that the edition is supported by your MATLAB release.