From e380f583386040321813177b3d9a843af5f06263 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Mon, 18 Nov 2024 12:34:25 -0300 Subject: [PATCH] Update after NumPy 2.0+ removal of ndarray.newbyteorder --- pyspod/utils/parallel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyspod/utils/parallel.py b/pyspod/utils/parallel.py index beb6587..229686c 100644 --- a/pyspod/utils/parallel.py +++ b/pyspod/utils/parallel.py @@ -161,7 +161,7 @@ def _blockdist(N, size, rank): def allreduce(data, comm): if comm is not None: MPI = _get_module_MPI(comm) - data = data.newbyteorder('=') + data = data.view(data.dtype.newbyteorder('=')) data_reduced = np.zeros_like(data) comm.Barrier() comm.Allreduce(data, data_reduced, op=MPI.SUM) @@ -187,7 +187,7 @@ def npy_save(comm, filename, array, axis=0): if comm is not None: MPI = _get_module_MPI(comm) dtlib = _get_module_dtlib(comm) - array = array.newbyteorder('=') + array = array.view(array.dtype.newbyteorder('=')) array = np.asarray(array) dtype = array.dtype shape = array.shape