Warning not being suppressed during parfor loop

1 Ansicht (letzte 30 Tage)
Daniel Gordon
Daniel Gordon am 30 Okt. 2018
I'm running a parfor loop. Within the loop, occasionally the following error is thrown:
Warning: File not found or permission denied
I've attempted to disable this warning on each core (I deal with the cause of the error separately) as follows:
spmd
warning('off', 'MATLAB:DELETE:PermissionDenied');
end
...
parfor
do stuff
end
But the warning still occurs.
Does anyone have any thoughts on how I'm going wrong?
Cheers

Akzeptierte Antwort

Nikilesh Chilkuru
Nikilesh Chilkuru am 1 Nov. 2018
I have tried to reproduce this issue using a known warning:'MATLAB:rmpath:DirNotFound'
Reproduction Code:
parpool(2) % creating a parallel pool of two workers
spmd
warning('off','MATLAB:rmpath:DirNotFound')
end
parfor i = 1:2
rmpath('folderthatisnotonpath')
end
Turning off a warning in spmd suppresses the warning in workers successfully. I believe that the warning you are turning off might be incorrect. To see the identifier of the last issued warning
w = warning('query','last') % put these two lines in the parfor loop after the line that causes this error
w.identifier % this contains the warning identifier
You can see the identifier of the warning from the field 'identifier' of struct'w' returned by above command. This is the warning you should turn off to suppress that warning. To get more information on how to suppress warnings, refer: Suppress Warnings

Weitere Antworten (0)

Kategorien

Mehr zu Parallel for-Loops (parfor) finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by