dash
dash copied to clipboard
DART: Support alignment in allocation
As previously discussed in issue #280, DART should support user-specified alignment for allocation (also see https://github.com/dash-project/dash/issues/280#issuecomment-279759290)
Thanks for moving this here. Before I start getting my hands dirty, I would like to define the means of ensuring alignment that we want to support:
-
Something like
dart_memalign
: Fairly easy to do as the offset would be stored in thegptr
alone. Downside: you can still access the unaligned leading portion of the allocated memory. Also, the aligned portions will likely be smaller, thus holding less elements than initially requested. -
Pass minimum alignment as an option to
dart_team_memalloc_symmetric
(previouslydart_team_memalloc_aligned
),dart_team_memalloc
(to be introduced), anddart_memalloc
: the functions would allocate additional padding bytes and ensure alignment of the first element. This likely requires some additional book keeping of the raw pointer and the aligned pointer. A value of0
will cause a fall-back to the alignment provided by the underlying allocator (MPI). -
Alternative to 2: introduce separate functions that allow the specification of alignment. This is similar to the POSIX model, where
malloc
andposix_memalign
are two different functions.
Personally, I am in favor of 2) but open for discussions.