'parpool(2)' fails

조회 수: 9 (최근 30일)
Cunxin
Cunxin 2025년 1월 16일
댓글: Cunxin 2025년 1월 17일
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일

Do you have the Parallel Computing Toolbox installed?

Cunxin
Cunxin 2025년 1월 17일
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일
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
Cunxin 2025년 1월 17일
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 CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by