From a2977c7923c3af1ad42b9d31a0c000decf111fd0 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 14 Jun 2023 13:52:47 -0400 Subject: [PATCH] fix nthreads on 1.9 --- src/dim_helpers/ConvDims.jl | 2 +- src/gemm.jl | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dim_helpers/ConvDims.jl b/src/dim_helpers/ConvDims.jl index a0edb9d80..9358a41a8 100644 --- a/src/dim_helpers/ConvDims.jl +++ b/src/dim_helpers/ConvDims.jl @@ -73,7 +73,7 @@ function im2col_dims(c::ConvDims) # Size of single dotproduct within convolution prod(kernel_size(c))*channels_in(c), # One workspace per thread - Threads.nthreads(), + VERSION > v"1.9.0-0" ? Threads.maxthreadid() : Threads.nthreads(), ) end diff --git a/src/gemm.jl b/src/gemm.jl index 95c39d23f..051508750 100644 --- a/src/gemm.jl +++ b/src/gemm.jl @@ -88,7 +88,9 @@ for (gemm, elt) in gemm_datatype_mappings strB = size(B, 3) == 1 ? 0 : Base.stride(B, 3) strC = Base.stride(C, 3) - n_threads = min(Threads.nthreads(), 1 + max(length(A), length(B)) ÷ 8000) + n_threads = min( + VERSION > v"1.9.0-0" ? Threads.maxthreadid() : Threads.nthreads(), + 1 + max(length(A), length(B)) ÷ 8000) # In some tests, size (20,20,20) is worth splitting between two threads, # as is size (32,32,8).