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

Change order of particles at initialization #79

Merged
merged 1 commit into from
Jul 10, 2017

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Jul 6, 2017

Before this pull request, the particles were initialized such that, when going through the array of particles in order:

  • theta changes the fastest (while z and r remain constant)
  • then z changes
  • then r changes the slowest

However, in order to optimize cache reuse, in the current deposition and gathering, it is better to have the following order:

  • theta changes the fastest (while z and r remain constant)
  • then r changes
  • then z changes the slowest

This pull request implements the above change.

Although this order is theoretically supposed to be more efficient (on CPU), I did not observe any significant speedup in practice. I think it still makes sense to merge this PR, as this is the most logical order for the particles to be in.

@MKirchen
Copy link
Contributor

MKirchen commented Jul 6, 2017

Does this PR have any impact on the GPU performance?

@RemiLehe
Copy link
Member Author

RemiLehe commented Jul 6, 2017

In theory: no, since the particles are reordered (i.e. sorted) anyway on the GPU.

And in practice: I tested the performance on the GPU (2000x400 box full of electrons) and saw no difference between the dev branch and this one.

@RemiLehe RemiLehe merged commit 1df6827 into fbpic:dev Jul 10, 2017
@RemiLehe RemiLehe deleted the contiguous_particles branch July 16, 2017 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants