Borrar filtros
Borrar filtros

I get the Error "Undefined function 'colon' for input arguments of type 'double'" when I want to devide the code to be run on all my CPU cores.

4 visualizaciones (últimos 30 días)
Hi everyone,
I rote a code and it works fine but when I decided to make it be run on all of my CPU cores I get this error:
""Error using fonc_modele_manip1 (line 31)
An UndefinedFunction error was thrown on the workers for 'colon'. This might be because the file containing 'colon' is not
accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be attached. For more
information see the documentation for 'parallel.Pool/addAttachedFiles'.
Error in finDiffEvalAndChkErr
Error in parfinitedifferences
Error in parfinitedifferences
Error in computeFinDiffGradAndJac
Error in sqpInterface
Error in fmincon (line 823)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = sqpInterface(funfcn,X,full(A),full(B),full(Aeq),full(Beq), ...
Error in globalsearchnlp
Error in GlobalSearch/run (line 340)
globalsearchnlp(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,options,localOptions);
Error in Optimization (line 41)
[A,f] = run(gs,problem);
Caused by:
Undefined function 'colon' for input arguments of type 'double' and attributes 'full 3d real'.
Failure in initial call to fmincon with user-supplied problem structure.""
And Here is the code itself:
clc
clear
close all
parpool('local')
opts = optimoptions(@fmincon,'Algorithm','sqp','UseParallel',true);
problem = createOptimProblem('fmincon',...
'objective',@fonc_modele_manip1,...
'x0',[13 6 20],...
'lb',[0 0 0],...
'ub',[200 200 200],...
'options',opts);
Results=zeros(16,7);
finpoints = [-15 -10 -5 0 5 10 15];
global fin
global dep
global tim
global i
i=1;
for fin=1:2:7
dep= (fin + 1)/2;
for tim=1:4
gs = GlobalSearch;
[A,f] = run(gs,problem);
Results(i,:)=[fin dep tim A f];
[A f]
e = fonc_modele_manip1_plot(A)
i=i+1;
end
end
save('EfficientKandB16to6_exp_ErroronXdd_with0.05_ub200_parallel.mat','Results')
load handel
sound(y,Fs)
I only added the "parpool('local') " and ",'UseParallel',true" to the code and got that error.
Can anybody tell me why and what is the best way of deviding the process of my code between the cores of my CPU?
Thank you all

Respuestas (0)

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by