Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add option to redirect output to stdout rather than writing to disk #30

Closed
mjclarke94 opened this issue May 29, 2021 · 6 comments
Assignees

Comments

@mjclarke94
Copy link

Hi,

I'm currently using python as a wrapper (using subprocess) around atomsk for generating polycrystals. I need specific stoichiometry for charge balancing so I am just run it repeatedly until I happen to hit one which works. The issue is that this means there is a ton of fileIO each iteration (load in the primitive cell, write the polycrystal to disk, then load it back in to python to check the stoichiometry.

Having the output go to stdout rather than to disk would massively increase the speed of this operation.

@pierrehirel
Copy link
Owner

Dear Sir,

Since version 0.11 it is possible to specify "NULL" as an output file, which will produce no output at all. I do not know if that is useful to you, as you probably need the number of atoms in your workflow.

I will think of a way to write the output to stdout, but I think it will require to modify all output modules so it may take some time. I will come back to you when I get something working.

Best regards

@pierrehirel
Copy link
Owner

Hi,

I just committed a new version that allows output to stdout. As I suspected it required modifying all output modules.

To trigger it, specify "-" instead of an output file, and then one or several output formats. Examples:

atomsk input.cfg - vesta
atomsk --polycrystal seed.cfg poly.txt - cfg

In addition, when output is stdout then the verbosity is set to zero, so that no other message is displayed on screen.

I must admit that I did not test this new implementation thoroughly, I tested the mode "--polycrystal" but not much more than that so process with caution.

Please let me know if you find bugs or if it corresponds to your expectations.

Best regards

@pierrehirel pierrehirel self-assigned this May 31, 2021
@mjclarke94
Copy link
Author

Hi Pierre,

I've tried out the new mode (thanks for the quick implementation!). The redirection to stdout seems to work well, but the supplemental files (grain locations etc) still are written to disk in addition to being ported to stdout. Whilst this reduces the need to read files back in, there is still the IO cost of writing the files out!

Not sure whether preventing this would require a major upheaval?

Best,
Matt

@pierrehirel
Copy link
Owner

Hi,

I just pushed an update that disables the writing of all additional files when the output is stdout. Let me know if it works and suits your needs.

Best
Pierre

@pierrehirel
Copy link
Owner

In the absence of reply or comments for more than 1 month I close this thread.

@pmrv
Copy link

pmrv commented Jul 28, 2021

I just wanted to say, I'm working on integrating atomsk into pyiron and found this feature very helpful, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants