00001 #include <stdlib.h> 00002 00003 int cnt; 00004 00005 void 00006 check (int x) 00007 { 00008 if (cnt++ != x) 00009 abort (); 00010 } 00011 00012 int 00013 main (void) 00014 { 00015 int j; 00016 00017 cnt = 0; 00018 #pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (0) 00019 for (j = 0; j < 1000; j++) 00020 { 00021 #pragma omp ordered 00022 check (j); 00023 } 00024 00025 cnt = 0; 00026 #pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (1) 00027 for (j = 0; j < 1000; j++) 00028 { 00029 #pragma omp ordered 00030 check (j); 00031 } 00032 00033 cnt = 0; 00034 #pragma omp parallel for ordered schedule (runtime) num_threads (4) if (0) 00035 for (j = 0; j < 1000; j++) 00036 { 00037 #pragma omp ordered 00038 check (j); 00039 } 00040 00041 cnt = 0; 00042 #pragma omp parallel for ordered schedule (runtime) num_threads (4) if (1) 00043 for (j = 0; j < 1000; j++) 00044 { 00045 #pragma omp ordered 00046 check (j); 00047 } 00048 00049 cnt = 0; 00050 #pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (0) 00051 for (j = 0; j < 1000; j++) 00052 { 00053 #pragma omp ordered 00054 check (j); 00055 } 00056 00057 cnt = 0; 00058 #pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (1) 00059 for (j = 0; j < 1000; j++) 00060 { 00061 #pragma omp ordered 00062 check (j); 00063 } 00064 00065 cnt = 0; 00066 #pragma omp parallel for ordered schedule (guided) num_threads (4) if (0) 00067 for (j = 0; j < 1000; j++) 00068 { 00069 #pragma omp ordered 00070 check (j); 00071 } 00072 00073 cnt = 0; 00074 #pragma omp parallel for ordered schedule (guided) num_threads (4) if (1) 00075 for (j = 0; j < 1000; j++) 00076 { 00077 #pragma omp ordered 00078 check (j); 00079 } 00080 00081 return 0; 00082 }