ARTS  2.3.1285(git:92a29ea9-dirty)
arts_omp.cc
Go to the documentation of this file.
1 /* Copyright (C) 2012 Stefan Buehler <sbuehler(at)ltu.se>
2 
3  This program is free software; you can redistribute it and/or
4  modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation; either version 2 of the
6  License, or (at your option) any later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
16  USA. */
17 
33 #include "arts.h"
34 
35 #include <iostream>
36 using namespace std;
37 
38 #include "arts_omp.h"
39 
41 
47 #ifdef _OPENMP
48  int max_threads = omp_get_max_threads();
49 #else
50  int max_threads = 1;
51 #endif
52 
53  return max_threads;
54 }
55 
57 
63 #ifdef _OPENMP
64  return omp_in_parallel();
65 #else
66  return false;
67 #endif
68 }
69 
71 
77 #ifdef _OPENMP
78  int thread_num = omp_get_thread_num();
79 #else
80  int thread_num = 0;
81 #endif
82 
83  return thread_num;
84 }
85 
87 
93 #ifdef _OPENMP
94  int nested = omp_get_nested();
95 #else
96  int nested = 0;
97 #endif
98 
99  return nested;
100 }
101 
103 
108 #ifdef _OPENMP
109 void arts_omp_set_nested(int i)
110 #else
112 #endif
113 {
114 
115 #ifdef _OPENMP
116  omp_set_nested(i);
117 #else
118  // Nothing to do here.
119 #endif
120 }
121 
123 
128 #ifdef _OPENMP
129 void arts_omp_set_dynamic(int i)
130 #else
131 void arts_omp_set_dynamic(int i _U_)
132 #endif
133 {
134 
135 #ifdef _OPENMP
136  omp_set_dynamic(i);
137 #else
138  // Nothing to do here.
139 #endif
140 }
void arts_omp_set_dynamic(int i)
Wrapper for omp_set_dynamic.
Definition: arts_omp.cc:131
bool arts_omp_in_parallel()
Wrapper for omp_in_parallel.
Definition: arts_omp.cc:62
int arts_omp_get_thread_num()
Wrapper for omp_get_thread_num.
Definition: arts_omp.cc:76
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
Definition: arts_omp.cc:46
int arts_omp_get_nested()
Wrapper for omp_get_nested.
Definition: arts_omp.cc:92
The global header file for ARTS.
void arts_omp_set_nested(int i)
Wrapper for omp_set_nested.
Definition: arts_omp.cc:111
#define _U_
Definition: config.h:183
Header file for helper functions for OpenMP.