/* * integrade.c * * A prgram integrate the function y=x^2 from 0 to 2. * */ #include #include #include /* you can adjust this to get reasonable running time on your computer */ /* #define NUM_STEPS (1<<29) */ /*#define NUM_STEPS 1000000000 */ int main(int argc, char *argv[]) { double start, stop; /* for keeping track of running time */ double sum; double x; long i; long NUM_STEPS=1000000000; /* time starts now */ start = clock(); printf("thread number %d\n",omp_get_thread_num()); printf("current threads %d\n",omp_get_num_threads()); printf("max threads %d\n",omp_get_max_threads()); printf("number procs %d\n",omp_get_num_procs()); sum = 0; #pragma omp parallel for reduction(+: sum) for (i = 0; i