Skip to content

Draft: Subtask speedup - Still requires work

Matthieu Schaller requested to merge subtask_speedup into master

For now, compile with CFLAGS=-DONLY_SUBTASKS added to the configuration line.

This introduces significantly faster neighbour finding in particle distributions with strong density gradients. For instance planetary applications or problematic feedback-disturbed galaxies.


  • Add the brute-force density checks to the planetary scheme (not just sphenix)
  • Rewrite the recursion logic in the hydro and stars sub-task:
    • The interaction functions have extra parameters to optionally consider particles only between 0.5 * width and width
    • The subtask recursion now continues to lower level if we reach a level where h is too large. From that level on, we will just use the feature of only considering particles in the appropriate range of h.
    • When recursing, only the h_max of active particles is considered, not all particles.


  • We will consider c7adb289 separately.
  • In a second phase, I'll remove entirely the self + pair tasks and keep only the subs.


  • Verify RT isn't broken
  • Verify MPI runs are happy.
  • Port changes to the other hydro schemes.
  • Handle particles drifting out of their cells.

Fixes #688 (closed).

Edited by Matthieu Schaller

Merge request reports