1 |
gross |
391 |
/* |
2 |
elspeth |
615 |
************************************************************ |
3 |
|
|
* Copyright 2006 by ACcESS MNRF * |
4 |
|
|
* * |
5 |
|
|
* http://www.access.edu.au * |
6 |
|
|
* Primary Business: Queensland, Australia * |
7 |
|
|
* Licensed under the Open Software License version 3.0 * |
8 |
|
|
* http://www.opensource.org/licenses/osl-3.0.php * |
9 |
|
|
* * |
10 |
|
|
************************************************************ |
11 |
gross |
391 |
*/ |
12 |
|
|
|
13 |
jgs |
474 |
#include "Utils.h" |
14 |
gross |
391 |
|
15 |
jgs |
478 |
#ifdef _OPENMP |
16 |
|
|
#include <omp.h> |
17 |
|
|
#endif |
18 |
|
|
|
19 |
gross |
391 |
namespace escript { |
20 |
|
|
|
21 |
|
|
void setNumberOfThreads(const int num_threads) |
22 |
|
|
{ |
23 |
|
|
|
24 |
|
|
#ifdef _OPENMP |
25 |
|
|
omp_set_num_threads(num_threads); |
26 |
|
|
#endif |
27 |
|
|
|
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
int getNumberOfThreads() |
31 |
|
|
{ |
32 |
|
|
#ifdef _OPENMP |
33 |
|
|
return omp_get_max_threads(); |
34 |
|
|
#else |
35 |
|
|
return 1; |
36 |
|
|
#endif |
37 |
|
|
|
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
} // end of namespace |