using actxserver (COM-dll) in parallel optimization
1 view (last 30 days)
Show older comments
Hi,
i run an optimization using fmincon, where the function evaluation uses Fortran code. The Fortran code is compiled to a COM-dll. I register the dll in Windows and open a server in Matlab using
server = actxserver ('Server4.Server4');
This is done before calling fmincon and the handle is passed to the objectivefunction as Argument. The objectivefunction calls:
foobar = server.foo(bar);
This is working.
Now, i try to run my optimization in parallel mode. Therefore i set the option 'UseParallel' to 'Always'. When i run the code now i get the follwing error:
??? Error using ==> parallel_function at 598
Error in ==> objective at 41
Attempt to reference field of non-structure array.
Error in ==> C:\Programme\MATLAB\R2010b\toolbox\shared\optimlib\parfinitedifferences.p>parfinitedifferences at 115
Error in ==> C:\Programme\MATLAB\R2010b\toolbox\optim\optim\private\computeFinDiffGradAndJac.p>computeFinDiffGradAndJac at 45
Error in ==> C:\Programme\MATLAB\R2010b\toolbox\optim\optim\barrier.p>barrier at 201
Error in ==> fmincon at 806
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options_ip.HessFcn, ...
Error in ==> process at 39
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = fmincon(@(x) ...
The Line, that the error is complaining about is the above mentioned:
foobar = server.foo(bar);
Is there a general problem using the actxserver or a COM-DLL in parallel applications or am i doing something wrong??
Thanks in advance, Matthias
0 Comments
Answers (2)
Walter Roberson
on 27 May 2011
I wonder... maybe if before the parallel part you used
serverfoo = @server.foo;
and then called serverfoo(bar) in the routine ?
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!