concept high - level OpenMP implementation in category parallel computing
appears as: high-level OpenMP implementation

This is an excerpt from Manning's book Parallel and High Performance Computing.
Listing 7.14 Function level variable scope in C/C++
5 void function_level_OpenMP(int n, double *y) #A 6 { 7 double *x; #B 8 static double *x1; #C 9 10 int thread_id; 11 #pragma omp parallel 12 thread_id = omp_get_thread_num(); 13 14 if (thread_id == 0) x = (double *)malloc(100*sizeof(double)); #D 15 if (thread_id == 0) x1 = (double *)malloc(100*sizeof(double)); #E 16 17 // lots of code 18 if (thread_id ==0) free(x); 19 if (thread_id ==0) free(x1); 20 }