Matlab spmd and CoolProp (CPython library)
22 次查看(过去 30 天)
显示 更早的评论
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....
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!