isvalid() and distributed data

1 view (last 30 days)
Karl
Karl on 10 Mar 2016
Why isn't "isvalid()" defined for distributed data?
Distributing large data sets among parallel workers can take up to several minutes. If a valid copy of distributed data already exists on the workers, there is no need to distribute it again and it's preferable to skip that operation.
When a parallel pool is deleted, the distributed data that resided on the workers (understandably) goes invalid, but the variable still remains in the workspace. If you query isreal() on the data, Matlab specifically states that the data is not valid. Opening a new pool does not make the data valid - the data has to be distributed again, among the workers in the new pool.
Unfortunately, the isvalid() function is not defined for a distributed array. Currently, there is no function or method to determine if the existing distributed variable is valid. The only approach I can find is to run a try-catch trap. I query isreal() and trap any resulting error message, looking for the key word "invalid." If this occurs, I simply run distribute() to get the data distributed again.
The "isvalid()" method should be defined for distributed arrays, making it possible to catch errors before attempting to use a variable.

Answers (0)

Community Treasure Hunt

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

Start Hunting!