def __init__(self, handle): """Constructor. """ # Transfer responsibility of memory management from module to this # class. handle.disown() self.handle = handle self.rank = mpimodule.rank(self.handle) self.size = mpimodule.size(self.handle) return
def __init__(self, handle): """ Constructor. """ # Transfer responsibility of memory management from module to this # class. handle.disown() self.handle = handle self.rank = mpimodule.rank(self.handle) self.size = mpimodule.size(self.handle) return
def open(self): self.iupdate = None self.datetimeStart = datetime.datetime.now() try: import pylith.mpi.mpi as mpi self.isMaster = 0 == mpi.rank() except: self.isMaster = True if self.isMaster: self._open() return
def _createPath(self): """Create path for filename if it doesn't exist. """ import os import pylith.mpi.mpi as mpi relpath = os.path.dirname(self.filename) if relpath and not os.path.exists(relpath): # Only create directory on master isMaster = 0 == mpi.rank() if isMaster: os.makedirs(relpath) return