Matlab spmd and CoolProp (CPython library)

57 ビュー (過去 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
  1 件のコメント
Ibrahim KAYA
Ibrahim KAYA 2023 年 3 月 7 日
it's working, thanks a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDistributed Arrays についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by