I was reading through some ideas about what a barrier in computer science is (specifically a function barrier) and wanted to know how this sort of thing can be replicated in my own Julia code. I have the following function:
julia> function strange_twos(n)
a = Vector{rand(Bool) ? Int64 : Float64}(undef, n)
for i = 1:n
a[i] = 2
end
return a
end;
How would I go about adding a barrier to this function to improve performance?