You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
577 B
33 lines
577 B
7 months ago
|
// RUN: %libomp-compile && env KMP_AFFINITY=compact %libomp-run
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdint.h>
|
||
|
#include <omp.h>
|
||
|
#include "omp_testsuite.h"
|
||
|
|
||
|
int test_nested_affinity_bug() {
|
||
|
int a = 0;
|
||
|
omp_set_nested(1);
|
||
|
#pragma omp parallel num_threads(2) shared(a)
|
||
|
{
|
||
|
#pragma omp parallel num_threads(2) shared(a) proc_bind(close)
|
||
|
{
|
||
|
#pragma omp atomic
|
||
|
a++;
|
||
|
}
|
||
|
}
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
int i;
|
||
|
int num_failed = 0;
|
||
|
|
||
|
for (i = 0; i < REPETITIONS; i++) {
|
||
|
if (!test_nested_affinity_bug()) {
|
||
|
num_failed++;
|
||
|
}
|
||
|
}
|
||
|
return num_failed;
|
||
|
}
|