Hi Benedikt,
It would be something like:
!$acc atomic capture
counter = counter + 1
myNumber = counter
!$acc end atomic
See my answer in this post Thread data concatenation for a fuller example.
Note that atomic capture was added in PGI 14.9.
Hope this helps,
Mat