int main()
{
int a=0;
omp_set_num_threads(2);
#pragma omp parallel reduction(+ : a)
{
a = omp_get_thread_num()+1;
}
std::cout << "Output:" << a;
return 1;
}
I am getting wrong output using openmp reduction... For the following code, reduction(+) gives the output of sum of threadnum(), but when i mention reduction (-), it gives the same output... I am getting output as 3 for "+" and "-".