https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111214
Bug ID: 111214 Summary: omp_get_num_procs: Improve documentation - especially for devices Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: documentation Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- Current wording: https://gcc.gnu.org/onlinedocs/libgomp/omp_005fget_005fnum_005fprocs.html "Returns the number of processors online on that device." (A) For the host, I wonder whether it should mention the affinity bits, which we have in Linux: if (gomp_places_list == NULL) ... && pthread_getaffinity_np (pthread_self (), gomp_get_cpuset_size, gomp_cpusetp) == 0) ... (B) We are completely silent for devices. Seems as if the number of independent hardware threads is what is the sentiment during today's OpenMP accel talk, i.e. #warps (nvptx) and #wavefronts (amdgcn) in hardware (possibly: minus those removed via explicit num_threads settings). We currently have for accelerators: return gomp_icv (false)->nthreads_var with gomp_icv(false) is: struct gomp_task *task = gomp_thread ()->task; if (task) return &task->icv; /*... */ else return &gomp_global_icv; And set on GCN gomp_global_icv.nthreads_var = 16 and for nvptx: gomp_global_icv.nthreads_var = ntids. Possibly, it should be omp_get_num_teams() * nthreads_var, or not. In any case, it needs to be documented.