diff --git a/README.md b/README.md index 4d65acea..dc797596 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ pyAMReX depends on the following popular third party software. - [AMReX *development*](https://amrex-codes.github.io): we automatically download and compile a copy of AMReX - [pybind11](https://github.com/pybind/pybind11/) 2.13.0+: we automatically download and compile a copy of pybind11 ([new BSD](https://github.com/pybind/pybind11/blob/master/LICENSE)) - [Python](https://python.org) 3.9+ - - [Numpy](https://numpy.org) 1.15+ + - [NumPy](https://numpy.org) 2.0+ Optional dependencies include: - [mpi4py](https://mpi4py.readthedocs.io) 2.1+: for multi-node and/or multi-GPU execution diff --git a/docs/source/install/dependencies.rst b/docs/source/install/dependencies.rst index 552deb27..eb74f22c 100644 --- a/docs/source/install/dependencies.rst +++ b/docs/source/install/dependencies.rst @@ -13,7 +13,7 @@ Please see installation instructions below. - `pybind11 2.13.0+ `__: we automatically download and compile a copy - `Python 3.9+ `__ - - `numpy 1.15+ `__ + - `NumPy 2.0+ `__ Optional dependencies include: diff --git a/requirements.txt b/requirements.txt index 949e5884..88dd02af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -numpy>=1.15 +numpy>=2.0 diff --git a/src/amrex/extensions/Array4.py b/src/amrex/extensions/Array4.py index 8cd73f8a..8bdcb240 100644 --- a/src/amrex/extensions/Array4.py +++ b/src/amrex/extensions/Array4.py @@ -40,7 +40,7 @@ def array4_to_numpy(self, copy=False, order="F"): # This supports a device-to-host copy. data = self.to_host() else: - data = np.array(self, copy=False) + data = np.asarray(self, copy=False) if order == "F": return data.T diff --git a/src/amrex/extensions/ArrayOfStructs.py b/src/amrex/extensions/ArrayOfStructs.py index 54afb0d4..688a16b1 100644 --- a/src/amrex/extensions/ArrayOfStructs.py +++ b/src/amrex/extensions/ArrayOfStructs.py @@ -35,9 +35,9 @@ def aos_to_numpy(self, copy=False): # todo: validate of the to_host() returned object # lifetime is always managed correctly by # Python's GC - otherwise copy twice via copy=True - return np.array(self.to_host(), copy=False) + return np.asarray(self.to_host(), copy=False) else: - return np.array(self, copy=False) + return np.asarray(self, copy=False) def aos_to_cupy(self, copy=False): diff --git a/src/amrex/extensions/MultiFab.py b/src/amrex/extensions/MultiFab.py index 8cae31d6..8d2199d1 100644 --- a/src/amrex/extensions/MultiFab.py +++ b/src/amrex/extensions/MultiFab.py @@ -610,7 +610,7 @@ def __setitem__(self, index, value): # (it needs to be 4-D). # This converts value to an array if needed, and the [...] grabs a view so # that the shape change below doesn't affect value. - value3d = np.array(value)[...] + value3d = np.asarray(value)[...] global_shape = list(value3d.shape) # The shape of 1 is added for the extra dimensions and when index is an integer # (in which case the dimension was not in the input array). diff --git a/src/amrex/extensions/PODVector.py b/src/amrex/extensions/PODVector.py index 667b52c9..a72203d5 100644 --- a/src/amrex/extensions/PODVector.py +++ b/src/amrex/extensions/PODVector.py @@ -32,9 +32,9 @@ def podvector_to_numpy(self, copy=False): # todo: validate of the to_host() returned object # lifetime is always managed correctly by # Python's GC - otherwise copy twice via copy=True - return np.array(self.to_host(), copy=False) + return np.asarray(self.to_host(), copy=False) else: - return np.array(self, copy=False) + return np.asarray(self, copy=False) else: raise ValueError("Vector is empty.") diff --git a/src/amrex/extensions/SmallMatrix.py b/src/amrex/extensions/SmallMatrix.py index 8cedb93f..d5485b8e 100644 --- a/src/amrex/extensions/SmallMatrix.py +++ b/src/amrex/extensions/SmallMatrix.py @@ -35,9 +35,9 @@ def smallmatrix_to_numpy(self, copy=False, order="F"): import numpy as np if copy: - data = np.array(self, copy=True) + data = np.asarray(self, copy=True) else: - data = np.array(self, copy=False) + data = np.asarray(self, copy=False) # TODO: Check self.order == "F" ? if order == "F":