Commit 05f03ccb authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

Basis::setToProduct: parallelized with Parallelizer2

parent 90e08e17
......@@ -86,7 +86,7 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include "Profiling.h"
#include "Qn.h"
#include "QnHash.h"
#include "Parallelizer.h"
#include "Parallelizer2.h"
namespace Dmrg {
// A class to represent in a light way a Dmrg basis (used only to implement symmetries).
......@@ -288,8 +288,21 @@ public:
// -----------------------------------------
// collapsed loop to fill permutation vector
// -----------------------------------------
//#pragma omp parallel for schedule(dynamic)
for( SizeType pspe = 0; pspe < nps*npe; ++pspe) {
const SizeType threads = std::min(nps*npe,
PsimagLite::Concurrency::codeSectionParams.npthreads);
PsimagLite::Parallelizer2<> parallelizer2(threads);
parallelizer2.parallelFor(0,
nps*npe,
[nps,
basisLeftSize,
&offset_into_perm_array,
&leftSize_array,
&rightSize_array,
&basis1,
&basis2,
this]
(SizeType pspe, SizeType) {
// ----------------------------
// recall pspe = ps + pe * nps;
......@@ -310,11 +323,11 @@ public:
const SizeType iglobalState = ileftOffset + irightOffset*basisLeftSize;
const SizeType ipos = ileft + iright * leftSize + offset_into_perm;
permutationVector_[ipos] = iglobalState;
permInverse_[iglobalState] = ipos;
};
};
};
this->permutationVector_[ipos] = iglobalState;
this->permInverse_[iglobalState] = ipos;
}
}
});
checkPermutation(permInverse_);
checkPermutation(permutationVector_);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment