Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run MATLAB engine processes in parallel on Linux #50

Open
alexhroom opened this issue Jan 15, 2025 · 0 comments
Open

Can't run MATLAB engine processes in parallel on Linux #50

alexhroom opened this issue Jan 15, 2025 · 0 comments

Comments

@alexhroom
Copy link

see the following example, first with threads:

import matlab.engine
from concurrent.futures import ThreadPoolExecutor

def matlab_func(i):
    eng = matlab.engine.start_matlab()
    return eng.sqrt(i)

with ThreadPoolExecutor() as executor:
    future = executor.submit(matlab_func, 4.0)
    print(future.result())

vs the same with Processes:

import matlab.engine
from concurrent.futures import ProcessPoolExecutor

def matlab_func(i):
    eng = matlab.engine.start_matlab()
    return eng.sqrt(i)

with ProcessPoolExecutor() as executor:
    future = executor.submit(matlab_func, 4.0)
    print(future.result())

I find that the thread example works, but the process example runs forever.

This is with matlabengine version 24.2.2, MATLAB R2024b Update 3 on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant