Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small: Fix NumPy 2.0 test script breakage #1116

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- [[PR 1031]](https://github.com/parthenon-hpc-lab/parthenon/pull/1031) Fix bug in non-cell centered AMR

### Infrastructure (changes irrelevant to downstream codes)
- [[PR 1116]](https://github.com/parthenon-hpc-lab/parthenon/pull/1116) Fix NumPy 2.0 test script breakage
- [[PR 1055]](https://github.com/parthenon-hpc-lab/parthenon/pull/1055) Refactor mesh constructors
- [[PR 1066]](https://github.com/parthenon-hpc-lab/parthenon/pull/1066) Re-introduce default loop patterns and exec spaces
- [[PR 1064]](https://github.com/parthenon-hpc-lab/parthenon/pull/1064) Forbid erroneous edge case when adding MeshData on a partition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,11 @@ def Get(self, variable, flatten=True, interior=False, average_to_cell_centers=Tr
if flatten:
nblocks = vShape[0]
if self.varTopology[variable] == "None":
remaining_size = np.product(vShape[1:])
remaining_size = np.prod(vShape[1:])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad to see that the numpy gods thought this was a necessary change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, does prod work for older versions of numpy or will this break the test suite when not using the newer numpy?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return self.varData[variable].reshape(nblocks, remaining_size)
else:
preserved_shape = vShape[:-3]
remaining_size = np.product(vShape[-3:])
remaining_size = np.prod(vShape[-3:])
return self.varData[variable].reshape(*preserved_shape, remaining_size)

if self.IncludesGhost and interior:
Expand Down
Loading