On Fri, 24 Jul 2020, Ferguson, Michael Paul Pratt (Chapel Developer) wrote:

I suspect the issue with this construct is more to do with the overhead of constructing and operating on array views - combined with nested parallelism. It'd be interesting to try to improve the performance of this case if it's the way you'd really like to express your program.

Linear algebra algorithms typically work on sub-matrices. These can naturally be expressed as an array view. And Chapel handle this so beautifully.

Today, the expression `t[i, ..]` allocates memory in the process
of creating the array view. That can  cause performance problems.
I don't know if that's causing problems in your case here.

45%+ of the elapsed time in my algorithm is spent doing

        [ (i, j) in tD ] t[i, j] += x[i] * y[j];

No array view there.

and another 49% is spent in another loop which starts as

        forall in r in rows do
        {
                ref zr = z[r, ..];

                for j in cfirst_1 .. clast do
                {
                        .. stuff using zr[i] and zr[i-1]
                }
        }

OK. Array view there. I just changed it. And the performance is the same. So, no measurable overhead there either.

The only reason for the array view was in the hope that the optimizer might get a bit of a hint that I was working on a single row. It also
makes it clearer.

Anyway it's also possible that overhead from array views is
preventing vectorization within the C compiler.

No idea. Something to think about. My experiennce is that GCC does not
vectorize very well. Then again, maybe it is the quality of my code!

I don't think we currently have the ability to pass array views
(such as `t[i, ..]` into `extern` functions. That might be something
we could extend `chpl_external_array` to do, though.

That needs a bit more thought on my side. Not crucial.

Thanks for the detailed reply - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer


_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to