diff --git a/pySDC/helpers/fieldsIO.py b/pySDC/helpers/fieldsIO.py index 58e00d3cb4..43e4fdb562 100644 --- a/pySDC/helpers/fieldsIO.py +++ b/pySDC/helpers/fieldsIO.py @@ -417,8 +417,6 @@ def setHeader(self, nVar, coords): coords = self.setupCoords(*coords) self.header = {"nVar": int(nVar), "coords": coords} self.nItems = nVar * self.nDoF - if self.MPI_ON: - self.MPI_SETUP() @property def hInfos(self): @@ -440,8 +438,6 @@ def readHeader(self, f): gridSizes = np.fromfile(f, dtype=np.int32, count=dim) coords = [np.fromfile(f, dtype=np.float64, count=n) for n in gridSizes] self.setHeader(nVar, coords) - if self.MPI_ON: - self.MPI_SETUP() def reshape(self, fields: np.ndarray): """Reshape the fields to a N-d array (inplace operation)""" @@ -539,7 +535,7 @@ def MPI_ROOT(self): return True return self.comm.Get_rank() == 0 - def MPI_SETUP(self): + def MPI_SETUP_FILETYPE(self): """Setup subarray masks for each processes""" self.mpiType = MPI_DTYPE(self.dtype) self.mpiFileType = self.mpiType.Create_subarray( @@ -556,6 +552,8 @@ def MPI_FILE_OPEN(self, mode): "a": MPI.MODE_WRONLY | MPI.MODE_APPEND, }[mode] self.mpiFile = MPI.File.Open(self.comm, self.fileName, amode) + if self.mpiType is None: + self.MPI_SETUP_FILETYPE() def MPI_WRITE(self, data): """Write data (np.ndarray) in the binary file in MPI mode, at the current file cursor position."""