Skip to content

MatLUT: faster phi-sector determination; reduction of divisions#12030

Merged
shahor02 merged 2 commits into
AliceO2Group:devfrom
sawenzel:swenzel/MatLUTFastLayerAccess2
Oct 20, 2023
Merged

MatLUT: faster phi-sector determination; reduction of divisions#12030
shahor02 merged 2 commits into
AliceO2Group:devfrom
sawenzel:swenzel/MatLUTFastLayerAccess2

Conversation

@sawenzel
Copy link
Copy Markdown
Collaborator

@sawenzel sawenzel commented Oct 6, 2023

Following ticket https://alice.its.cern.ch/jira/browse/O2-4170,

profile analysis has shown that material budget calculations used in tracking, spent most time in

(a) determination of a cylindrical layer
(b) determination of a phi sector in a layer

This commit proposes an improvement for (b):

  • Instead of using system function phi = atan2(y, x), we use a faster - approximate version. We can do this, since we never need to use the precise result of phi in a calculation. Instead, phi is merely used to lookup a slice/sector. The error of the approximate version is ~1e-5, which is enough to get the correct phi sector in 99.999 of the cases.

    (Rare cases, where we end up in a wrong neighbouring phi sector are probably ok ... since the material budget lookup is anyways an approximation.)

In addition, we propose a smaller code modification for ray.CrossZ to reduce the number of divisions and if statements.
A previous check for ray orthogonal to z can not happen in the code since there is a previous condition if (zID != zIDLast).

ITS reco is shown to improve by ~15% in speed for larger PbPb MC timeframes (on Linux - tested on CC7 and Ubuntu22.04)

Following ticket https://alice.its.cern.ch/jira/browse/O2-4170,

Profile analysis has shown that material budget calculations used in tracking, spent most time in
(a) determination of a cylindrical layer
(b) determination of a phi sector in a layer

This commit proposes an improvement for (b):

- Instead of using system function phi = atan2(y, x), we use a
  faster - approximate version. We can do this, since we never need
  to use the precise result of phi in a calculation. Instead, phi is merely used
  to lookup a slice/sector.
  The error of the approximate version is ~1e-5, which is enough to get the correct phi
  sector in 99.999 of the cases.

  (Rare cases, where we end up in a wrong neighbouring phi sector are probably ok ... since
   the material budget lookup is anyways an approximation.)

In addition, we propose a smaller code mofication for ray.CrossZ to reduce
the number of divisions and if statements.
A previous check for
ray orthogonal to z can not happen in the code since there is a previous condition
`if (zID != zIDLast)`.

ITS reco is shown to improve by ~15% in speed for larger PbPb MC timeframes
(on Linux - tested on CC7 and Ubuntu22.04)
@sawenzel
Copy link
Copy Markdown
Collaborator Author

sawenzel commented Oct 6, 2023

WIP ... opened for discussion.

@sawenzel sawenzel requested review from davidrohr and mconcas October 6, 2023 12:45
shahor02
shahor02 previously approved these changes Oct 20, 2023
Copy link
Copy Markdown
Collaborator

@shahor02 shahor02 left a comment

Choose a reason for hiding this comment

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

Thanks @sawenzel ! But there is a merge conflict, could you please fix it?

@sawenzel
Copy link
Copy Markdown
Collaborator Author

@shahor02 : Merge conflict resolved. Commits should be squashed when merging.

@shahor02 shahor02 merged commit 030e396 into AliceO2Group:dev Oct 20, 2023
shahor02 added a commit that referenced this pull request Oct 23, 2023
shahor02 added a commit that referenced this pull request Oct 23, 2023
christianreckziegel pushed a commit to LucasFerrandi/AliceO2 that referenced this pull request Nov 9, 2023
…eO2Group#12030)

Following ticket https://alice.its.cern.ch/jira/browse/O2-4170,

Profile analysis has shown that material budget calculations used in tracking, spent most time in
(a) determination of a cylindrical layer
(b) determination of a phi sector in a layer

This commit proposes an improvement for (b):

- Instead of using system function phi = atan2(y, x), we use a
  faster - approximate version. We can do this, since we never need
  to use the precise result of phi in a calculation. Instead, phi is merely used
  to lookup a slice/sector.
  The error of the approximate version is ~1e-5, which is enough to get the correct phi
  sector in 99.999 of the cases.

  (Rare cases, where we end up in a wrong neighbouring phi sector are probably ok ... since
   the material budget lookup is anyways an approximation.)

In addition, we propose a smaller code mofication for ray.CrossZ to reduce
the number of divisions and if statements.
A previous check for
ray orthogonal to z can not happen in the code since there is a previous condition
`if (zID != zIDLast)`.

ITS reco is shown to improve by ~15% in speed for larger PbPb MC timeframes
(on Linux - tested on CC7 and Ubuntu22.04)
christianreckziegel pushed a commit to LucasFerrandi/AliceO2 that referenced this pull request Nov 9, 2023
leo-barreto pushed a commit to leo-barreto/AliceO2 that referenced this pull request Nov 16, 2023
…eO2Group#12030)

Following ticket https://alice.its.cern.ch/jira/browse/O2-4170,

Profile analysis has shown that material budget calculations used in tracking, spent most time in
(a) determination of a cylindrical layer
(b) determination of a phi sector in a layer

This commit proposes an improvement for (b):

- Instead of using system function phi = atan2(y, x), we use a
  faster - approximate version. We can do this, since we never need
  to use the precise result of phi in a calculation. Instead, phi is merely used
  to lookup a slice/sector.
  The error of the approximate version is ~1e-5, which is enough to get the correct phi
  sector in 99.999 of the cases.

  (Rare cases, where we end up in a wrong neighbouring phi sector are probably ok ... since
   the material budget lookup is anyways an approximation.)

In addition, we propose a smaller code mofication for ray.CrossZ to reduce
the number of divisions and if statements.
A previous check for
ray orthogonal to z can not happen in the code since there is a previous condition
`if (zID != zIDLast)`.

ITS reco is shown to improve by ~15% in speed for larger PbPb MC timeframes
(on Linux - tested on CC7 and Ubuntu22.04)
leo-barreto pushed a commit to leo-barreto/AliceO2 that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants