Fix comment and format
@@ -44,7 +44,8 @@ int main(){
printf("Thread 0 is going to launch a kernel\n");
fflush(stdout);
- #pragma omp target teams distribute parallel for nowait map(tofrom:z[:n1], scalar) map(to: v1[0:n1]) map(to: v2[0:n1]) map(from: vxv[0:n1])
+ #pragma omp target teams distribute parallel for nowait map(tofrom:z[:n1], scalar) \
+ map(to: v1 [0:n1]) map(to:v2[0:n1]) map(from:vxv [0:n1])
for(long long i = 0; i < n1; i++) {
z[i] = v1[i]*v2[i];
z[i] *= -1.0;
@@ -54,8 +55,6 @@ int main(){
z[i] += v1[i]+v1[i]+2.0+v1[i]*K+v2[i]*L/v1[i];
z[i] += v1[i]+v2[i]+2.0+v1[i]*K+v2[i]*L/v2[i];
vxv[i] = v1[i]*v2[i];
-
- // only change scalar value at the very last iteration, hoping it will happen later than the check on the host
if (i == n1-1)
scalar = 13.0;
}
@@ -67,7 +66,8 @@ int main(){
// on host
// - nowait is necessary to prevent an implicit barrier with the target region
// - static schedule is necessary to ensure thread 0 has to execute some iterations of the for loop
- // and it does so before the target region above has completed execution
+ // nowait on target might allow thread 0 to execute this for loop iterations before the target
+ // region above has completed: dynamic task scheduling is up to OpenMP host runtime
#pragma omp for nowait schedule(static)
for(long long i = n1; i < n; i++) {
printf("Tid = %d: doing iteration %lld\n", omp_get_thread_num(), i);
