[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat Sep 20 12:47:49 PDT 2014
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/a17795a1b696/
Changeset: a17795a1b696
Branch: yt
User: ChrisMalone
Date: 2014-09-11 19:15:57+00:00
Summary: add option to suppress logging when in parallel
Affected #: 1 file
diff -r acb91ec703a3768e16adeb864b3977cee6bc6779 -r a17795a1b69630d6d60befbc67606d711c2065e1 yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py
@@ -53,9 +53,17 @@
max = "MPI.MAX"
)
+class FilterAllMessages(logging.Filter):
+ """
+ This is a simple filter for logging.Logger's that won't let any
+ messages pass.
+ """
+ def filter(self, record):
+ return 0
+
# Set up translation table and import things
-def enable_parallelism():
+def enable_parallelism(suppress_logging=False):
global parallel_capable, MPI
try:
from mpi4py import MPI as _MPI
@@ -104,6 +112,10 @@
min = MPI.MIN,
max = MPI.MAX
))
+ # Turn off logging on all but the root rank, if specified.
+ if suppress_logging:
+ if MPI.COMM_WORLD.rank > 0:
+ mylog.addFilter(FilterAllMessages())
return True
# Because the dtypes will == correctly but do not hash the same, we need this
https://bitbucket.org/yt_analysis/yt/commits/184dd833a4bc/
Changeset: 184dd833a4bc
Branch: yt
User: ChrisMalone
Date: 2014-09-11 19:39:52+00:00
Summary: add docstring
Affected #: 1 file
diff -r a17795a1b69630d6d60befbc67606d711c2065e1 -r 184dd833a4bcea8cf256a1e729a28e0078e11c7b yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py
@@ -64,6 +64,17 @@
# Set up translation table and import things
def enable_parallelism(suppress_logging=False):
+ """
+ This method is used inside a script to turn on MPI parallelism, via
+ mpi4py. More information about running yt in parallel can be found
+ here: http://yt-project.org/docs/3.0/analyzing/parallel_computation.html
+
+ Parameters
+ ----------
+ suppress_logging : bool
+ If set to True, only rank 0 will log information after the initial
+ setup of MPI.
+ """
global parallel_capable, MPI
try:
from mpi4py import MPI as _MPI
https://bitbucket.org/yt_analysis/yt/commits/08157f94abc7/
Changeset: 08157f94abc7
Branch: yt
User: MatthewTurk
Date: 2014-09-20 19:47:43+00:00
Summary: Merged in ChrisMalone/yt (pull request #1199)
add option to suppress logging when in parallel
Affected #: 1 file
diff -r d51b1eef25de78251872054e764e2428ff220c13 -r 08157f94abc7612236f73b240503050044035f46 yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py
@@ -53,9 +53,28 @@
max = "MPI.MAX"
)
+class FilterAllMessages(logging.Filter):
+ """
+ This is a simple filter for logging.Logger's that won't let any
+ messages pass.
+ """
+ def filter(self, record):
+ return 0
+
# Set up translation table and import things
-def enable_parallelism():
+def enable_parallelism(suppress_logging=False):
+ """
+ This method is used inside a script to turn on MPI parallelism, via
+ mpi4py. More information about running yt in parallel can be found
+ here: http://yt-project.org/docs/3.0/analyzing/parallel_computation.html
+
+ Parameters
+ ----------
+ suppress_logging : bool
+ If set to True, only rank 0 will log information after the initial
+ setup of MPI.
+ """
global parallel_capable, MPI
try:
from mpi4py import MPI as _MPI
@@ -104,6 +123,10 @@
min = MPI.MIN,
max = MPI.MAX
))
+ # Turn off logging on all but the root rank, if specified.
+ if suppress_logging:
+ if MPI.COMM_WORLD.rank > 0:
+ mylog.addFilter(FilterAllMessages())
return True
# Because the dtypes will == correctly but do not hash the same, we need this
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list