Implementing target in_reduction by wrapping target task with host task with in_reduction and if clause. This is in compliance with OpenMP 5.0 section: 2.19.5.6.
So, this
#pragma omp target in_reduction(+:res)
for (int i=0; i<N; i++) {
res = res+i
}will become
#pragma omp task in_reduction(+:res) if(0)
#pragma omp target map(res)
for (int i=0; i<N; i++) {
res = res+i
}
Why integer, not a boolean? Also, this is currently meaningless, since these 2 vars are not visible outside of the if context.