Matlab spmd and CoolProp (CPython library)

17 vues (au cours des 30 derniers jours)
Ibrahim KAYA
Ibrahim KAYA le 6 Mar 2023
Commenté : Ibrahim KAYA le 7 Mar 2023
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....

Réponse acceptée

Edric Ellis
Edric Ellis le 7 Mar 2023
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
  1 commentaire
Ibrahim KAYA
Ibrahim KAYA le 7 Mar 2023
it's working, thanks a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by