Skip to content

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

Description

@alexhroom

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions