-
Notifications
You must be signed in to change notification settings - Fork 30
Single Precision Support #458
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
Changes from all commits
f316fce
04ef2a1
6d30b55
5be0493
a5a5c8e
1115b36
ec0602c
2d6eda6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,15 +76,16 @@ def test_array_interface(): | |
| # print('particle 2 from aos:\n',aos[1]) | ||
| # print('array interface\n', aos.__array_interface__) | ||
| arr = aos.to_numpy() | ||
| int_arg = 7 if arr[0][0].dtype == "float32" else 6 # padding | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this something that users will have to know, that there might be this extra padding element so the indices for the integers might be shifted?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fear so... I have not found a way to kick out numpy struct elements (in the SP case: the paddings) without doing a copy yet. That said, nobody should use AoS anymore in AMReX. I am inclined to drop all support for it in pyAMReX to stop wasting time :)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solicited feedback now on #459 and on Slack |
||
| assert ( | ||
| np.isclose(arr[0][0], 1.0) | ||
| and np.isclose(arr[0][4], 5.2) | ||
| and np.isclose(arr[0][6], 6) | ||
| and np.isclose(arr[0][int_arg], 6) # fixme in SP: reads int32(0) | ||
| ) | ||
| assert ( | ||
| np.isclose(arr[1][2], 10) | ||
| and np.isclose(arr[1][3], 11.1) | ||
| and np.isclose(arr[1][6], 13) | ||
| and np.isclose(arr[1][int_arg], 13) | ||
| ) | ||
|
|
||
| p3 = amr.Particle_2_1(x=-3) | ||
|
|
@@ -102,10 +103,11 @@ def test_array_interface(): | |
| assert aos[0].y == arr[0][1] == 0 | ||
| assert aos[0].z == arr[0][2] == 0 | ||
|
|
||
| shape = amr.Config.spacedim + amr.Particle_2_1.NReal + amr.Particle_2_1.NInt + 1 | ||
| for ii in range(shape): | ||
| arr[1][ii] = 0 | ||
| arr[1][1] = -5 # np.array([0, -5, 0,0,0,0,0]) | ||
| arr[1][0] = 0 | ||
| arr[1][1] = -5 | ||
| arr[1][2] = 0 | ||
| arr[1][3] = 0 | ||
| arr[1][4] = 0 # np.array([0, -5, 0,0,0,0,0, ...]) | ||
| print("array:", arr) | ||
| print("aos[0]:", aos[0], "aos[1]:", aos[1]) | ||
| assert aos[1].y == arr[1][1] == -5 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this end-of-particle padding after the
int(32bit) array fails both the double precision tests o.0