Problem using parallel computing in Python

3 Ansichten (letzte 30 Tage)
Ints
Ints am 26 Feb. 2020
Bearbeitet: Ints am 26 Feb. 2020
Hello!
I have to prepare a Docker container with MCR and several Python packages (e.g. P1 and P2) compiled with SDK.
Both need parallel computing in functions (e.g. F1 and F2).
In Python, I import, initialize, run a function from the first one, then terminate.
Then I import the second one and when running a function from it, parallel pool is not started.
OS: Ubuntu 18.04, MATLAB 2019b
'local' profile used in both packages, selected in Preferences, local.mlsettings added to files of the packages.
Python (3.6.9) code:
import P1
h1=P1.initialize()
res1=h1.F1('params')
# runs with parpool displaying "Starting parallel pool..", "Connected ..", "..shutting down"
h1.terminate()
import P2
h2=P2.initialize()
res2=h2.F2('params')
# runs without parpool- messages not displayed
h2.terminate()
Is it possible to use parallel computing in this way or I have to compile all functions to one package (that is undesirable)?
Thanks, Ints

Antworten (0)

Kategorien

Mehr zu Python Package Integration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by