summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadamard_pt.hpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp
index 8d0a1f7..f07c9ec 100644
--- a/hadamard_pt.hpp
+++ b/hadamard_pt.hpp
@@ -2,6 +2,7 @@
#pragma once
#include "hadamard_mcmc.hpp"
#include <list>
+#include <execution>
void swap(MCMC& s1, MCMC& s2) {
std::swap(s1.M, s2.M);
@@ -68,10 +69,7 @@ public:
std::vector<unsigned> nd(Ms.size(), 0);
for (unsigned i = 0; i < n; i++) {
-#pragma omp parallel for
- for (unsigned j = 0; j < Ms.size(); j++) {
- Ms[j].tune(m, ε);
- }
+ std::for_each(std::execution::par_unseq, Ms.begin(), Ms.end(), [m, ε](MCMC& M) {M.tune(m, ε);});
for (unsigned k = 0; k < m * Ms.size(); k++) {
unsigned j = rng.uniform((unsigned)0, (unsigned)(Ms.size() - 2));
@@ -151,10 +149,7 @@ public:
void run(unsigned n, unsigned m, bool dry = false) {
for (unsigned i = 0; i < n; i++) {
-#pragma omp parallel for
- for (unsigned j = 0; j < Ms.size(); j++) {
- Ms[j].run(m, dry);
- }
+ std::for_each(std::execution::par_unseq, Ms.begin(), Ms.end(), [m, dry](MCMC& M) {M.run(m, dry);});
for (unsigned j = 0; j < Ms.size(); j++) {
unsigned k = rng.uniform((unsigned)0, (unsigned)(Ms.size() - 2));
this->step(k, k + 1, dry);