Matlab spmd and CoolProp (CPython library)

조회 수: 54 (최근 30일)
Ibrahim KAYA
Ibrahim KAYA 2023년 3월 6일
댓글: Ibrahim KAYA 2023년 3월 7일
Hi everone,
when i want to run the following code block in matlab spmd in Windows 11,
CP = py.importlib.import_module('CoolProp');
Fluid = CP.AbstractState("HEOS", 'water');
n = 4;
T = 300 + 273.15;
P = 100;
spmd (n)
T = T + 10*spmdIndex;
Fluid.update(CP.PT_INPUTS, P*1000, T);
Fluid.cpmass();
Fluid.rhomass();
Fluid.conductivity();
Fluid.viscosity();
end
I got the error shown in below;
Worker 1:
Warning: Unable to load Python object. Saving (serializing) Python objects into a MAT-file is not supported.
> In parallel.internal.pool.deserialize (line 33)
In parallel.internal.pool.deserializeFunction (line 17)
In spmdlang.remoteBlockExecution>iDeserializeInputs (line 59)
In spmdlang.remoteBlockExecution>iUnpackPreludeArgs (line 46)
In spmdlang.remoteBlockExecution (line 12)
Warning: Unable to load Python object. Saving (serializing) Python objects into a MAT-file is not supported.
> In parallel.internal.pool.deserialize (line 33)
In parallel.internal.pool.deserializeFunction (line 17)
In spmdlang.remoteBlockExecution>iDeserializeInputs (line 59)
In spmdlang.remoteBlockExecution>iUnpackPreludeArgs (line 46)
In spmdlang.remoteBlockExecution (line 12)
What can I do for this problem, I will be glad if you help me....

채택된 답변

Edric Ellis
Edric Ellis 2023년 3월 7일
You need to avoid transferring the objects to the workers, and instead simply build the objects directly on the workers. The simplest way to do this is to move the lines creating CP and Fluid inside your spmd block, like this:
n = 4;
T = 300 + 273.15;
P = 100;
spmd (n)
CP = py.importlib.import_module('CoolProp');
Fluid = CP.AbstractState("HEOS", 'water');
T = T + 10*spmdIndex;
...
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Distributed Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by