1 |
gross |
391 |
/* |
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 "escript/Data/Utils.h" |
16 |
|
|
#ifdef _OPENMP |
17 |
|
|
#include <omp.h> |
18 |
|
|
#endif |
19 |
|
|
|
20 |
|
|
namespace escript { |
21 |
|
|
|
22 |
|
|
void setNumberOfThreads(const int num_threads) |
23 |
|
|
{ |
24 |
|
|
|
25 |
|
|
#ifdef _OPENMP |
26 |
|
|
omp_set_num_threads(num_threads); |
27 |
|
|
#endif |
28 |
|
|
|
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
int getNumberOfThreads() |
32 |
|
|
{ |
33 |
|
|
#ifdef _OPENMP |
34 |
|
|
return omp_get_max_threads(); |
35 |
|
|
#else |
36 |
|
|
return 1; |
37 |
|
|
#endif |
38 |
|
|
|
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
} // end of namespace |