Documentation about Fortran OpenACC built-in functions

Hello,

Where can I find info about the FORTRAN OpenACC built-in functions as " __pgi_gangidx", " __pgi_workeridx",“_pgi_vectoridx”, __pgi_threadix etc… ?
I tried to look here: NVIDIA HPC SDK Version 22.7 Documentation but I didn’t find nothing.

I need it because I am using cuRAND with Fortran OpenACC and I want to initialize the seed of the pseudo-random number generator with a different value for each thread.
In CUDA I would write something like this:
cuda_seed = my_seed + blockDim%x * (blockIdx%x - 1) + threadIdx%x

Best regards,

Alberto Riccardo Martinelli

1 Like

Hi Alberto,

We intentionally don’t document them. Not that we keep them hidden, but don’t want to promote their use since they are non-standard and only useful in rare circumstances, cuRAND being one.

Though hopefully they are self explanatory, but if you have a specific question, let me know.

For “blockIdx%x” use “__pgi_blockidx”, “threadIdx%x” use “__pgi_threadidx”, “blockDim%x” would be the same as the value set via the “vector_length” clause.

-Mat

Ok, I can’t figure out the signature of the function __pgi_threadidx. What is the type of the parameter of this function?
I tried with an integer but it doesn’t work.

They’re listed in the “openacc.h” header file:

extern int __pgi_gangidx(void);
extern int __pgi_workeridx(void);
extern int __pgi_vectoridx(void);
extern int __pgi_blockidx(int);
extern int __pgi_threadidx(int);

The input to blockidx and threadidx is the dimension to query, 1 (x), 2 (y), or 3 (z).

Hope this helps,
Mat

that make sense, now it works.

Thank you very much,

Alberto

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.