Fix test for new runtime: the runtime will round down to a multiple of wavesize. In this case, the num_threads ICV is set to 10 and the runtime selects 1 thread only for the parallel region
@@ -10,7 +10,8 @@ int main(int argc, char *argv[]) {
for(int dev = 0; dev < omp_get_num_devices(); ++dev)
{
- #pragma omp target device(dev) map(from:host[0:N])
+ int num_threads = -1;
+ #pragma omp target device(dev) map(from:host[0:N]) map(from:num_threads)
{
static __attribute__((address_space(3))) int A;
A = VALUE;
@@ -23,7 +24,8 @@ int main(int argc, char *argv[]) {
}
}
- for (int i = 0; i < N; ++i) {
+ // the runtime is free to choose the best number of threads <= num_threads value, related ICV, etc.
+ for (int i = 0; i < num_threads; ++i) {
if (host[i] != VALUE) {
printf("Failed on device %d host[%d]: %d (instead of %d)\n",dev,i,host[i],VALUE);
return 1;
@@ -35,5 +37,3 @@ int main(int argc, char *argv[]) {
return 0;
}
-
-
