[aspect-devel] inconsistency in use of x, y, and z
jperryh2 at uoregon.edu
Wed Mar 11 20:14:13 PDT 2015
Yeah, the problem is that mpirun only sends stdin to process 0, so I
just write a temp file on process 0, tell the other processes where to
find it, and let them all open it independently, then delete it once
they've all had a chance to read it.
It would also be possible to just let process 0 deal with the input (be
it a file, or stdin) and send the whole thing as a string to all other
instances via MPI. Or something like that. If this is actually something
that anyone would use I could change it to work that way, but otherwise
I won't bother.
On 03/11/2015 07:27 PM, Wolfgang Bangerth wrote:
> On 03/11/2015 09:09 PM, Jonathan Perry-Houts wrote:
>> I don't know if this would be helpful, but I added a quick hack to allow
>> Aspect to accept parameter files via stdin
>> (ie `cat input.prm | mpirun aspect`). This would allow arbitrary
>> modification by shell tools before Aspect ever sees the parameter file.
> I think that's too complicated.
> First, do you need to write the tmp parameter file? What happens with
> whatever you pipe into mpirun? Is it passed to every instance of aspect,
> or only to the first?
> Second, there is a Unix convention by which you indicate that you want
> to write input from stdin rather than from an input file by using the
> special "filename" '--' as argument. I.e., you could do something like
> Assert (argc==2);
> std_cxx11::shared_ptr<std::ifstream> input_file_stream;
> std::ifstream *input_stream;
> if (std::string(argv) != std::string("--"))
> input_file_stream.reset (new std::ifstream(argv));
> Assert (*input_file_stream);
> input_stream = input_file_stream.get();
> input_stream = &std::cin;
> ...read parameters from *input_stream...;
> // input_file_stream goes out of scope and automatically deletes the
> // std::ifstream object if it was assigned
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 473 bytes
Desc: OpenPGP digital signature
More information about the Aspect-devel