I am new to openmp and I play with some things for a school project. I tried to make my program a little faster using atomic rather than critical. I have this piece of code at the end of one of my loops.
if(prod > final_prod)
{
#pragma omp atomic
final_prod = prod;
}
Although, when I do this, I get the error below (if I use critical program compilation)
error: invalid form of β
final_prod = prod;
^
From what I have learned so far, you can use atoms instead of critical ones for usually something that can be done in a few machine instructions. Should this work? And what is the main difference between using atomic and critical?
source
share