Bibek,

Will this do the distributed computation?

I will let you go through this exercise yourself. Here are a couple of tips:

* You can use writeln(here) to see what locale you are executing on.

* You can consult the Chapel spec to see what dims() returns.

* You can use compilerWarning(typeToString(myVariable.type)) to see the type of the variable 'myVariable'.

* As I mentioned, forall over a range does not go to other locales.

Separately, Chapel now has atomic variables, described in the Task Parallelism and Synchronization chapter of the spec. You will likely get better performance using atomics instead of locking/unlocking.

Regards,
Vass

On Sat, 3 May 2014, Bibek Ghimire wrote:

Thank you, Vass for the response. 
ok so there is race condition, I agree.

for distributed computation
I actually do 

var ad = A.domain.dims();
var bd = B.domain.dims();
var cd = C.domain.dims();

var (arow, acol) =  ad;
var (brow, bcol) =  bd;

var (crow, ccol) =  cd;
var lock:sync bool;

forall i in arow do
  forall j in bcol do     forall k in acol do
       lock = true;
       C(i,j) += A(i,k)*B(k,j); 
       var unlock = lock;

Will this do the distributed computation?
To avoid race condition I was planning to use sync variable.

...
------------------------------------------------------------------------------
"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

Reply via email to