Weird spike in time to determinant computation with size of matrx

On my university’s cluster (and not on my PC), I see this extremely weird scaling of time to compute determinants with the size of the matrix. For example, if I do this

for dim in 96:1:104
           @btime logdet(x) setup=(x=randn(ComplexF64,$dim,$dim))
end

I get,

  196.150 μs (3 allocations: 138.91 KiB)
  204.822 μs (3 allocations: 141.91 KiB)
  202.566 μs (3 allocations: 144.92 KiB)
  215.740 μs (3 allocations: 147.98 KiB)
  216.941 μs (3 allocations: 150.98 KiB)
  225.461 μs (3 allocations: 154.11 KiB)
  3.747 s (3 allocations: 157.17 KiB)
  3.761 s (3 allocations: 160.36 KiB)
  3.908 s (3 allocations: 163.48 KiB)
  3.836 s (3 allocations: 166.73 KiB)
  3.888 s (3 allocations: 169.92 KiB)

The same on my PC gives,

  90.980 μs (3 allocations: 138.91 KiB)
  93.274 μs (3 allocations: 141.91 KiB)
  94.687 μs (3 allocations: 144.92 KiB)
  101.139 μs (3 allocations: 147.98 KiB)
  102.552 μs (3 allocations: 150.98 KiB)
  103.473 μs (3 allocations: 154.11 KiB)
  199.122 μs (3 allocations: 157.17 KiB)
  200.384 μs (3 allocations: 160.36 KiB)
  276.636 μs (3 allocations: 163.48 KiB)
  210.874 μs (3 allocations: 166.73 KiB)
  213.188 μs (3 allocations: 169.92 KiB)

I see a jump in time for dim = 100 on my PC (row 7 in both cases), but nothing like the one I get on my university’s cluster. Why would this be the case? I am happy to provide more details if necessary.

1 Like

it’s jumping to multi threading and using all available threads which is more than it should be using.

Setting

LinearAlgebra.BLAS.set_num_threads(1)

gives me the following

  184.687 μs (3 allocations: 138.91 KiB)
  193.254 μs (3 allocations: 141.91 KiB)
  192.760 μs (3 allocations: 144.92 KiB)
  202.302 μs (3 allocations: 147.98 KiB)
  203.730 μs (3 allocations: 150.98 KiB)
  212.974 μs (3 allocations: 154.11 KiB)
  215.011 μs (3 allocations: 157.17 KiB)
  227.775 μs (3 allocations: 160.36 KiB)
  233.216 μs (3 allocations: 163.48 KiB)
  248.569 μs (3 allocations: 166.73 KiB)
  247.768 μs (3 allocations: 169.92 KiB)

Thank you!