-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
Control for pip builds from env var.
And annotate harder issues in AoS.
SP has some detailed padding before `idcpu` and at the end of each particle, if they do not align with the size of `double`.
Importing into pandas does not support binary fields, but there is no quick way to remove them.
| # 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 |
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.
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?
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.
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 :)
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.
Solicited feedback now on #459 and on Slack
| }/* | ||
| if constexpr (ParticleType::NInt % 2 != 0) { // alignas | ||
| descr.append(py::make_tuple("", "|V4")); // empty space due to alignment | ||
| }*/ |
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
|
There seems to be a follow-up issue in SP in ImpactX (which uses pure SoA particle layout) for Note the PR here just works around AoS stuff (legacy). |
For AoS and SoA `.to_numpy()` and dependent logic like `.to_df()`, the lifetime of the temporary copied variable is only handled by NumPy if we first create a named variable. The `to_host()` returned object is a temporary, and `np.array` using the `__array_interface__` protocol does not keep it alive automatically unless it is stored in an actual variable (eg., `tmp`). X-ref: - conda-forge/impactx-feedstock#56 (comment) - #458 (comment)
setup.pyAs a follow-up, one could add support for SP
.to_df()by removing binary columns (members) from the AoS before passing it into Pandas. But this legacy layout is not our need or focus, nor worth spending more time on.