aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/dist.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2008-01-14 15:04:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2008-01-14 15:04:00 +0000
commitedd306959a8c5980f6fba2c5dd99d92aee62785c (patch)
tree52ec752204f883413ce386b544e67708e023e4d7 /Carpet/CarpetLib/src/dist.hh
parent5efeed6cad5bc6045cf1c54215a4274153963a17 (diff)
CarpetLib: Set number of OpenMP threads via an external function call
Set the number of OpenMP threads via an external function call instead of via a CarpetLib parameter. darcs-hash:20080114150439-dae7b-a6a6a629162ca195411852823e1ece0a2071d771.gz
Diffstat (limited to 'Carpet/CarpetLib/src/dist.hh')
-rw-r--r--Carpet/CarpetLib/src/dist.hh14
1 files changed, 12 insertions, 2 deletions
diff --git a/Carpet/CarpetLib/src/dist.hh b/Carpet/CarpetLib/src/dist.hh
index 1206901e3..7d501c857 100644
--- a/Carpet/CarpetLib/src/dist.hh
+++ b/Carpet/CarpetLib/src/dist.hh
@@ -6,6 +6,9 @@
#include <cstdlib>
#include <mpi.h>
+#ifdef _OPENMP
+# include <omp.h>
+#endif
#include "cctk.h"
@@ -63,13 +66,20 @@ namespace dist {
return size_;
}
+ // Set number of threads
+ void set_num_threads (int num_threads);
+
// Local number of threads
- int num_threads_worker ();
inline int num_threads ()
{
static int num_threads_ = -1;
if (num_threads_ == -1) {
- num_threads_ = num_threads_worker();
+#ifdef _OPENMP
+ num_threads_ = omp_get_max_threads();
+#else
+ num_threads_ = 1;
+#endif
+ assert (num_threads_ >= 1);
}
return num_threads_;
}