Commit ef2516db authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

BlockDiagWf: disable threading if !blasIsThreadSafe

parent c6084316
......@@ -78,7 +78,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#ifndef DMRG_SERIAL_H
#define DMRG_SERIAL_H
#include "BLAS.h"
#include "Io/IoSelector.h"
#include "FermionSign.h"
#include "ProgramGlobals.h"
......
......@@ -73,7 +73,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include <iostream>
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "TargetParamsTimeStep.h"
#include "ProgramGlobals.h"
#include "ParametersForSolver.h"
......
......@@ -82,7 +82,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include "Braket.h"
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "TimeSerializer.h"
#include "TargetParamsDynamic.h"
#include "VectorWithOffsets.h"
......
......@@ -82,7 +82,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#define TARGETING_CORRECTION_VECTOR_H
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "TargetParamsCorrectionVector.h"
#include "VectorWithOffsets.h"
#include "CorrectionVectorFunction.h"
......
......@@ -84,7 +84,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#define TARGETING_DYNAMIC_H
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "ParametersForSolver.h"
#include "TargetParamsDynamic.h"
#include "VectorWithOffsets.h"
......
......@@ -72,7 +72,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#define DMRG_TARGETING_METTS_H
#include <iostream>
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "ApplyOperatorLocal.h"
#include "MettsSerializer.h"
#include "MettsParams.h"
......
......@@ -89,7 +89,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#define TARGETING_RIXS_DYNAMIC_H
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "TargetParamsCorrectionVector.h"
#include "TargetParamsTimeStep.h"
#include "VectorWithOffsets.h"
......
......@@ -88,7 +88,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#define TARGETING_RIXS_STATIC_H
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "TargetParamsCorrectionVector.h"
#include "VectorWithOffsets.h"
#include "TargetingBase.h"
......
......@@ -73,7 +73,6 @@ DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
#include <iostream>
#include "ProgressIndicator.h"
#include "BLAS.h"
#include "TargetParamsTimeStep.h"
#include "ProgramGlobals.h"
#include "ParametersForSolver.h"
......
......@@ -489,10 +489,12 @@ public:
void transform(char charLeft,
char charRight,
const BlockDiagonalMatrixType& tLeft,
const BlockDiagonalMatrixType& tRight)
const BlockDiagonalMatrixType& tRight,
bool blasIsThreadSafe)
{
SizeType npatches = data_.size();
SizeType threads = std::min(npatches, PsimagLite::Concurrency::codeSectionParams.npthreads);
if (!blasIsThreadSafe) threads = 1;
typedef PsimagLite::Parallelizer<ParallelBlockTransform> ParallelizerType;
PsimagLite::CodeSectionParams codeSectionParams(threads);
ParallelizerType threadedTransform(codeSectionParams);
......
......@@ -128,7 +128,8 @@ public:
params.options,
true,
true,
params.denseSparseThreshold),
params.denseSparseThreshold,
params.options.find("blasIsThreadSafe") != PsimagLite::String::npos),
progress_("WaveFunctionTransf"),
filenameIn_(params.checkpoint.filename()),
filenameOut_(params.filename),
......
......@@ -180,8 +180,8 @@ private:
const ProgramGlobals::DirectionEnum dir1 = ProgramGlobals::DirectionEnum::EXPAND_ENVIRON;
for (SizeType ii=0;ii<psiDest.sectors();ii++)
transformVectorParallel(psiDest,psiSrc,lrs,ii,nk,dir1);
for (SizeType ii = 0; ii < psiDest.sectors(); ++ii)
transformVectorParallel(psiDest, psiSrc, lrs, ii, nk, dir1);
}
void transformVectorParallel(VectorWithOffsetType& psiDest,
......
......@@ -47,10 +47,12 @@ public:
iOld,
dmrgWaveStruct_.lrs());
psi.transform(charLeft,
charRight,
dmrgWaveStruct_.getTransform(ProgramGlobals::SysOrEnvEnum::SYSTEM),
dmrgWaveStruct_.getTransform(ProgramGlobals::SysOrEnvEnum::ENVIRON));
dmrgWaveStruct_.getTransform(ProgramGlobals::SysOrEnvEnum::ENVIRON),
wftOptions_.blasIsThreadSafe);
psi.toVectorWithOffsets(psiDest, iNew, lrs, nk, dir);
}
......
......@@ -16,11 +16,13 @@ struct WftOptions {
PsimagLite::String options,
bool f,
bool b,
RealType d)
RealType d,
bool blasIsThreadSafe_)
: twoSiteDmrg(options.find("twositedmrg") != PsimagLite::String::npos),
kronLoadBalance(options.find("KronLoadBalance") != PsimagLite::String::npos),
firstCall(f),
bounce(b),
blasIsThreadSafe(blasIsThreadSafe_),
dir(dir1),
accel((twoSiteDmrg) ? ACCEL_BLOCKS : ACCEL_PATCHES),
denseSparseThreshold(d)
......@@ -65,6 +67,7 @@ struct WftOptions {
bool kronLoadBalance;
bool firstCall;
bool bounce;
bool blasIsThreadSafe;
ProgramGlobals::DirectionEnum dir;
AccelEnum accel;
RealType denseSparseThreshold;
......
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