int main(int argc, char **argv) { int n = 100*1000*1000; double PI25DT = 3.141592653589793238462643; double pi, h, area, x; pid_t p; int i; p = fork(); if (p == 0) { printf ("Child is about to calculate pi...\n"); fflush (stdout); pi_kernel (n, h); printf ("Child finished\n"); fflush (stdout); } else { int status; printf ("Parent is waiting...\n"); fflush (stdout); waitpid (p, &status, 0); printf ("Parent finished waiting\n"); fflush (stdout); } return 0; }
int main(int argc, char **argv) { int n = 1000000; double PI25DT = 3.141592653589793238462643; double pi, h, area, x; h = 1.0 / (double) n; area = pi_kernel (n, h); pi = h * area; printf("pi is approximately %.16f, Error is %.16f\n",pi,fabs(pi - PI25DT)); }
int main (void) { int n = 1000; double PI25DT = 3.141592653589793238462643; double pi, h, area; Extrae_register_codelocation_type (2000, 2020, "Function-F", "Line-Source-F"); h = 1.0 / (double) n; area = pi_kernel (n, h); pi = h * area; printf("pi is approximately %.16f, Error is %.16f\n",pi,fabs(pi - PI25DT)); sleep_kernel (2); fake_kernel_ol_1 (); fake_kernel_ol_2 (); return 0; }
int main(int argc, char **argv) { int n = 1000000; double PI25DT = 3.141592653589793238462643; double pi, h, area, x; extrae_type_t type = 1000; int nvalues = 2; extrae_value_t values[2] = {0, 1}; char * description_values[2] = {"End", "Begin" }; Extrae_init(); Extrae_define_event_type (&type, "Kernel execution", &nvalues, values, description_values); h = 1.0 / (double) n; Extrae_event (1000, 1); area = pi_kernel (n, h); Extrae_event (1000, 0); pi = h * area; printf("pi is approximately %.16f, Error is %.16f\n",pi,fabs(pi - PI25DT)); Extrae_fini(); }