MATLAB closing when beginning parallel processing

19 visualizaciones (últimos 30 días)
BobbyRoberts
BobbyRoberts el 7 de Mayo de 2022
Respondida: Shivang el 22 de Nov. de 2023
It was working all day while I troubleshooted some things. Now, for some reason, MATLAB closes without any warning - just shuts off - when starting the parallel computing using the Parfor function. Does anyone have any ideas to what could be causing this issue? Thanks.
  2 comentarios
Riccardo Scorretti
Riccardo Scorretti el 8 de Mayo de 2022
I see three possible options (but without the code it is hard to help you):
  1. Unreprodutcible error: sometimes it happens; like any program of more than a single line, MATLAB is not exempt from bugs.
  2. Out of memory: it may be possible that you are running out of memory. Can you check this with a reduced dataset, or by running on another computer with more memory?
  3. Invalid MEX function: if you wrote MEX functions, and you use them in a parallel section, perhaps you can have some troubles (depending what you are doing, and how you are doing exactly) with work sharing by using parallel for. I admit I have no experience with this particular point.
BobbyRoberts
BobbyRoberts el 8 de Mayo de 2022
Thanks, Riccardo. My memory is fine, and the code was working before..
I think the problem started after I quit MATLAB mid-function a couple times. I'm thinking that it could be because there's still something running or open in the background. I can't seem to find out what, but I'm hopinng there's some type of function to basically reset this. However, restarting the program or the computer did not fix it either.

Iniciar sesión para comentar.

Respuestas (1)

Shivang
Shivang el 22 de Nov. de 2023
Hi,
I understand you are facing an issue where MATLAB shuts off when using the 'parfor' function.
While it is hard to pinpoint an issue without the code and the crash logs, you can try the following approach. Move the parfor-loop into a local function in the 'main file', passing any variables into and out of the local function as input and output arguments respectively.
From:
main.m
% user-code berfore parfor-loop
parfor i=1:10
% user-code
end
To:
main.m (modified)
% user-code berfore parfor-loop
runParforLoop()
function ParforLoop()
parfor i=1:10
% user-code
end
end
Refer to this documentation link for more details regarding local functions: https://www.mathworks.com/help/matlab/matlab_prog/local-functions.html
Hope this helps.
-Shivang

Categorías

Más información sobre Parallel for-Loops (parfor) en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by