ompi icon indicating copy to clipboard operation
ompi copied to clipboard

Atomics: default to GCC builtin atomics and use C11 _Atomic as fall-back

Open devreal opened this issue 3 years ago • 0 comments

As per the discussion in https://github.com/open-mpi/ompi/pull/10492 (https://github.com/open-mpi/ompi/pull/10492#issuecomment-1189087429) we want to replace the C11 _Atomic variables with a custom wrapper around basic atomic types. However, this requires significant changes throughout the code base to wrap direct assignment and initialization in macros. We may not want to backport this to 5.0.x at such a late stage. Instead this PR provides some fixes for the GCC builtin atomics (__atomic) and makes them the default, with C11 atomics as a fallback. This can then be backported to 5.0.x before attempting the larger changes in main.

The underlying problem is that C11 atomics require us to annotate atomic variables with _Atomic that then makes direct assignment sequentially consistent, which in turn make initialization costly and defeats the purpose of the OPAL_THREAD_* macros that try to avoid atomic operations if possible. As an alternative, https://github.com/open-mpi/ompi/pull/10492 removes the _Atomic annotation of variables and adds casts to the atomic functions, which is a hack.

Signed-off-by: Joseph Schuchart [email protected]

devreal avatar Jul 26 '22 22:07 devreal

bot:recheck

bwbarrett avatar Aug 24 '22 16:08 bwbarrett

/azp run

awlauria avatar Aug 25 '22 15:08 awlauria

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 25 '22 15:08 azure-pipelines[bot]

bot:aws:retest

awlauria avatar Aug 25 '22 15:08 awlauria

Replaced by https://github.com/open-mpi/ompi/pull/10721, closing

devreal avatar Aug 26 '22 20:08 devreal