Follow up for those concerned at home: the issue appears to be limited to arrays created with 1..0 loops:

proc reductive_sequential(): bigint {
    return * reduce for i in 1..0 do new bigint(i);
  }

Lydia

On 1/9/18 8:52 AM, Lydia Duncan wrote:
Hi Russel,

I'm confident this is not your fault.

It looks like we're trying to clean up the array used for the reduction in the `reductive_sequential(n: int): bigint` function too early, and that seems to be linked to using initializers (if I roll Chapel back to before the BigInteger initializer conversion, I instead get:

iterative_bigint: assertion failed: 3 != 6
iterative_bigint: assertion failed:  != 24
iterative_bigint: assertion failed: 5 != 120
iterative_bigint: assertion failed: 6 != 720
iterative_bigint: assertion failed: 7 != 5040
iterative_bigint: assertion failed: 8 != 40320
iterative_bigint: assertion failed: 9 != 362880
iterative_bigint: assertion failed: 10 != 3628800
iterative_bigint: assertion failed: 11 != 39916800
iterative_bigint: assertion failed: 12 != 479001600
iterative_bigint: assertion failed: 13 != 6227020800
iterative_bigint: assertion failed: 14 != 87178291200
iterative_bigint: assertion failed: 20 != 2432902008176640000
iterative_bigint: assertion failed: 30 != 265252859812191058636308480000000 iterative_bigint: assertion failed: 40 != 815915283247897734345611269596115894272000000000

#### 72 assertions, 15 failures.

as output, which is coming from a different function).

Here is the starting code (version 1):

proc reductive_sequential(n:int): bigint {
    assert(n >= 0);
    return * reduce for i in 1..n do new bigint(i);
}

If I transform it into this, we still get the same error (version 2):

proc reductive_sequential(n:int): bigint {
    assert(n >= 0);
    var retVal = * reduce for i in 1..n do new bigint(i);
    return retVal;
}

If I further transform it into this, then the program works again (version 3).

proc reductive_sequential(n:int): bigint {
    assert(n >= 0);
    var tempArr = for i in 1..n do new bigint(i);
    var retVal = * reduce tempArr;
    return retVal;
}

Note, though, that creating the array with the parallel for loop (as is done in `reductive_parallel`) only encounters the error for version 1, and the version 2 transformation solves it. So, if you modify your reduction functions to store each step instead of having them all at once, you will avoid this bug.

Sorry you ran into this!  We'll get working on the fix soon.

Thanks,
Lydia



On 1/9/18 4:09 AM, Russel Winder wrote:
On Mon, 2018-01-08 at 08:10 -0800, Lydia Duncan wrote:
Hmm.  At this point it might be useful to see your test code.
The code is here:

https://github.com/russel/Factorial/tree/master/Chapel

Hopefully I am just doing something wrong.




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to