<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64991>64991</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[OpenMP] Host runtime does not lower teams/thread count properly and oversubscribes the system
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
TerryLWilmarth
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jdoerfert
</td>
</tr>
</table>
<pre>
The benchmark from https://github.com/llvm/llvm-project/issues/64959
cannot be run on the host right now without effectively killing it.
I think we lower the thread count but probably not the team count.
```
#include <stdio.h>
#define N 10
int main (void)
{
long int aa=0;
int res = 0;
int ng =12;
int cmom = 14;
int nxyz = 5000;
#pragma omp target teams distribute num_teams(nxyz) thread_limit(ng*(cmom-1)) map(tofrom:aa)
for (int gid = 0; gid < nxyz; gid++) {
#pragma omp parallel for collapse(2)
for (unsigned int g = 0; g < ng; g++) {
for (unsigned int l = 0; l < cmom-1; l++) {
int a = 0;
#pragma omp parallel for reduction(+:a)
for (int i = 0; i < N; i++) {
a += i;
}
#pragma omp atomic
aa += a;
}
}
}
long exp = (long)ng*(cmom-1)*nxyz*(N*(N-1)/2);
printf ("The result is = %ld exp:%ld!\n", aa,exp);
if (aa != exp) {
printf("Failed %ld\n",aa);
return 1;
}
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVcGOozgQ_RpzKU0ENqThwCGdbLQr7fbuYaQ9jgwuwNPGRrbpnuzXr2zohPTM9GWkKLjqmfeqCruKOyd7jViT4pFQ-hmtvfz5r1Qjt34glJLilPDZD8bWX4VB26H1SWPEpSbpiaSHzwNCg7odRm6fobNmhMH7yRF2IPRM6LmXfpibXWtGQs9Kvbw9Pk3WfMXWE3qWzs3oCD3v86qoFt6Wa208NAh21mA0-AFhMM6Dlf3gQZtXeJV-MLMH7DpsvXxBdYFnqZTUPUi_W4j-AD9I_QyvCMq8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