1 |
/* |
2 |
****************************************************************************** |
3 |
* * |
4 |
* COPYRIGHT ACcESS 2004 - All Rights Reserved * |
5 |
* * |
6 |
* This software is the property of ACcESS. No part of this code * |
7 |
* may be copied in any form or by any means without the expressed written * |
8 |
* consent of ACcESS. Copying, use or modification of this software * |
9 |
* by any unauthorised person is illegal unless that person has a software * |
10 |
* license agreement with ACcESS. * |
11 |
* * |
12 |
****************************************************************************** |
13 |
*/ |
14 |
|
15 |
#include "Utils.h" |
16 |
|
17 |
#ifdef _OPENMP |
18 |
#include <omp.h> |
19 |
#endif |
20 |
|
21 |
namespace escript { |
22 |
|
23 |
void setNumberOfThreads(const int num_threads) |
24 |
{ |
25 |
|
26 |
#ifdef _OPENMP |
27 |
omp_set_num_threads(num_threads); |
28 |
#endif |
29 |
|
30 |
} |
31 |
|
32 |
int getNumberOfThreads() |
33 |
{ |
34 |
#ifdef _OPENMP |
35 |
return omp_get_max_threads(); |
36 |
#else |
37 |
return 1; |
38 |
#endif |
39 |
|
40 |
} |
41 |
|
42 |
} // end of namespace |