Skip to content

Commit a1900c5

Browse files
authored
Merge pull request open-mpi#12660 from devreal/require-c11
Require C11
2 parents 4d4f721 + e0c2f0b commit a1900c5

File tree

17 files changed

+112
-104
lines changed

17 files changed

+112
-104
lines changed

config/opal_setup_cc.m4

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ AC_DEFUN([OPAL_SETUP_CC],[
170170
AC_REQUIRE([_OPAL_PROG_CC])
171171
AC_REQUIRE([AM_PROG_CC_C_O])
172172

173-
OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available opal_prog_cc__thread_available opal_prog_cc_c11_helper_atomic_fetch_xor_explicit_available opal_prog_cc_c11_helper_proper__Atomic_support_in_atomics])
173+
OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available opal_prog_cc_c11_helper_atomic_fetch_xor_explicit_available opal_prog_cc_c11_helper_proper__Atomic_support_in_atomics])
174174

175175
OPAL_PROG_CC_C11
176176

@@ -179,33 +179,11 @@ AC_DEFUN([OPAL_SETUP_CC],[
179179
OPAL_C_COMPILER_VENDOR([opal_c_vendor])
180180

181181
if test $opal_cv_c11_supported = no ; then
182-
# It is not currently an error if C11 support is not available. Uncomment the
183-
# following lines and update the warning when we require a C11 compiler.
184-
# AC_MSG_WARNING([Open MPI requires a C11 (or newer) compiler])
185-
# AC_MSG_ERROR([Aborting.])
186-
# From Open MPI 1.7 on we require a C99 compliant compiler
187-
dnl with autoconf 2.70 AC_PROG_CC makes AC_PROG_CC_C99 obsolete
188-
m4_version_prereq([2.70],
189-
[],
190-
[AC_PROG_CC_C99])
191-
# The result of AC_PROG_CC_C99 is stored in ac_cv_prog_cc_c99
192-
if test "x$ac_cv_prog_cc_c99" = xno ; then
193-
AC_MSG_WARN([Open MPI requires a C99 (or newer) compiler. C11 is recommended.])
194-
AC_MSG_ERROR([Aborting.])
195-
fi
196-
197-
# Get the correct result for C11 support flags now that the compiler flags have
198-
# changed
199-
OPAL_PROG_CC_C11_HELPER([], [], [])
182+
# C11 is required
183+
AC_MSG_WARN([Open MPI requires a C11 (or newer) compiler. C11 is required.])
184+
AC_MSG_ERROR([Aborting.])
200185
fi
201186

202-
# Check if compiler support __thread
203-
OPAL_CC_HELPER([if $CC $1 supports __thread], [opal_prog_cc__thread_available],
204-
[],[[static __thread int foo = 1;++foo;]])
205-
206-
OPAL_CC_HELPER([if $CC $1 supports C11 _Thread_local], [opal_prog_cc_c11_helper__Thread_local_available],
207-
[],[[static _Thread_local int foo = 1;++foo;]])
208-
209187
dnl At this time Open MPI only needs thread local and the atomic convenience types for C11 support. These
210188
dnl will likely be required in the future.
211189
AC_DEFINE_UNQUOTED([OPAL_C_HAVE__THREAD_LOCAL], [$opal_prog_cc_c11_helper__Thread_local_available],
@@ -223,9 +201,6 @@ AC_DEFUN([OPAL_SETUP_CC],[
223201
AC_DEFINE_UNQUOTED([OPAL_C_HAVE__STATIC_ASSERT], [$opal_prog_cc_c11_helper__static_assert_available],
224202
[Whether C compiler support _Static_assert keyword])
225203

226-
AC_DEFINE_UNQUOTED([OPAL_C_HAVE___THREAD], [$opal_prog_cc__thread_available],
227-
[Whether C compiler supports __thread])
228-
229204
# Check for standard headers, needed here because needed before
230205
# the types checks. This is only necessary for Autoconf < v2.70.
231206
m4_version_prereq([2.70],

docs/developers/prerequisites.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Compilers
55
---------
66

77
Although it should probably be assumed, you'll need a C compiler that
8-
supports C99.
8+
supports C11.
99

1010
You'll also need a Fortran compiler if you want to build the Fortran
1111
MPI bindings (the more recent the Fortran compiler, the better), and a

docs/developers/source-code.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ C / C++
4747
if (whatever)
4848
return OMPI_SUCCESS;
4949
50-
* Starting with Open MPI 1.7, Open MPI requires a C99-compliant
50+
* Starting with Open MPI 6.0, Open MPI requires a C11-compliant
5151
compiler.
5252

5353
* C++-style comments are now allowed (and preferred).

docs/release-notes/changelog/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ since v1.0.0.
88
.. toctree::
99
:maxdepth: 1
1010

11+
v6.0.x
1112
v5.0.x
1213
v4.1.x
1314
v4.0.x
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Open MPI v6.0.x series
2+
======================
3+
4+
This file contains all the NEWS updates for the Open MPI v6.0.x
5+
series, in reverse chronological order.
6+
7+
Open MPI version v6.0.0
8+
--------------------------
9+
:Date: ...fill me in...
10+
11+
- Open MPI now requires a C11-compliant compiler to build.

docs/release-notes/compilers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Compiler Notes
44
==============
55

6-
* Open MPI requires a C99-capable compiler to build.
6+
* Open MPI requires a C11-capable compiler to build.
77

88
* On platforms other than x86-64, AArc64 (64-bit ARM), and PPC, Open
99
MPI requires a compiler that either supports C11 atomics or the GCC

ompi/mca/vprotocol/pessimist/vprotocol_pessimist_wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int vprotocol_pessimist_request_no_free(ompi_request_t **req) {
2020
}
2121

2222
#define PREPARE_REQUESTS_WITH_NO_FREE(count, requests) do { \
23-
for (typeof(count) i = 0; i < count; i++) \
23+
for (size_t i = 0; i < count; i++) \
2424
{ \
2525
if(requests[i] == MPI_REQUEST_NULL) continue; \
2626
requests[i]->req_free = vprotocol_pessimist_request_no_free; \

opal/class/opal_fifo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static inline opal_list_item_t *opal_fifo_pop_atomic(opal_fifo_t *fifo)
224224
if (++attempt == 5) {
225225
/* deliberately suspend this thread to allow other threads to run. this should
226226
* only occur during periods of contention on the lifo. */
227-
_opal_lifo_release_cpu();
227+
opal_lifo_release_cpu();
228228
attempt = 0;
229229
}
230230

opal/class/opal_lifo.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
* $HEADER$
2020
*/
2121

22+
/* needed for nanosleep() */
23+
#define _POSIX_C_SOURCE 200809L
24+
2225
#include "opal_config.h"
26+
#include <time.h>
2327
#include "opal/class/opal_lifo.h"
2428

2529
static void opal_lifo_construct(opal_lifo_t *lifo)
@@ -31,3 +35,16 @@ static void opal_lifo_construct(opal_lifo_t *lifo)
3135
}
3236

3337
OBJ_CLASS_INSTANCE(opal_lifo_t, opal_object_t, opal_lifo_construct, NULL);
38+
39+
40+
void opal_lifo_release_cpu(void)
41+
{
42+
/* NTH: there are many ways to cause the current thread to be suspended. This one
43+
* should work well in most cases. Another approach would be to use poll (NULL, 0, ) but
44+
* the interval will be forced to be in ms (instead of ns or us). Note that there
45+
* is a performance improvement for the lifo test when this call is made on detection
46+
* of contention but it may not translate into actually MPI or application performance
47+
* improvements. */
48+
static struct timespec interval = {.tv_sec = 0, .tv_nsec = 100};
49+
nanosleep(&interval, NULL);
50+
}

opal/class/opal_lifo.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include "opal_config.h"
3232
#include "opal/class/opal_list.h"
33-
#include <time.h>
3433

3534
#include "opal/mca/threads/mutex.h"
3635
#include "opal/sys/atomic.h"
@@ -92,17 +91,7 @@ opal_read_counted_pointer(volatile opal_counted_pointer_t *volatile addr,
9291
/**
9392
* @brief Helper function for lifo/fifo to sleep this thread if excessive contention is detected
9493
*/
95-
static inline void _opal_lifo_release_cpu(void)
96-
{
97-
/* NTH: there are many ways to cause the current thread to be suspended. This one
98-
* should work well in most cases. Another approach would be to use poll (NULL, 0, ) but
99-
* the interval will be forced to be in ms (instead of ns or us). Note that there
100-
* is a performance improvement for the lifo test when this call is made on detection
101-
* of contention but it may not translate into actually MPI or application performance
102-
* improvements. */
103-
static struct timespec interval = {.tv_sec = 0, .tv_nsec = 100};
104-
nanosleep(&interval, NULL);
105-
}
94+
void opal_lifo_release_cpu(void);
10695

10796
/* Atomic Last In First Out lists. If we are in a multi-threaded environment then the
10897
* atomicity is insured via the compare-and-swap operation, if not we simply do a read
@@ -225,7 +214,7 @@ static inline opal_list_item_t *opal_lifo_pop_atomic(opal_lifo_t *lifo)
225214
if (++attempt == 5) {
226215
/* deliberately suspend this thread to allow other threads to run. this should
227216
* only occur during periods of contention on the lifo. */
228-
_opal_lifo_release_cpu();
217+
opal_lifo_release_cpu();
229218
attempt = 0;
230219
}
231220

0 commit comments

Comments
 (0)