Is it not possible to call a Matlab .DLL from .NET in parallel?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a compiled Matlab DLL called "GeneticAlgorithmOptimizer.dll" with a class/method "gaOptimizer.optimize()" that uses said algorithm to generate a solution based on some input data and parameters. It takes about an hour to generate the solution.
I would like to call it in parallel through a .NET application like so:
List<bool> boolList= new List<bool> { false, true };
Dictionary<bool, double[]> matlabSolutions = new Dictionary<bool, double[]>();
Parallel.ForEach(boolValueList, (boolValue) =>
{
var inputData = dataGetter.getData(boolValue);
var parameters = parametersGetter.getParameters(boolData);
var opt = new gaOptimizer();
% THIS IS WHERE THE MATLAB DLL IS CALLED
result = opt.optimize(inputData, parameters);
lock (matlabSolutionsBothPools)
{
matlabSolutions.Add(boolValue, result);
}
});
However, the calls to Matlab end up happening in sequence rather in parallel. The first one has to complete before the second one starts.
Is this a limitation of Matlab? Does anyone know a way around this?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!