Thank you @stillyslalom for your explanation. I have compared between the @batch
and the method here:https://discourse.julialang.org/t/optional-macro-invocation/18588/21
function ss()
dt = 0.001;
tmin = 0;
tmax = 5;
timeSim = tmin:dt:tmax;
A_Mat = spzeros(9,9);
for i in 1:9
A_Mat[i,i] = 1;
end
I_Mat = ones(9,3);
iter = 0;
for t in timeSim
iter += 1;
n=101
#@threadsif n>100 for i in 1:n #by using it the time is 182 ms
@batch minbatch=15 for i in 1:n #by using it the time is 879.872 ms
V_Mat = A_Mat \ I_Mat;
end
end
end
using SparseArrays;
using LinearAlgebra;
using .Threads
using Polyester
using BenchmarkTools
@btime ss()
Any reason why @batch
results in a really big number comparing with conditional thread @threadsif
?