Hi Bibek,
* In this loop from your example:
forall k in acol do
C(i,j) += A(i,k)*B(k,j);
all iterations may execute in parallel, i.e. all read and write into
C(i,j) at the same time. Races can arise easily.
BTW in your context, given that this loop is nested in two other parallel
loops, it may increase performance if you make it a serial loop ('for').
In such case there should be no races.
* Declaring var A,B,C:[D] int; ensures distributed storage. This does not
by itself guarantee distributed computation. Whether and how the
computation is distributed is determined by what your forall iterates
over. E.g.
forall i in arow do
If 'arow' is a range or a domain that is not distributed, all iterations
of the loop will be started on the current locale.
In contrast, e.g. this loop:
forall (i,j) in D do
will start a particular iteration (i,j) on the same node as the one that
hosts A(i,j), B(i,j), C(i,j).
Vass
On Sat, 3 May 2014, Bibek Ghimire wrote:
Hi there, I have written a simple distributed matrix multiplication
code in chapel.
The main part of the code is
var D: domain(2) dmapped Block(boundingBox={1..n,1..n})= {1..n,1..n}
which declares domain mapping of type Block and this Block type helps to
distributes data
into multiple nodes. So now I create an Array for them to distributed along the
nodes.
var A,B,C:[D] int;
//var c:[n, n] int ; q1) What if I create c this way, will it reside on locale
0 and all result come to node 0?
Then I do the multiplication here
forall i in arow do
forall j in bcol do
forall k in acol do
C(i,j) += A(i,k)*B(k,j);
I thought there will not be any race condition here because we are reading
array A, B and writing into C's individual array position. q2) Is it ok to do
so?
I was looking into the BlockDist.chpl to figure out how its internal works but
little confused.
Thank you,
Bibek
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users