Fix OpenMP thread counting returning places rather than cores

This commit is contained in:
Martin Kroeker 2023-03-08 19:17:33 +01:00 committed by GitHub
parent 9feaaa3f39
commit e38ab079a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -249,8 +249,11 @@ int get_num_procs(void) {
#if defined(USE_OPENMP)
#if _OPENMP >= 201511
int i,n;
n = 0;
ret = omp_get_num_places();
if (ret >0 ) nums = ret;
if (ret > 0) for (i=0; i<ret;i++) n+= omp_get_place_num_procs(i);
if (n > 0) nums = n;
#endif
return (nums > 0 ? nums : 2);
#endif
@ -1820,8 +1823,11 @@ int get_num_procs(void) {
#if defined(USE_OPENMP)
/* if (omp_get_proc_bind() != omp_proc_bind_false) */
#if _OPENMP >= 201511
int i,n;
n = 0;
ret = omp_get_num_places();
if (ret >0 ) nums = ret;
if (ret > 0) for (i=0;i<ret;i++) n+= omp_get_place_num_procs(i);
if (n > 0) nums = n;
#endif
return (nums > 0 ? nums :2);
#endif