Getting the rank of thread in current block


I have a situation where I have to find the current thread within the current block…like this:

!$acc region
!$acc do parallel(64) !this is blockIdx.y
do k=0,100
!$acc do parallel(8)   !this is blockIdx.x
   do j=0,100
!$acc do vector(512) !this is threadIdx.x
      do i=0,100
           threadX = rank of thread in blockIdx.x
           threadY = rank of thread in blockIdx.y
!$acc end region

I think the above structure would create a 2-D array of blocks of dim 64X8 with each block having a 1-D array of threads (dim==512)??
How do I calculate threadX and threadY?


Let me reformat the question - is it possible to get the threadIdx.x and threadIdx.y in acc_region? Thanks.

Thank you,

Short answer: no.
The directives are a higher level, implicit programming model. It isn’t a source-to-source macro translation into CUDA. We have no way to get the thread index or block index variables used to execute each loop iteration, and no plans to do so.