-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify alignment of memory provided to applications #121
Comments
We should also have a standardized alignment info key, because there are good reasons to request alignment of 64B, 128B, 4KiB, 2MiB and 1GiB, among others. |
Updated annotated pdf (only ticket-0 and no-no-vote changes since Older version from Feb 18, 2019, changes highlighted with ticket121: |
Updated annotated pdf, changes highlighted with ticket121: |
Version of annotated proposal for reading in Chicago: This version adds an AtoI that implementations may rely the underlying system memory allocation routines to provide properly aligned memory. The PR has been updated accordingly. |
Updated proposal based on the discussion in Chicago and points raised in the PR: This version will be used in the virtual meeting reading on July 3. Changes include the definition of default alignment and the info key only in the |
Updated proposal based on the feedback at the virtual meeting: |
Updated proposal based on the virtual meeting and comments from @dholmes-epcc-ed-ac-uk: |
Proposal for the first vote in Albuquerque (changes marked with mpi-report-issue-121_2019-11-25-13.28.pdf The ticket-0 changes before the first vote highlighted in the following document (again using |
This passed the no-no and first vote in Albuquerque, New Mexico on 2019-12-12. |
This proposal passed a second and final vote at the February 2020 meeting: Yes - 24 |
Problem
The MPI standard does not mandate any alignment requirements for functions that allocate memory that is provided to the user, which include
MPI_Alloc_mem
,MPI_Win_allocate
, andMPI_Win_allocate_shared
. Misaligned memory can lead to unexpected errors as the compiler is free to issue instructions that require a specific minimum alignment specific to the machine, e.g.,vmovaps
to handlelong double
types on 64-bit systems, which requires 16B alignment.In contrast to MPI, POSIX memory allocation functions (
malloc
etc) guarantee memory alignment to be suitable for any built-in type.Proposal
This proposal clarifies the alignment requirements for
MPI_Alloc_mem
to be suitable for load/store accesses of any pre-defined MPI type: The allocated memory shall be byte-aligned to at least thealignment required for load/store accesses of any datatype corresponding to a predefined
MPI datatype. It also adds an
info
keyminimum_memory_alignment
that allows users to request a specific alignment, similar toposix_memalign
. Both additions apply toMPI_Win_allocate[_shared]
through the back-reference toMPI_Alloc_mem
in the corresponding sections. For contiguous shared memory allocated throughMPI_Win_allocate_shared
, the alignment requirements only apply to the first process with non-zero size argument.Changes to the Text
Changes detailed in PR: https://github.com/mpi-forum/mpi-standard/pull/96
Changes highlighted in the standard PDF with ticket121:mpi-report.pdf
Updated annotated pdf (only ticket-0 and no-no-vote changes sincefirst pdf on two-week-deadline, Feb. 18, 2019), changes highlighted with ticket121:
mpi-report_issue-121_2019-02-21_21.35-1.pdf
Older version from Feb 18, 2019, changes highlighted with ticket121:mpi-report.pdf
Updated annotated pdf as of May 10, 2019. Changes highlighted with ticket121:mpi-report_issue-121_2019-05-10_19.16-1.pdf
Updated annotated pdf as of May 14, 2019 for the reading in Chicago. Changes highlighted with ticket121:mpi-report_issue-121_2019-05-14_11.22.pdf
Updated annotated pdf as of June 25, 2019 for the virtual meeting on July 3. Changes highlighted with ticket121:mpi-report-issue-121_2019-06-25_11.32.pdf
Updated annotated pdf as of August 22, 2019 for the reading in Zürich. Changes highlighted with ticket121:mpi-report_issue-121_2019-08-22_09.28.pdf
Updated annotated pdf as of November 11, 2019 for the reading in Albuquerque. Changes highlighted with ticket121:
mpi-report-issue-121_2019-11-25-13.28.pdf
Impact on Implementations
Implementations have to ensure proper alignment of memory provided to the user, which may require proper alignment of internal meta-data. Support for the new info key may require the use of special allocation functions (e.g.,
posix_memalign
) or "manually" inserting additional padding.Impact on Users
Users can rely on proper alignment of provided memory to avoid unexpected errors and may
request specific alignmentsspecify desired alternative minimum alignment to enable higher performance on certain platforms/configurations, e.g., by providing alignment hints to a vectorizing compiler. There is no negative impact on users.References
Issue with window memory alignment in Open MPI when using
long double
in a window: open-mpi/ompi#4952A discussion in the RMA-WG: mpiwg-rma/rma-issues#3
Other libraries allocating memory handed out to the application have the following conventions:
malloc
:cudaMalloc
:allocate
, §2.11.4:The text was updated successfully, but these errors were encountered: