'parpool(2)' fails

46 ビュー (過去 30 日間)
Cunxin Huang
Cunxin Huang 2025 年 1 月 16 日 17:41
コメント済み: Cunxin Huang 2025 年 1 月 17 日 6:24
Hi, I am testing some MATLAB code via GitHub Action. Strange bug occurs when I was testing `parpool(2)` with MATLAB R2021b and R2022a on Mac and Ubuntu as follows.
Error using parpool
Undefined function 'pCurrentTaskIsPartOfAPool' for input arguments of type
'double'.
Error in solveAllProblems (line 68)
parpool(numJobs);
The code is fine with the latest verion of MATLAB.
Any comment helps.
  2 件のコメント
Walter Roberson
Walter Roberson 2025 年 1 月 16 日 18:10

Do you have the Parallel Computing Toolbox installed?

Cunxin Huang
Cunxin Huang 2025 年 1 月 17 日 1:04
Sure, following is part of the code for the workflow of GitHub Action.
name: test parallel computing toolbox
on:
push:
branches: [matlab]
jobs:
test:
name: MATLAB ${{ matrix.matlab }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
matlab: [latest, R2021b, R2022a, R2022b, R2023a, R2023b]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up MATLAB with optimization toolbox and parallel computing toolbox
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab }}
cache: true
products: Optimization_Toolbox Parallel_Computing_Toolbox
- name: Test parallel computing
uses: matlab-actions/run-command@v2.1.1
with:
command: |
parpool(2)
You can directly try the above code.

サインインしてコメントする。

回答 (1 件)

Sandeep Mishra
Sandeep Mishra 2025 年 1 月 17 日 5:39
Hi Cunxin,
I tried to execute the GitHub Action and observed the same error message on all OS (Windows, Ubuntu and Mac) for MATLAB R2022b.
The issue arises because parpools with batch licensing are not supported in MATLAB versions prior to R2023a.
To resolve this, I recommend upgrading to MATLAB R2023a or later, which supports the use of parpools with batch licensing.
I hope this helps you!
  1 件のコメント
Cunxin Huang
Cunxin Huang 2025 年 1 月 17 日 6:24
Thanks for your kind reply.
If this is true, then MATLAB documents provide wrong information.
In the help center for parpool, version history part states that:
""""""""
R2022b: Specify number of thread workers
Starting in R2022b, you can now specify the pool size of a thread-based parallel pool using the parpool(poolsize) syntax.
""""""""
Beside this, I guess earlier version should support process-based parallel pool using the parpool(poolsize) syntax?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParallel Computing Fundamentals についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by