[llvm-bugs] [Bug 40253] New: combined target teams implements shared clause as firstprivate
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 8 09:01:15 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40253
Bug ID: 40253
Summary: combined target teams implements shared clause as
firstprivate
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: jdenny.ornl at gmail.com
CC: a.bataev at hotmail.com, llvm-bugs at lists.llvm.org
Clang implements `shared(n)` on `omp target teams` as firstprivate instead of
shared. For example, n is not shared in the following example:
```
$ cat test.c
#include <omp.h>
#include <stdio.h>
int main() {
int n = 0;
#pragma omp target teams shared(n) num_teams(2)
#pragma omp parallel num_threads(1)
{
#pragma omp atomic update
++n;
printf("n=%d, team=%d\n", n, omp_get_team_num());
}
return 0;
}
$ clang -fopenmp test.c && ./a.out
n=1, team=0
n=1, team=1
```
However, if I split the `target teams` directive into two directives, I see
results indicating n is shared:
```
$ cat test.c
#include <omp.h>
#include <stdio.h>
int main() {
int n = 0;
#pragma omp target
#pragma omp teams shared(n) num_teams(2)
#pragma omp parallel num_threads(1)
{
#pragma omp atomic update
++n;
printf("n=%d, team=%d\n", n, omp_get_team_num());
}
return 0;
}
$ clang -fopenmp test.c && ./a.out
n=1, team=0
n=2, team=1
```
The LLVM IR shows that n is passed to the teams by value in the first case and
by pointer in the second.
This bugzilla was suggested at:
https://reviews.llvm.org/D56113#1345047
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190108/7f7ef688/attachment.html>
More information about the llvm-bugs
mailing list