... | ... |
@@ -2,7 +2,6 @@ |
2 | 2 |
#include "AtomicDomain.h" |
3 | 3 |
#include "math/Random.h" |
4 | 4 |
|
5 |
-#include <omp.h> |
|
6 | 5 |
#include <stdint.h> |
7 | 6 |
#include <utility> |
8 | 7 |
|
... | ... |
@@ -15,10 +14,7 @@ Atom AtomicDomain::front() const |
15 | 14 |
// O(1) |
16 | 15 |
Atom AtomicDomain::randomAtom() const |
17 | 16 |
{ |
18 |
- uint64_t ndx = gaps::random::uniform64(0, mAtoms.size() - 1); |
|
19 |
- //GAPS_ASSERT(mAtoms.size() >= 1); |
|
20 |
- //GAPS_ASSERT(ndx < mAtoms.size()); |
|
21 |
- return mAtoms[ndx]; |
|
17 |
+ return mAtoms[gaps::random::uniform64(0, mAtoms.size() - 1)]; |
|
22 | 18 |
} |
23 | 19 |
|
24 | 20 |
// Average Case O(1) |
... | ... |
@@ -14,8 +14,10 @@ const Rcpp::NumericMatrix &FP, unsigned checkpointInterval, |
14 | 14 |
const std::string &cptFile, unsigned pumpThreshold, unsigned nPumpSamples, |
15 | 15 |
unsigned nCores) |
16 | 16 |
{ |
17 |
- unsigned availableCores = omp_get_max_threads(); |
|
18 |
- Rprintf("Running on %d out of %d available cores\n", nCores, availableCores); |
|
17 |
+ #ifdef __GAPS_OPENMP__ |
|
18 |
+ unsigned availableCores = omp_get_max_threads(); |
|
19 |
+ Rprintf("Running on %d out of %d available cores\n", nCores, availableCores); |
|
20 |
+ #endif |
|
19 | 21 |
|
20 | 22 |
// create internal state from parameters and run from there |
21 | 23 |
GapsRunner runner(D, S, nFactor, nEquil, nEquilCool, nSample, |
... | ... |
@@ -61,7 +63,7 @@ std::string getBuildReport_cpp() |
61 | 63 |
std::string simd = "SIMD not enabled\n"; |
62 | 64 |
#endif |
63 | 65 |
|
64 |
-#if defined(_OPENMP) |
|
66 |
+#if defined(_GAPS_OPENMP) |
|
65 | 67 |
std::string openmp = "Compiled with OpenMP\n"; |
66 | 68 |
#else |
67 | 69 |
std::string openmp = "Compiler did not support OpenMP\n"; |
... | ... |
@@ -20,7 +20,14 @@ |
20 | 20 |
#include <boost/math/distributions/gamma.hpp> |
21 | 21 |
|
22 | 22 |
#include <stdint.h> |
23 |
-#include <omp.h> |
|
23 |
+ |
|
24 |
+#if defined(__GAPS_OPENMP__) |
|
25 |
+ #include <omp.h> |
|
26 |
+#else |
|
27 |
+ typedef int omp_int_t; |
|
28 |
+ inline omp_int_t omp_get_thread_num() { return 0; } |
|
29 |
+ inline omp_int_t omp_get_max_threads() { return 1; } |
|
30 |
+#endif |
|
24 | 31 |
|
25 | 32 |
#define Q_GAMMA_THRESHOLD 0.000001f |
26 | 33 |
#define Q_GAMMA_MIN_VALUE 0.0 |