Could not load Matlab parallel parpool.m in a C# wrapper

Hi Matlab experts,
I am trying to call Matlab parallel parpool.m in Matlab runtime MCR 2015a. However there is an exception throw out in parpool.m. Here is screenshot of error message and the code. I appreciate any advice and suggestion. Thank you!
if isToolboxInstalled('Distrib_Computing_Toolbox')
parallel=true;
p = gcp('nocreate'); %% get current parpool
if isempty(p)
disp('parpool is empty, create new parpool');
parpool(numThreads);
else
%% parpool is not empty
disp('parpool is not empty');
if(p.NumWorkers == numThreads)
%% do nothing
else
disp('need to recreate parpool');
%% current parpool is not the size we desire
delete(p);
parpool(numThreads);
end
end
end

Answers (1)

What is line #14 in driver_evaluate_callibration? And have you been able to successfully run this in MATLAB (not compiled)?

4 Comments

Hi Raymond,
Thank you for your time. I could run it in the Matlab(not compiled in C# wrapper). But could not run it from complied MCR.
driver_evaluate_calibration(), line 14
[statusA, out, err] = driver_evaluate_calibration_parfeval(inpath, numThreads);
driver_evaluate_calibration_parfeval(), line 28
parpool(numThreads);
Best regards,
If I have this right:
  • You call driver_evaluate_calibration
  • on line 14, you call driver_evaluate_calibration_parfeval
  • on line 28, you call parpool
The code you included make two calls to parpool, both with numThreads, I'm assuming one of them is line 28 (which one, I'm guessing the 1st one?). Can you print the value of numThreads before your call to parpool?
The numThreads is equal to 1. I tested numThreads as 1 and 5, and both failed in the same error.
What you're saying is that you can reproduce this with a one-liner
parpool(1)
and C# would error out. Can you add before the call to parpool
parallel.defaultClusterProfile
I believe the local profile should automatically be included, but there's a section in the documentation that describes bundling other profiles
https://www.mathworks.com/help/compiler/use-the-parallel-computing-toolbox.html

Sign in to comment.

Categories

Products

Release

R2015a

Asked:

on 15 Oct 2021

Commented:

on 15 Oct 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!