How can I find the id of a gang in OpenACC?
问题 In OpenMP I can use omp_get_thread_num() to get the numerical id of the thread executing the code. Is there a similar function I can use in OpenACC to get id of the gang executing a piece of code? 回答1: The OpenACC standard does not yet include such a function, but, with the PGI compiler, you can use the compiler extension function __pgi_gangidx() as follows: //pgc++ -fast -acc -ta=tesla,cc60 -Minfo=accel test.cpp #include <iostream> #include "openacc.h" int main(){ int gangs = 100; int *ids =