MATLAB: Using DLL functions with parfeval

calllibparallel computingparfevalunknown library

Hello Everybody,
I have a script which does basically the following:
loadlibrary('myDLL','myHEADER')
p=parpool(2)
f=parfeval(p,@myFunction,numout,inputs...)
However, the DLL 'myDLL' is not known if I use calllib in myFunction. When I am using myFunction without parfeval, everything is fine. So I assume that I need to declare myDLL as input in parfeval or make it somehow global.
Using calllib in myFunction is not an option since it is too time consuming. I also do not use any unloadlibrary before using parfeval.
Thanks in advance
Alexander

Best Answer

Hi Alexander, using loadlibrary will load the dll only to the client MATLAB, not to the pool workers. You will need to do this as well. Please try
p = parpool(2);
% execute loadlibrary on all workers:
spmd
loadlibrary('myDLL', 'myHEADER');
end
f = parfeval(...);
Titus