And this is good for what? Did you take care that only one thread can access the global variable at a time? Did you make sure that the index variable has the correct value, when the loop in the local functions is started?

It would be better to have a look in the module on multithreading before playing around, so please do this first. Then print out the values of the index variable in a sequential and a parellel run. This should help you to see what is going wrong.

Best Regards,
Markus



Am 17.12.10 18:30, schrieb Ted Kord:
Hi Markus,

The index variable is now completely initialised in the global function like so:

index = 0;
iterate();

Yet, it's still not giving the correct solution. What could be wrong?

Ted

On 17 December 2010 16:39, Markus Bürg <[email protected] <mailto:[email protected]>> wrote:

    Hello Ted,

    obviously this code does not fix the issue. You have to pull out
    the initialization of the index variable into the global function.

    Best Regards,
    Markus



    Am 17.12.10 17:31, schrieb Ted Kord:

    Hi Markus,


    On 17 December 2010 16:01, Markus Bürg <[email protected]
    <mailto:[email protected]>> wrote:

        Hello Ted,

        the variable index contains other values now. In the
        sequential version you set it to zero before you loop over
        the intervals, but in the parallel version you set it to zero
        at the beginning of every chunk of intervals.

        Best Regards,
        Markus



    Even when I rewrite it as:

    template <int dim>
    void TestEquation<dim>::test_
    iteration_interval(double time, TestIterator &begin, TestIterator
    &end) {
        int index = 0;
        TestIterator p;
        for(int step = 0; iteration_time <= 0.5*time; ++step) {
            iteration_time += some_step;
            for (p = begin; p != end; ++p) {
                do some stuff


                write_lock.acquire();

                old_solution_u(index) = do_some_calculation();
                ++index;
                write_lock.release();
            }
        }
    }

    The results are still incorrect.
    Many thanks,

    Ted



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

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

Reply via email to