Hi Wolfgang,

2010/12/17 Wolfgang Bangerth <[email protected]>

>
> > The index variable is now completely initialised in the global function
> > like so:
> >
> > index = 0;
> > iterate();
>
> The point Markus is making is this: when you initialize index=0 as above,
> then
> every one of the threads is using this global variable index to write into
> old_solution, all of them writing into entries old_solution_u(index) that
> correspond to the value the global variable 'index' has at the time when
> you
> get to the point that the thread acquires the lock. The order in which
> threads acquire this lock is not predictable.
>
> On the other hand, in your original code, the 'index' variable was local to
> the 'iterate' function. In that case, every thread has its own 'index'
> variable, but since you initialize it at the beginning of the function to
> zero, every thread starts to write into old_solution_u *at position zero*,
> typically overwriting what other threads have previously written into this
> location.
>
> What you'll need to do is let every thread have its own 'index' variable as
> you had in your original version, but you need to set it to the location of
> the first entry that *this particular thread* is supposed to write to.
>
> Makes sense?
>
>
Thank you. This makes sense.


-- 
Many thanks,

Ted
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to