MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / pi_device

Function pi_device

examples/benchmarks/pi.cpp:30–33  ·  view source on GitHub ↗

Self-contained code to run host and device estimates of PI. Note that each is generating its own random values, so the estimates of PI will differ. */

Source from the content-addressed store, hash-verified

28 each is generating its own random values, so the estimates of PI
29 will differ. */
30static double pi_device() {
31 array x = randu(samples, f32), y = randu(samples, f32);
32 return 4.0 * sum<float>(sqrt(x * x + y * y) < 1) / samples;
33}
34
35static double pi_host() {
36 int count = 0;

Callers 2

device_wrapperFunction · 0.85
mainFunction · 0.85

Calls 2

randuFunction · 0.85
sqrtFunction · 0.85

Tested by

no test coverage detected