-
Notifications
You must be signed in to change notification settings - Fork 868
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
Require C11 #12660
base: main
Are you sure you want to change the base?
Require C11 #12660
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,7 +224,7 @@ static inline opal_list_item_t *opal_fifo_pop_atomic(opal_fifo_t *fifo) | |
if (++attempt == 5) { | ||
/* deliberately suspend this thread to allow other threads to run. this should | ||
* only occur during periods of contention on the lifo. */ | ||
_opal_lifo_release_cpu(); | ||
opal_lifo_release_cpu(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this related to the scope of this PR (aka. require C11) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This had to be outlined to limit the scope of the |
||
attempt = 0; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,11 @@ | |
* $HEADER$ | ||
*/ | ||
|
||
/* needed for nanosleep() */ | ||
#define _POSIX_C_SOURCE 200809L | ||
|
||
#include "opal_config.h" | ||
#include <time.h> | ||
#include "opal/class/opal_lifo.h" | ||
|
||
static void opal_lifo_construct(opal_lifo_t *lifo) | ||
|
@@ -31,3 +35,16 @@ static void opal_lifo_construct(opal_lifo_t *lifo) | |
} | ||
|
||
OBJ_CLASS_INSTANCE(opal_lifo_t, opal_object_t, opal_lifo_construct, NULL); | ||
|
||
|
||
void opal_lifo_release_cpu(void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this related to the scope of this PR (aka. require C11) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above, outlined for the |
||
{ | ||
/* NTH: there are many ways to cause the current thread to be suspended. This one | ||
* should work well in most cases. Another approach would be to use poll (NULL, 0, ) but | ||
* the interval will be forced to be in ms (instead of ns or us). Note that there | ||
* is a performance improvement for the lifo test when this call is made on detection | ||
* of contention but it may not translate into actually MPI or application performance | ||
* improvements. */ | ||
static struct timespec interval = {.tv_sec = 0, .tv_nsec = 100}; | ||
nanosleep(&interval, NULL); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,22 @@ | |
* reserved. | ||
* Copyright (c) 2020 Research Organization for Information Science | ||
* and Technology (RIST). All rights reserved. | ||
* Copyright (c) 2024 Stony Brook University. All rights reserved. | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
|
||
/* needed for strsep() */ | ||
#define _DEFAULT_SOURCE | ||
#define _BSD_SOURCE | ||
|
||
/* needed for posix_memalign() and getopt() */ | ||
#define _POSIX_C_SOURCE 200809L | ||
|
||
#include "ompi_config.h" | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
|
@@ -50,19 +59,9 @@ static int do_ops[12] = { | |
static int verbose = 0; | ||
static int total_errors = 0; | ||
|
||
#define max(a, b) \ | ||
({ \ | ||
__typeof__(a) _a = (a); \ | ||
__typeof__(b) _b = (b); \ | ||
_a > _b ? _a : _b; \ | ||
}) | ||
|
||
#define min(a, b) \ | ||
({ \ | ||
__typeof__(a) _a = (a); \ | ||
__typeof__(b) _b = (b); \ | ||
_a < _b ? _a : _b; \ | ||
}) | ||
#define max(a, b) (a) > (b) ? (a) : (b) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But why ? The original code was correct, compliant with C11. Why changing it to a worst version ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
#define min(a, b) (a) < (b) ? (a) : (b) | ||
|
||
static void print_status(char *op, char *type, int type_size, int count, int max_shift, | ||
double *duration, int repeats, int correct) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related to the scope of this PR (aka. require C11) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof
is not C11.