void _start(void) { u8 buf[DPRINTF_BUF_SZ]; dprintf_buf=&buf[0]; function_1(1,2); function_2(3,4); exit(0); }
int test_omp_section() { #pragma omp parallel sections { #pragma omp section function_1(); #pragma omp section function_2(); } return 0; }
void model1() { /* clear all pixels */ glClearColor (0.0, 0.0, 0.0, 0.0);//default background for white glClear (GL_COLOR_BUFFER_BIT); /* print coordinate */ grid(); coordinate(); function_1(); function_2(); function_3(); function_4(); /* buffer */ glFlush(); }
main () {int a, i, j, tmp1, n=10, aa[10], bb[10]; /* Explicitly turn off dynamic threads */ omp_set_dynamic(0); omp_set_num_threads(4); tmp1=0; #pragma omp parallel shared (tmp1) { #pragma omp for firstprivate (tmp1) lastprivate (tmp1) for (j= 0; j<100; ++j){ tmp1 =j; if (omp_get_thread_num() ==0) printf (" loop %d, tmp1 %d \n",j, tmp1); } } printf (" lastprivate tmp1 = %d\n", tmp1); function_1(); function_2(); #pragma omp parallel for private(i) lastprivate(a) for (i=0; i<n; i++) { a = i+1; printf("Thread %d has a value of a = %d for i = %d\n", omp_get_thread_num(),a,i); } /*-- End of parallel for --*/ printf("Value of a after parallel for: a = %d\n",a); #pragma omp parallel for for (i=1; i<n; i++) /* i is private by default */ { bb[i] = (aa[i] + aa[i-1]) / 2.0; printf ("Work on b[%d] done by thread %d \n", i, omp_get_thread_num()); } return(0); }
int function_under_test_2_calls(void) { int result; if (function_1() != 0) { result = __LINE__; } else { if (function_2() != 0) { result = __LINE__; } else { result = 0; } } return result; }
int main() { function_1(100); function_2(100); return 0; }