This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from mpi4py import MPI | |
class MPIFileHandler(logging.FileHandler): | |
def __init__(self,filename, mode=MPI.MODE_WRONLY|MPI.MODE_CREATE|MPI.MODE_APPEND , encoding=None, delay=0, comm=MPI.COMM_WORLD ): | |
encoding = None | |
self.baseFilename = os.path.abspath(filename) | |
self.mode = mode | |
self.encoding = encoding | |
self.comm = comm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Feb 14 16:17:38 2018 | |
This handler is used to deal with logging with mpi4py in Python3. | |
@author: cheng | |
@reference: | |
https://cvw.cac.cornell.edu/python/logging | |
https://groups.google.com/forum/#!topic/mpi4py/SaNzc8bdj6U |