| 47 | static void host_wrapper() { pi_host(); } |
| 48 | |
| 49 | int main(int argc, char** argv) { |
| 50 | try { |
| 51 | int device = argc > 1 ? atoi(argv[1]) : 0; |
| 52 | setDevice(device); |
| 53 | info(); |
| 54 | |
| 55 | printf("device: %.5f seconds to estimate pi = %.5f\n", |
| 56 | timeit(device_wrapper), pi_device()); |
| 57 | printf(" host: %.5f seconds to estimate pi = %.5f\n", |
| 58 | timeit(host_wrapper), pi_host()); |
| 59 | } catch (exception& e) { |
| 60 | fprintf(stderr, "%s\n", e.what()); |
| 61 | throw; |
| 62 | } |
| 63 | |
| 64 | return 0; |
| 65 | } |