- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am looking for a strategy to implement the merging of file output when a coarray program is executed.
Assume I have a code being executed on multiple images. Ideally, the overall behavior of the code and some intermediate results would be documented in a small number of log files (possibly just one). At regular intervals (but not too frequently), the slave images would add content to these *.log files.
I am a bit at a loss to find an elegant solution to this problem, and if somebody here could share their experience with this I would be very grateful!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try having each image update into a coarray a write sequence number. IOW after each write to log file it increments the write count. The master image would collect the write counts at any convenient sync. When (if) count differs from last time then continue reading from the specific log file. Your log file has to be attributed and open to permit shared access.
On Windows, you might also want to consider using a named pipe.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365799(v=vs.85).aspx
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim,
One of the options I am considering is having a dedicated image solely in control of the log file(s). This 'error/message-handling' image would be in a spin loop, only interrupted by other images passing messages to it (messages would be passed through coarrays), so that they can be written out by this special image.
This is a real waste of resources though, when a small number of images are used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you know you are on a single system (and not a cluster), then Jim's named pipe solution is probably best - but rather than waiting for a message you should sleep for a short time and check for messages as otherwise you'll completely stall the image. It's possible that some of the enhancements being considered for F2015 such as events would help, but I'm not sure.
Today, writing separate log files and combining them is an approach that scales.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page