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

meep avoid uncessary outputs whe importing library #2421

Open
joamatab opened this issue Mar 2, 2023 · 3 comments · May be fixed by #2425
Open

meep avoid uncessary outputs whe importing library #2421

joamatab opened this issue Mar 2, 2023 · 3 comments · May be fixed by #2425

Comments

@joamatab
Copy link
Contributor

joamatab commented Mar 2, 2023

How can we make meep MPI message not printing the MPI version?

image

every time we import meep it creates MPI output into stdout, how can we remove it?

image

@yaugenst
Copy link

yaugenst commented Mar 2, 2023

I don't think there is a way right now to disable this, as it is automatically called upon initialization. In the past, I have just commented these lines locally or resorted to stdout hacks like this one.

Maybe meep could check for environment variables or some global config on initialization, something like MEEP_VERBOSITY_LEVEL or a .meeprc?

Another idea would be to use logging and replace all the prints scattered throughout the code (the adjoint module also does this without a way to disable it). This would probably be a useful thing to do anyways and could be neatly integrated with the existing verbosity system.

@smartalecH
Copy link
Collaborator

smartalecH commented Mar 6, 2023

So as you know, meep has a verbosity setting. Unfortunately, the mpi output is triggered before any verbosity can be registered, and the adjoint outputs simply aren't wrapped with the verbosity class yet (the adjoint solver still isn't "documented" so there are several things like verbosity that aren't yet consistent with the main meep package).

An env variable may be worth it just for the mpi output (it's certainly easy to implement and add upstream). You'd have to set this env variable in gdsfactory, as we'd probably want the default behavior to stay consistent with master.

You want to throw a quick PR together and we can see how it fits?

@yaugenst
Copy link

yaugenst commented Mar 6, 2023

Regarding the adjoint solver verbosity - it's trivial to add a check for verbosity.meep to the prints, but this would mean that for verbosity.meep = 0 you would not get the Starting forward/adjoint... messages anymore, which one might still want to be able to see without the simulation "clutter". The solutions I see are to either add another property to the verbosity manager (e.g. verbosity.adjoint) or perhaps add more fine-grained verbosity levels to the python module. What do you think?

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

Successfully merging a pull request may close this issue.

3 participants