Skip to content

Commit 9d69ac0

Browse files
authored
Merge pull request #55 from MathEXLab/fix-numpy-newbyteorder
Update after NumPy 2.0+ removal of ndarray.newbyteorder
2 parents 51a12d9 + e380f58 commit 9d69ac0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyspod/utils/parallel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def _blockdist(N, size, rank):
161161
def allreduce(data, comm):
162162
if comm is not None:
163163
MPI = _get_module_MPI(comm)
164-
data = data.newbyteorder('=')
164+
data = data.view(data.dtype.newbyteorder('='))
165165
data_reduced = np.zeros_like(data)
166166
comm.Barrier()
167167
comm.Allreduce(data, data_reduced, op=MPI.SUM)
@@ -187,7 +187,7 @@ def npy_save(comm, filename, array, axis=0):
187187
if comm is not None:
188188
MPI = _get_module_MPI(comm)
189189
dtlib = _get_module_dtlib(comm)
190-
array = array.newbyteorder('=')
190+
array = array.view(array.dtype.newbyteorder('='))
191191
array = np.asarray(array)
192192
dtype = array.dtype
193193
shape = array.shape

0 commit comments

Comments
 (0)