For the code below I get an error: unrecognized #pragma: #pragma omp reduction (+: sum)
. Note that the for-loop inside the function is not a parallel-for-loop because the function itself is parallelized already. Could you say where is the problem?
Main cpp file:
#include <omp.h>
int main ()
{
#pragma omp parallel
{
function ();
}
}
Another cpp file wherein function defined
#include <omp.h>
void function ()
{
T priv_var;
// some calculations
#pragma omp reduction (+: sum) // sum is a shared variable
{
for (;;)
{
sum = sum + priv_var;
}
}
}