I have a very intense (50 million calls and over 100 cycles of cycle cycles) for a cycle, for example:
for(int i=0;i<*string;i++){ if(!check_some_stuff(string+i)) { do_some_stuff(i,string-2); if(!string) break; do_yet_other_stuff(string); } }
As the break statements allowed for #pragma omp parallel for odered , I thought I could set i to a very large value.
for(int i=0;i<*string;i++){ if(!check_some_stuff(string+i)) { do_some_stuff(i,string-2); if(!string) i=0x7FFFFFFB; do_yet_other_stuff(string); } }
which works fine without openmp. But when I add
#pragma omp parallel for ordered shared(string) for(int i=0;i<*string;i++){ if(!check_some_stuff(string+i)) { do_some_stuff(i,string-2); #pragma omp critical if(!string) i=0x7FFFFFFB;
the value of i does not seem to change, so it refers to an infinite loop.
source share