Commit a386488b authored by theos's avatar theos
Browse files

Deactivated nifty_about output for MPI ranks other than 0.

parent fd8bdf02
...@@ -23,9 +23,20 @@ from sys import stdout as so ...@@ -23,9 +23,20 @@ from sys import stdout as so
import os import os
import inspect import inspect
import d2o
import keepers
from nifty import __version__ from nifty import __version__
MPI = d2o.config.dependency_injector[
keepers.get_Configuration('D2O')['mpi_module']]
comm = MPI.COMM_WORLD
size = comm.size
rank = comm.rank
class switch(object): class switch(object):
""" """
.. __ __ __ .. __ __ __
...@@ -251,12 +262,12 @@ class notification(switch): ...@@ -251,12 +262,12 @@ class notification(switch):
i = 2 i = 2
current = inspect.stack()[i][3] current = inspect.stack()[i][3]
while current != '<module>': while current != '<module>':
result = '.' + current + result result = '.' + current + result
i += 1 i += 1
current = inspect.stack()[i][3] current = inspect.stack()[i][3]
return result[1:] return result[1:]
def cstring(self,subject): def cstring(self, subject):
""" """
Casts an object to a string and augments that with a colour code. Casts an object to a string and augments that with a colour code.
...@@ -272,10 +283,11 @@ class notification(switch): ...@@ -272,10 +283,11 @@ class notification(switch):
String augmented with a color code. String augmented with a color code.
""" """
return self.ccode + str(self._get_caller()) + ':\n' + \ if rank == 0:
str(subject) + self._code + '\n' return self.ccode + str(self._get_caller()) + ':\n' + \
str(subject) + self._code + '\n'
def cflush(self,subject): def cflush(self, subject):
""" """
Flushes an object in its colour coded sting representation to the Flushes an object in its colour coded sting representation to the
standard output (*without* line break). standard output (*without* line break).
...@@ -291,11 +303,11 @@ class notification(switch): ...@@ -291,11 +303,11 @@ class notification(switch):
None None
""" """
if(self.status): if self.status and rank == 0:
so.write(self.cstring(subject)) so.write(self.cstring(subject))
so.flush() so.flush()
def cprint(self,subject): def cprint(self, subject):
""" """
Flushes an object in its colour coded sting representation to the Flushes an object in its colour coded sting representation to the
standard output (*with* line break). standard output (*with* line break).
...@@ -311,7 +323,7 @@ class notification(switch): ...@@ -311,7 +323,7 @@ class notification(switch):
None None
""" """
if(self.status): if self.status and rank == 0:
so.write(self.cstring(subject)+"\n") so.write(self.cstring(subject)+"\n")
so.flush() so.flush()
......
...@@ -3388,7 +3388,7 @@ class propagator_operator(operator): ...@@ -3388,7 +3388,7 @@ class propagator_operator(operator):
"ERROR: At least M or N must be given.")) "ERROR: At least M or N must be given."))
def _multiply(self, x, W=None, spam=None, reset=None, note=True, def _multiply(self, x, W=None, spam=None, reset=None, note=True,
x0=None, tol=1E-3, clevel=1, limii=None, **kwargs): x0=None, tol=1E-3, clevel=1, limii=1000, **kwargs):
if W is None: if W is None:
W = self.S W = self.S
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment