Clear Filters
Clear Filters

Scratch files with spmd

1 view (last 30 days)
Amit Padhi
Amit Padhi on 9 Jan 2018
Edited: Walter Roberson on 9 Jan 2018
If I write a scratch file within an spmd block, will the file be written to a temporary folder in a worker that gets automatically removed after deleting pool?
[Merged from duplicate]
While using spmd on a cluster, I need to write some scratch files within the spmd block. If I use fopen and fwrite commands to write such files, how do i remove the scratch files after execution of my code. I assume all workers write their own files.

Accepted Answer

Walter Roberson
Walter Roberson on 9 Jan 2018
How would you create the scratch file?
If you use tempname() or tempdir() and create files yourself in there, then the answer is NO, files in tempdir() are only removed whenever the operating system or user or system optimization software decides to remove them.
I do recall encountering one set of code that took care to put in an onCleanup() for a temporary file, but I have forgotten the context. You should consider using onCleanup() for this purpose.

More Answers (0)

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!