-
Notifications
You must be signed in to change notification settings - Fork 23
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
[WIP] Make Linear Elements Fast #850
base: development
Are you sure you want to change the base?
Conversation
src/elements/Quad.H
Outdated
@@ -96,24 +118,14 @@ namespace impactx::elements | |||
amrex::ParticleReal & AMREX_RESTRICT py, | |||
amrex::ParticleReal & AMREX_RESTRICT pt, | |||
uint64_t & AMREX_RESTRICT idcpu, | |||
RefPart const & refpart | |||
[[maybe_unused]] RefPart const & refpart |
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.
Idea: I would remove this fully from the interface to prevent that we can write inefficient code by accident.
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.
Discussed: this will not work to be fully removed, since the refpart
for elements that integrate through maps is non-const.
3c74ef7
to
9ed66b3
Compare
Compute and cache the constants for the push. In particular, used to pre-compute and cache variables that are independent of the individually tracked particle.
9ed66b3
to
e788211
Compare
6c6f5ef
to
6af0a54
Compare
Make the `Quad` fast by calculating constants that depend on the element config and reference particle properties before pushing all particles.
63298bf
to
55bc5e9
Compare
55bc5e9
to
86c0c2b
Compare
db2f5ac
to
483e3df
Compare
xout = m_cos_kxds * x + m_sincx * px; | ||
pxout = m_const_x * x + m_cos_kxds * px; | ||
|
||
yout = std::cos(m_ky*slice_ds)*y + sincy*py; | ||
pyout = -m_ky * std::sin(m_ky*slice_ds)*y + std::cos(m_ky*slice_ds)*py; | ||
yout = m_cos_kyds * y + m_sincy * py; | ||
pyout = m_const_y * y + m_cos_kyds * py; | ||
|
||
tout = std::cos(m_kt*slice_ds)*t + sinct/(betgam2)*pt; | ||
ptout = -(m_kt*betgam2) * std::sin(m_kt*slice_ds)*t + std::cos(m_kt*slice_ds)*pt; | ||
tout = m_cos_ktds * t + m_const_pt * pt; | ||
ptout = m_const_y * t + m_cos_ktds * pt; |
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.
We could actually give those members proper m_Rij
names...
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.
We will need to return the linear map for envelope tracking anyway, in a separate function within ConstF
. Those matrix element values could be used here.
Make linear elements, like
Quad
&Drift
, as fast as possible by:Example: 1 CPU core run of a single
Quad
, 100M particlesBefore:
Now:
Close #849