I am having a problem running the following code in parallel. Please suggest how to achieve the parallelization to populate an array by a so-called very computationally expensive function.
Thanks and Regards
Amol
#!/usr/bin/julia
using Base.Threads
using LinearAlgebra,NumericalIntegration
x = collect(0:1e-6:1);
function test_func(a)
return a*a;
end
test = zeros(length(x));
Threads.@threads for i = 0:length(x)
test[i] = test_func(x[i]);
end
println("integrate = ", integrate(x,test) );
println(" ");