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. */
| 28 | each is generating its own random values, so the estimates of PI |
| 29 | will differ. */ |
| 30 | static 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 | |
| 35 | static double pi_host() { |
| 36 | int count = 0; |
no test coverage detected