[aspect-devel] Writing output in parallel

Wolfgang Bangerth bangerth at math.tamu.edu
Tue Feb 28 12:47:28 PST 2012


> 1. We could let the user specify a directory and just create the files
> as solution-... and hope it doesn't conflict with other files.

That could work. If we do something with PID, rank and time step then 
that could work.


> 2. flush() the file, then copy, then fclose() it. (not sure how well that works)

Yea, I don't know either.


> 3. trick mkstemp:
> char template[] = "/tmp/fileXXXXXX";
> int fd = mkstemp(template);
> fclose(fd);
> //now create the file<template>

The problem is that we don't know whether /tmp exists or is the proper 
directory. That's the beauty of functions like mkstmp: they know where 
tmp directories are.

Anyway, I think I've found the solution to the problem, namely just 
calling 'mktemp' via 'system/popen'.

W.

------------------------------------------------------------------------
Wolfgang Bangerth               email:            bangerth at math.tamu.edu
                                 www: http://www.math.tamu.edu/~bangerth/



More information about the Aspect-devel mailing list