Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • SWIFTsim SWIFTsim
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 53
    • Issues 53
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • SWIFT
  • SWIFTsimSWIFTsim
  • Merge requests
  • !1576

Draft: Thread-parallel cell allocation

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Matthieu Schaller requested to merge parallel_getcells into master Jun 22, 2022
  • Overview 3
  • Commits 10
  • Changes 9

This follows from the discussion of the performance of the tree construction in the zoom case. After more detailed analysis @dc-rope1 identified that the bottleneck was the call to space_getcells() which features a global lock across all the (pool) threads.

The solution proposed here is to remove the lock entirely. That means we maintain N pool of cells , 1 per thread. Each thread can then allocate what it needs without the need for a lock. When recycling, we put the cells back in the pool of the thread that allocated it.

To get this to work, we need to add a new type of mapper function where the thread id is passed as an argument to the function we call.

This MR also changes the definition of the cell->owner to be the thread that allocated the cell rather than a somewhat arbitrary fraction of the total particle array. I also expand the use of this owner in the enqueing.

This should help with #760 and #742.

Todo:

  • Deal with the case where the number of pool threads is not the same as the number of runner threads.
  • Deal with the list recycling.
Edited Jun 22, 2022 by Matthieu Schaller
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: parallel_getcells