Can't run MATLAB engine processes in parallel on Linux

Open
#50 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
matlab, python
Domain
backend

Research direction

Start by running the supplied ThreadPoolExecutor and ProcessPoolExecutor examples with matlabengine 24.2.2, MATLAB R2024b Update 3, and Linux, then compare the engine startup behavior. Investigate why the process example does not complete; done means the process-based example finishes and returns the expected square-root result like the thread-based example.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
97
Forks
13
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mathworks/matlab-engine-for-python

All issues in mathworks/matlab-engine-for-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.