'parpool(2)' fails

6 visualizzazioni (ultimi 30 giorni)
Cunxin
Cunxin il 16 Gen 2025
Commentato: Cunxin il 17 Gen 2025
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 Commenti
Walter Roberson
Walter Roberson il 16 Gen 2025

Do you have the Parallel Computing Toolbox installed?

Cunxin
Cunxin il 17 Gen 2025
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.

Accedi per commentare.

Risposte (1)

Sandeep Mishra
Sandeep Mishra il 17 Gen 2025
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 Commento
Cunxin
Cunxin il 17 Gen 2025
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?

Accedi per commentare.

Categorie

Scopri di più su Parallel Computing Fundamentals in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by