I know that the recommended way to @thread build array is to split the work based on (What I said is the same as the macro @threads.) Nevertheless, in the below each thread should never write to the same column. Could someone explain why building array like this is not safe?nthreads()
and then join the array later.
A = spzeros(Float64, n, m)
@threads for j in 1:m
A[:, j] = load("a$j") # pseudocode to load array from file
end
Edit: I might have found the problem: writing to SparseMatrixCSC like above is wrong (not thread-safe).