Skip to content

Commit 4005f26

Browse files
committed
Performance fixes for FieldsIO
1 parent f4f4df9 commit 4005f26

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pySDC/helpers/fieldsIO.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def initialize(self):
202202
if not self.ALLOW_OVERWRITE:
203203
assert not os.path.isfile(
204204
self.fileName
205-
), "file already exists, use FieldsIO.ALLOW_OVERWRITE = True to allow overwriting"
205+
), f"file {self.fileName!r} already exists, use FieldsIO.ALLOW_OVERWRITE = True to allow overwriting"
206206

207207
with open(self.fileName, "w+b") as f:
208208
self.hBase.tofile(f)
@@ -475,7 +475,7 @@ def toVTR(self, baseName, varNames, idxFormat="{:06d}"):
475475
476476
Example
477477
-------
478-
>>> # Suppose the FieldsIO object is already writen into outputs.pysdc
478+
>>> # Suppose the FieldsIO object is already written into outputs.pysdc
479479
>>> import os
480480
>>> from pySDC.utils.fieldsIO import Rectilinear
481481
>>> os.makedirs("vtrFiles") # to store all VTR files into a subfolder
@@ -553,7 +553,7 @@ def MPI_WRITE_AT(self, offset, data: np.ndarray):
553553
data : np.ndarray
554554
Data to be written in the binary file.
555555
"""
556-
self.mpiFile.Write_at(offset, data)
556+
self.mpiFile.Write_at_all(offset, data)
557557

558558
def MPI_READ_AT(self, offset, data):
559559
"""
@@ -567,7 +567,7 @@ def MPI_READ_AT(self, offset, data):
567567
data : np.ndarray
568568
Array on which to read the data from the binary file.
569569
"""
570-
self.mpiFile.Read_at(offset, data)
570+
self.mpiFile.Read_at_all(offset, data)
571571

572572
def MPI_FILE_CLOSE(self):
573573
"""Close the binary file in MPI mode"""
@@ -707,7 +707,6 @@ def writeFields_MPI(fileName, dtypeIdx, algo, nSteps, nVar, gridSizes):
707707
Rectilinear.setupMPI(comm, iLoc, nLoc)
708708
s = [slice(i, i + n) for i, n in zip(iLoc, nLoc)]
709709
u0 = u0[:, *s]
710-
print(MPI_RANK, u0.shape)
711710

712711
f1 = Rectilinear(DTYPES[dtypeIdx], fileName)
713712
f1.setHeader(nVar=nVar, coords=coords)

0 commit comments

Comments
 (0)