Skip to content

Commit 7c86160

Browse files
authored
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
1 parent 0ab5bf1 commit 7c86160

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

driver/others/memory.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ int ret;
209209
size = CPU_ALLOC_SIZE(nums);
210210
ret = sched_getaffinity(0,size,cpusetp);
211211
if (ret!=0) return nums;
212-
nums = CPU_COUNT_S(size,cpusetp);
212+
ret = CPU_COUNT_S(size,cpusetp);
213+
if (ret > 0 && ret < nums) nums = ret;
213214
CPU_FREE(cpusetp);
214215
return nums;
215216
#endif

0 commit comments

Comments
 (0)