Hi,
You should certainly be able to send numbers from the leader to the follower
one by one. Here is what you can do to make Chapel happy:
* Do not assign to 'r.stridable'. It is a param and so is not assignable.
Actually you do not even need to do that because the type 'range' without
additional arguments has stridable=false already by default.
* Your follower expects a tuple whereas your leader yields a range. Have the
leader yield a tuple.
* Your leader yields un-translated ranges whereas your follower expects 0-based
range(s). Array's follower also expects 0-based ranges. This matters because
you are using zippering, so array's follower participates in your forall loop
and accepts whatever your leader is yielding.
* Given the above, the loop in your leader could be written as:
for i in 0..high-low do
yield (i..i,);
which I think will work with the rest of your example.
* BTW if you want merely to initialize the array, Chapel lets you do it like
this:
var A:[1..10] int = 21..30;
Vass
----- Forwarded message from Tomsy Paul <[email protected]> -----
Date: Thu, 26 Nov 2015 15:57:44 +0530
From: Tomsy Paul <[email protected]>
To: chapel-developers <[email protected]>
Subject: [Chapel-developers] Leader-follower internal error
Hi all,
I was playing with Leader-follower zippered iterator. I have a counter
iterator given below. My aim is to make the leader send numbers low..high
one by one to follower which yield them , one by one. (Hope it is okay?)
//serial version
iter counter(low:int,high:int)
{
writeln("This is from serial");
for i in low..high do yield i;
}
//creating Leader-Follower
iter counter(param tag: iterKind,low:int,high:int) where tag ==
iterKind.leader
{
writeln("This is from leader");
for i in low..high
{
var r: range;
r=i..i;
r.stridable=false;
yield r;
}
}
iter counter(param tag: iterKind,low:int,high:int,followThis) where tag ==
iterKind.follower
{
writeln("This is from follower");
for i in followThis(1).translate(low) do yield i;
}
var A:[1..10] int;
forall (i,j) in zip(counter(21,30),A) do
j=i;
writeln("\n\nA after forall zippering is",A);
Which when compiled gave the error
myleaderfollower3.chpl:13: In iterator 'counter':
myleaderfollower3.chpl:24: internal error: PRI0162 chpl Version
1.12.0.2bb0f9c
Internal errors indicate a bug in the Chapel compiler ("It's us, not you"),
and we're sorry for the hassle. We would appreciate your reporting this
bug --
please see http://chapel.cray.com/bugs.html for instructions. In the
meantime,
the filename + line number above may be useful in working around the issue.
What's wrong?
------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers