Catch invalid cpu count returned by CPU_COUNT_S

mips32 was seen to return zero here, driving nthreads to zero with subsequent fpe in blas_quickdivide
This commit is contained in:
Martin Kroeker 2018-04-14 18:29:10 +02:00 committed by GitHub
parent 0ab5bf1746
commit 7c861605b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -209,7 +209,8 @@ int ret;
size = CPU_ALLOC_SIZE(nums);
ret = sched_getaffinity(0,size,cpusetp);
if (ret!=0) return nums;
nums = CPU_COUNT_S(size,cpusetp);
ret = CPU_COUNT_S(size,cpusetp);
if (ret > 0 && ret < nums) nums = ret;
CPU_FREE(cpusetp);
return nums;
#endif