Parfor Undefined Function Error

19 views (last 30 days)
Brian M.
Brian M. on 10 Feb 2019
Commented: Brian M. on 21 Feb 2019
Hello,
I am attempting to use a parfor loop in the outer loop of my code. The code runs on my personal laptop computer (MATLAB R2018a), and also when 'parfor' is replaced with 'for'.
clear all;
close all;
%load data
load rf_IL6_rf_IL10_data_shifted_pulse.mat
%load weights
load weights_rf_IL6_rf_IL10.mat
%load T2 vals
load T2_IL10_RFIL6_RFIL10.mat
load T2_IL6_RFIL6_RFIL10.mat
%create initial guesses
params_IL6_init=[(1/2)*T2_IL6_init;T2_IL6_init;...
150*ones(1,length(T2_IL6_init))];
params_IL10_init=[(1/2)*T2_IL10_init;T2_IL10_init;...
50*ones(1,length(T2_IL10_init))];
weights=weights_rf_IL6_rf_IL10;
raw_data=rf_IL6_rf_IL10_data_shifted_pulse;
p=parpool(4);
listAutoAttachedFiles(p)
ms=MultiStart;
parameter_impulse_all_IL10={};
time_impulse_all_IL10={};
output_impulse_all_IL10={};
SSE_shifted_all={};
solutions_vector={};
parameter_impulse_all_IL6={};
time_impulse_all_IL6={};
output_impulse_all_IL6={};
tic;
%%
parfor i=1:2 %this is line 44 !!!
set=raw_data{i};
patient_number=[];
par_IL6={};
time_IL6={};
out_IL6={};
par_IL10={};
time_IL10={};
out_IL10={};
SSE_shifted=[];
solut={};
n=length(set);
for j=1:n
tydata=set{j};
patient_number(j)=tydata(1,1); %this is line 63!!!!!!!!
However, when I attempt to run the code on a server (the server has R2014a installed), I get the following errors:
Error in run (line 63)
evalin('caller', [script ';']);
>> run find_params_cytokine_rf_IL6_rf_IL10_pulse_2.m
Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers.
No files automatically added to the parallel pool.
Analyzing and transferring files to the workers ...done.
Error using find_params_cytokine_rf_IL6_rf_IL10_pulse_2 (line 44)
An UndefinedFunction error was thrown on the workers for '%U2'. This might be
because the file containing '%U2' is not accessible on the workers. Use
addAttachedFiles(pool, files) to specify the required files to be attached.
See the documentation for 'parallel.Pool/addAttachedFiles' for more details.
Error in run (line 63)
evalin('caller', [script ';']);
Caused by:
Undefined function or variable "%U2".
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
There is no variable/function call to "%U2" in my code. I am trying to narrow down if this error is due to an issue with how I am setting up parfor or an issue with the version of MATLAB on the server. The body of the parfor loop consists of two other inner loops using fmincon and simulink.
Thanks!
  5 Comments
Brian M.
Brian M. on 10 Feb 2019
OK great-thanks for the information. My gut was that it was a bug but wanted to be sure.
Brian M.
Brian M. on 21 Feb 2019
Just a follow up, I was able to get somebody to update and install the newest version of MATLAB. Now I have a different error:
Error due to multiple causes.
Error in run (line 91)
evalin('caller', strcat(script, ';'));
Caused by:
Error using parallel_function>make_general_channel/channel_general (line
917)
Transparency violation error.
See Parallel Computing Toolbox documentation about Transparency
Error using parallel_function>make_general_channel/channel_general (line
917)
Error while evaluating LifeSpan parameter. Default application life span
(1) day will be used
>> IdleTimeout has been reached.
Parallel pool using the 'local' profile is shutting down.
I was wondering if you could lead me into the right direction of what could be causing this particular issue. I am assuming it has to do with the way I am calling simulink in the loop.

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Products


Release

R2014a

Community Treasure Hunt

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

Start Hunting!