00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00033 #if HAVE_CONFIG_H
00034 #include <config.h>
00035 #else
00036 #error "Please run ./configure in the top arts directory before compiling."
00037 #endif
00038
00039 #include <iostream>
00040 using namespace std;
00041
00042 #include "arts_omp.h"
00043
00044
00046
00051 int arts_omp_get_max_threads()
00052 {
00053
00054 #ifdef _OPENMP
00055 int max_threads = omp_get_max_threads();
00056 #else
00057 int max_threads = 1;
00058 #endif
00059
00060 return max_threads;
00061 }
00062
00063
00065
00070 bool arts_omp_in_parallel()
00071 {
00072
00073 #ifdef _OPENMP
00074 #ifdef __ICC
00075 return (omp_get_max_threads() > 1);
00076 #else
00077 return omp_in_parallel();
00078 #endif
00079 #else
00080 return false;
00081 #endif
00082 }
00083
00084
00086
00091 int arts_omp_get_thread_num()
00092 {
00093
00094 #ifdef _OPENMP
00095 int thread_num = omp_get_thread_num();
00096 #else
00097 int thread_num = 0;
00098 #endif
00099
00100 return thread_num;
00101 }
00102
00103
00105
00110 int arts_omp_get_nested()
00111 {
00112
00113 #ifdef _OPENMP
00114 int nested = omp_get_nested();
00115 #else
00116 int nested = 0;
00117 #endif
00118
00119 return nested;
00120 }
00121
00122
00124
00129 #ifdef _OPENMP
00130 void arts_omp_set_nested(int i)
00131 #else
00132 void arts_omp_set_nested(int i _U_)
00133 #endif
00134 {
00135
00136 #ifdef _OPENMP
00137 omp_set_nested(i);
00138 #else
00139
00140 #endif
00141
00142 }
00143