Closed marioroy closed 1 year ago
@marioroy last_completed
is a global variable. You are referencing it in if completed != last_completed:
before assignment. The assignment happens at last_completed = completed
, which overrides the global last_completed
. At this point last_completed
is no longer a global variable, it is a local variable of "show_progress" function. This doesn't work in Python either.
Thank you, @elisbyberi. I see now and understand.
From the documentation, "Other OpenMP parameters like private, shared or reduction, are inferred automatically by the compiler."
What if Codon assumes wrongly? I wish for the ability to specify
last_completed
a shared variable, not made private. I'm in a critical block and not incrementing the variable, but instead assigning a value (e.g. not for reduction).Error:
It's has been an interesting journey, experimenting with OpenMP using C and Codon.