I revise my “crux” part code as
sub_j_vec = rand_j_vec[1+(ba-1)TH : min(J, (ba)TH)]
@info "before entering @threads" sub_j_vec
Threads.@threads for i = eachindex(sub_j_vec) # strictly This is NOT a loop
j = sub_j_vec[i]
@info "inside @threads" i j
end
error("#1 can you see this error??")
Then I observe this weird thing (why is there repetition of j = 3
??)
julia> parallel_CG!(B, θ, β, μ, ν)
┌ Info: before entering @threads
│ sub_j_vec =
│ 4-element Vector{Int64}:
│ 1
│ 4
│ 2
└ 3
┌ Info: inside @threads
│ i = 1
└ j = 2
┌ Info: inside @threads
│ i = 2
└ j = 3
┌ Info: inside @threads
│ i = 4
└ j = 3
┌ Info: inside @threads
│ i = 3
└ j = 3
ERROR: #1 can you see this error??