Closed tawanchaiii closed 3 years ago
Hi @tawanchaiii !
This is entirely expected. This variable is 'firstprivate' in OpenMP lingo, meaning that for every thread it's initial value is shared, but after that every thread has it's own copy. If you want to also keep it's value synchronized after that, you have to use a pymp.shared.array
for example, or any other of the pymp.shared
data structures and, depending on how you write to the variable, one of the locking structures.
Best, Christoph
In this program
The result is
sum
it should be28
but it's still0
How to solve it?