nbia-astro / skeletor

Parallel PIC code written in Python and based on the skeleton codes provided by PICKSC
GNU General Public License v3.0
1 stars 0 forks source link

Function pointers and inlining #162

Closed tberlok closed 7 years ago

tberlok commented 7 years ago

This code is still fast (0.12 μs/particle/timestep):

    if order == 1:
        gather = gather_cic
        deposit_particle = deposit_particle_cic

while this code is slow (0.18 μs/particle/timestep):

    if order == 1:
        gather = gather_cic
        deposit_particle = deposit_particle_cic
    elif order == 2:
        gather = gather_tsc
        deposit_particle = deposit_particle_tsc
tberlok commented 7 years ago

I am going to make a Jupyter notebook where we can test this thoroughly.

tberlok commented 7 years ago

The conclusion in afbb68a is that function pointers are too slow, as @tobson suspected all along.

I guess we will have to create a push_and_deposit_cic, a push_and_deposit_tsc and so on. This is not really satisfactory.

tberlok commented 7 years ago

The multiple species branch runs the circular damping test at the same speed as the master branch (0.12 μs/particle/timestep). So those changes are fine, at least!

tberlok commented 7 years ago

This issue has been resolved by not using function pointers for now.