cplex error in parallel run

조회 수: 2 (최근 30일)
Maziar Salahi
Maziar Salahi 2022년 2월 18일
답변: TARUN 2025년 6월 12일

I use cplex in parallel in matlab to solve some quadratic problems and get sometimes the following error.
An UndefinedFunction error was thrown on the workers for 'Undefined
function 'handleparams' for input arguments of type 'double'.'.
This might be because the file containing 'Undefined function
'handleparams' for input arguments of type 'double'.' 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 test_qcqp_rank1 (line 181)
OPTIM_new=One_Negative_Eig_new(2*Q,a,App,bpp,xlb,xub);

Caused by:
Error using cplexqcp
Undefined function 'handleparams' for input arguments of type
'double'.

답변 (1개)

TARUN
TARUN 2025년 6월 12일
The error you're encountering (Undefined function handleparams for input arguments of type double) means that the MATLAB function handleparams.mis not available to the parallel workers when your code runs.
This usually happens in parallel computing because the workers run in their own space and don't automatically have access to all your local files. So, if your code uses a custom function like handleparams, you need to manually send that file to the workers.
To fix it, you can use this command before executing your parallel job:
addAttachedFiles(gcp, {'handleparams.m'});
This tells MATLAB to send the file to all the workers. Just make sure the file handleparams.m is in your current folder or somewhere on the MATLAB path.
Feel free to go through the following documentation:
Parallel Pool File Attachments:
gcp:

카테고리

Help CenterFile Exchange에서 MATLAB Mobile Fundamentals에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by