Re: [julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Yichao Yu
On Tue, Oct 11, 2016 at 1:13 PM, Evan Fields wrote: > I'm unsure if "bit shared" is a technical term I should know, or if "bit > shared" is a smartphone typo for "not shared" which would describe my > understanding of normal loops, where it seems each iteration

Re: [julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Evan Fields
I'm unsure if "bit shared" is a technical term I should know, or if "bit shared" is a smartphone typo for "not shared" which would describe my understanding of normal loops, where it seems each iteration doesn't have access to loop-only variables defined in a previous iteration. :) I guess the

Re: [julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Yichao Yu
On Oct 11, 2016 12:34 PM, "Evan Fields" wrote: > > Let's say I have a type MyType and function f(mt::MyType) which is slow and stochastic. I have an object y::MyType, and I'd like to compute f(y) many times. > > If I write a loop like > fvals = Vector{Float64}(100) >

[julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Evan Fields
Let's say I have a type MyType and function f(mt::MyType) which is slow and stochastic. I have an object y::MyType, and I'd like to compute f(y) many times. If I write a loop like fvals = Vector{Float64}(100) Threads.@threads for i in 1:length(fvals) ycopy = deepcopy(y) fvals[i] = f(ycopy)