Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions python/meep.i
Original file line number Diff line number Diff line change
Expand Up @@ -1866,19 +1866,19 @@ PyObject *_get_array_slice_dimensions(meep::fields *f, const meep::volume &where
print('\n**\n** failed to load python MPI module (mpi4py)\n**', e, '\n**\n')
pass
else:
# this variable reference is needed for lazy initialization of MPI
comm = MPI.COMM_WORLD
if am_master():
Procs=comm.Get_size()
(Major,Minor)=MPI.Get_version();
print('Using MPI version {}.{}, {} processes'.format(Major, Minor, Procs));

if not am_master():
import os
import os
if not am_master() and os.getenv("MEEP_MPI_SILENCE_WORKERS", "true").lower() in ("true", "1"):
import sys
saved_stdout = sys.stdout
sys.stdout = open(os.devnull, 'w')

# this variable reference is needed for lazy initialization of MPI
comm = MPI.COMM_WORLD
Procs = comm.Get_size()
Major, Minor = MPI.Get_version()
if verbosity.meep > 0:
print('Using MPI version {}.{}, {} processes'.format(Major, Minor, Procs))

vacuum = Medium(epsilon=1)
air = Medium(epsilon=1)
metal = Medium(epsilon=-inf)
Expand Down
3 changes: 2 additions & 1 deletion python/mpb.i
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,9 @@ const int MPB_VERSION_PATCH;
%pythoncode %{
__version__ = (_mpb.cvar.MPB_VERSION_MAJOR, _mpb.cvar.MPB_VERSION_MINOR, _mpb.cvar.MPB_VERSION_PATCH)

import os
from meep.verbosity_mgr import Verbosity
verbosity = Verbosity(_mpb.cvar, 'mpb', 1)
verbosity = Verbosity(_mpb.cvar, 'mpb', int(os.getenv("MPB_VERBOSITY_LEVEL", 1)))

from .solver import (
MPBArray,
Expand Down
2 changes: 1 addition & 1 deletion python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

from matplotlib.axes import Axes

verbosity = Verbosity(mp.cvar, "meep", 1)
verbosity = Verbosity(mp.cvar, "meep", int(os.getenv("MEEP_VERBOSITY_LEVEL", 1)))

mp.setup()

Expand Down