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 18
    • Merge requests 18
  • 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
  • !1029

Aggregated sort arrays

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Matthieu Schaller requested to merge smaller_sort_arrays into master Mar 04, 2020
  • Overview 12
  • Commits 9
  • Changes 7

This is the next step in the on-going saga to reduce the memory footprint. @nnrw56 you will also be interested.

Currently, the sort arrays are stored as an array of 13 pointers in each cell. We then allocate sort arrays when we need a sort in a given direction and assign the array to the corresponding pointer. They remain NULL if that direction is not needed. The change introduced here replaces the array of 13 pointers by a single pointer (and hence array) and allocate the 13 sort arrays as a single linear chunk. I then provide function returning the array along a given direction by returning a pointer in that unified array at the appropriate position.

The only trick is that we sometimes need to demand a new direction. In the old approach we would allocate a new array and set it in the array of 13. Now, we need to reallocate and copy the whole thing.

This allows us to replace the 13 pointers by a single pointer and a short int to keep track of what was allocated. And we do this for both the gas and star sorting arrays.

The cell structure goes down from 1184 bytes to 992 bytes. (1216 to 1024 in the MPI case, 16% gain)

Other improvements coming soon in a separate MR.

Edited Mar 12, 2020 by Matthieu Schaller
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: smaller_sort_arrays