Warning not being suppressed during parfor loop

8 vues (au cours des 30 derniers jours)
Daniel Gordon
Daniel Gordon le 30 Oct 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

Réponse acceptée

Nikilesh Chilkuru
Nikilesh Chilkuru le 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

Plus de réponses (0)

Catégories

En savoir plus sur Parallel Computing Fundamentals dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by