Warning not being suppressed during parfor loop

8 views (last 30 days)
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

Accepted Answer

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

More Answers (0)

Categories

Find more on Parallel Computing Fundamentals in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!