[llvm-bugs] [Bug 47419] New: teams construct in implicit parallel has incorrect number of threads/teams
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 4 07:47:38 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47419
Bug ID: 47419
Summary: teams construct in implicit parallel has incorrect
number of threads/teams
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Runtime Library
Assignee: unassignedbugs at nondot.org
Reporter: jacob.weightman at hpe.com
CC: llvm-bugs at lists.llvm.org
Consider the following program:
```
#include <omp.h>
#include <stdio.h>
int main(void) {
printf("num_teams = %d\n", omp_get_num_teams());
printf("num_threads = %d\n", omp_get_num_threads());
#pragma omp teams num_teams(4)
{
if(omp_get_team_num() == 0) {
printf("num_teams = %d\n", omp_get_num_teams());
printf("num_threads = %d\n", omp_get_num_threads());
}
printf("team: %d; thread: %d\n",
omp_get_team_num(),
omp_get_thread_num());
}
}
```
At present, Clang prints out (up to the ordering of the print statements):
```
num_teams = 1
num_threads = 1
num_teams = 4
num_threads = 12
team: 0; thread: 0
team: 1; thread: 0
team: 2; thread: 0
team: 3; thread: 0
```
The OpenMP 5.0 spec (section 2.7) states that
> The teams construct creates a league of initial teams and the initial thread in each team executes the region.
and (section 3.2.2):
> The omp_get_num_threads routine returns the number of threads in the current team.
The latter print statements indicate that the num_teams clause is respected,
and there is 1 thread per team. Therefore, one should expect that
omp_get_num_threads should return 1 inside of the teams region.
--
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/20200904/372b3ace/attachment-0001.html>
More information about the llvm-bugs
mailing list