Clear Filters
Clear Filters

Problem using parallel computing in Python

5 views (last 30 days)
Ints
Ints on 26 Feb 2020
Edited: Ints on 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

Answers (0)

Categories

Find more on Python Package Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!