The code bellow produces this weird message:
julia> include("C:\\Users\\pkonl\\Desktop\\weird.jl")
Threads.nthreads() = 4
BLAS.get_num_threads() = 4
[ Info: mgsortho!(A)
(m, n) = size(A) = (100000, 25)
SYSTEM (REPL): showing an error caused an error
SYSTEM (REPL): caught exception of type MethodError while trying to handle a nested exception; giving up
julia>
MWE:
using LinearAlgebra
function coldot(A, j, i)
m = size(A, 1)
r = zero(eltype(A))
@simd for k in 1:m
r += A[k, i] * A[k, j]
end
return r;
end
function colnorm(A, j)
return sqrt(coldot(A, j, j));
end
function colsubt!(A, i, j, r)
m = size(A, 1)
@simd for k in 1:m
A[k, i] -= r * A[k, j]
end
end
function normalizecol!(A, j)
m = size(A, 1)
r = 1.0 / colnorm(A, j)
@simd for k in 1:m
A[k, j] *= r
end
end
function mgsortho!(A)
@show m, n = size(A)
normalizecol!(A, 1)
for j in 2:n
Base.Threads.@threads for i in j:n
colsubt!(A, i, j-1, coldot(A, j-1, i))
end
normalizecol!(A, j)
end
b = 5c # error introduced on purpose
return A
end
@show Threads.nthreads()
BLAS.set_num_threads(Threads.nthreads())
using LinearAlgebra;
@show BLAS.get_num_threads()
m = 100000
n = 25
A = rand(m, n)
B = deepcopy(A)
A .= B
@info "mgsortho!(A)"
@time mgsortho!(A)
@show norm(A'*A - LinearAlgebra.I, Inf)
nothing