[Issue 16705] New: TaskPool.reduce fails to compile "cannot get frame pointer to D main"
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Nov 20 04:46:50 PST 2016
https://issues.dlang.org/show_bug.cgi?id=16705
Issue ID: 16705
Summary: TaskPool.reduce fails to compile "cannot get frame
pointer to D main"
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: mihai at unity3d.com
The synopsis code from https://dlang.org/phobos/std_parallelism.html generates
a "cannot get frame pointer" compile error:
/Library/D/dmd/src/phobos/std/parallelism.d(2633): Error: function
std.parallelism.TaskPool.reduce!"a + b".reduce!(MapResult!(getTerm,
Result)).reduce cannot get frame pointer to D main
```d
import std.algorithm, std.parallelism, std.range;
void main() {
// Parallel reduce can be combined with
// std.algorithm.map to interesting effect.
// The following example (thanks to Russel Winder)
// calculates pi by quadrature using
// std.algorithm.map and TaskPool.reduce.
// getTerm is evaluated in parallel as needed by
// TaskPool.reduce.
//
// Timings on an Athlon 64 X2 dual core machine:
//
// TaskPool.reduce: 12.170 s
// std.algorithm.reduce: 24.065 s
immutable n = 1_000_000_000;
immutable delta = 1.0 / n;
real getTerm(int i)
{
immutable x = ( i - 0.5 ) * delta;
return delta / ( 1.0 + x * x ) ;
}
immutable pi = 4.0 * taskPool.reduce!"a + b"(
std.algorithm.map!getTerm(iota(n))
);
}
```
--
More information about the Digitalmars-d-bugs
mailing list