From 19b26d5f145d4ccc6e60479d676a69c53d1690a6 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Wed, 25 May 2022 19:01:57 -0500 Subject: [PATCH] Reduce NVHPC warning. --- src/Estimators/InputSection.h | 3 +-- src/Numerics/SoaCartesianTensor.h | 5 ++--- src/Particle/DistanceTable.h | 16 ++++++++-------- src/QMCDrivers/SFNBranch.cpp | 9 ++++----- src/QMCHamiltonians/SOECPComponent.cpp | 8 -------- src/QMCHamiltonians/SkPot.cpp | 1 - src/QMCHamiltonians/SkPot.h | 5 +++-- .../Fermion/DiracDeterminantWithBackflow.h | 3 +-- .../Fermion/MultiDiracDeterminant.2.cpp | 2 +- .../Fermion/SlaterDetBuilder.cpp | 2 +- .../Fermion/SmallMatrixDetCalculator.h | 1 - src/QMCWaveFunctions/SPOSet.cpp | 1 - src/QMCWaveFunctions/SPOSet.h | 2 +- 13 files changed, 22 insertions(+), 36 deletions(-) diff --git a/src/Estimators/InputSection.h b/src/Estimators/InputSection.h index 3903a1a428..f6c7c3a162 100644 --- a/src/Estimators/InputSection.h +++ b/src/Estimators/InputSection.h @@ -152,10 +152,9 @@ class InputSection * * can't be bothered then just define your enum option as a string. */ - virtual std::any assignAnyEnum(const std::string& tag) const + [[noreturn]] virtual std::any assignAnyEnum(const std::string& tag) const { throw std::runtime_error("derived class must provide assignAnyEnum method if enum parameters are used"); - return std::any(); } /** Assign any enum helper for InputSection derived class diff --git a/src/Numerics/SoaCartesianTensor.h b/src/Numerics/SoaCartesianTensor.h index ba4880e997..21fa7f52bf 100644 --- a/src/Numerics/SoaCartesianTensor.h +++ b/src/Numerics/SoaCartesianTensor.h @@ -105,8 +105,8 @@ struct SoaCartesianTensor template SoaCartesianTensor::SoaCartesianTensor(const int l_max, bool addsign) : Lmax(l_max) { - if (Lmax < 0 || Lmax > 6) - throw std::runtime_error("CartesianTensor can't handle Lmax > 6 or Lmax < 0.\n"); + if (Lmax > 6) + throw std::runtime_error("CartesianTensor can't handle Lmax > 6.\n"); int ntot = 0; for (int i = 0; i <= Lmax; i++) @@ -2292,7 +2292,6 @@ void SoaCartesianTensor::getABC(int n, int& a, int& b, int& c) default: throw std::runtime_error("CartesianTensor::getABC() - Incorrect index.\n"); - break; } } diff --git a/src/Particle/DistanceTable.h b/src/Particle/DistanceTable.h index 47f3b86ec8..c1fa5b07ac 100644 --- a/src/Particle/DistanceTable.h +++ b/src/Particle/DistanceTable.h @@ -143,7 +143,7 @@ class DistanceTable const RefVectorWithLeader& p_list, const std::vector& rnew_list, const IndexType iat, - bool prepare_old = true) const + bool prepare_old = true) const { #pragma omp parallel for for (int iw = 0; iw < dt_list.size(); iw++) @@ -207,7 +207,10 @@ class DistanceTable */ virtual int get_first_neighbor(IndexType iat, RealType& r, PosType& dr, bool newpos) const = 0; - inline void print(std::ostream& os) { throw std::runtime_error("DistanceTable::print is not supported"); } + [[noreturn]] inline void print(std::ostream& os) + { + throw std::runtime_error("DistanceTable::print is not supported"); + } /// initialize a shared resource and hand it to a collection virtual void createResource(ResourceCollection& collection) const {} @@ -292,10 +295,9 @@ class DistanceTableAA : public DistanceTable virtual size_t get_num_particls_stored() const { return 0; } /// return multi walker temporary pair distance table data pointer - virtual const RealType* getMultiWalkerTempDataPtr() const + [[noreturn]] virtual const RealType* getMultiWalkerTempDataPtr() const { throw std::runtime_error(name_ + " multi walker data pointer for temp not supported"); - return nullptr; } virtual const RealType* mw_evalDistsInRange(const RefVectorWithLeader& dt_list, @@ -358,17 +360,15 @@ class DistanceTableAB : public DistanceTable const DisplRow& getTempDispls() const { return temp_dr_; } /// return multi-walker full (all pairs) distance table data pointer - virtual const RealType* getMultiWalkerDataPtr() const + [[noreturn]] virtual const RealType* getMultiWalkerDataPtr() const { throw std::runtime_error(name_ + " multi walker data pointer not supported"); - return nullptr; } /// return stride of per target pctl data. full table data = stride * num of target particles - virtual size_t getPerTargetPctlStrideSize() const + [[noreturn]] virtual size_t getPerTargetPctlStrideSize() const { throw std::runtime_error(name_ + " getPerTargetPctlStrideSize not supported"); - return 0; } }; } // namespace qmcplusplus diff --git a/src/QMCDrivers/SFNBranch.cpp b/src/QMCDrivers/SFNBranch.cpp index f5eddc5bdd..2c10d21530 100644 --- a/src/QMCDrivers/SFNBranch.cpp +++ b/src/QMCDrivers/SFNBranch.cpp @@ -106,7 +106,8 @@ int SFNBranch::initParam(const MCPopulation& population, vParam[SBVP::SIGMA2] = var; vParam[SBVP::TAUEFF] = vParam[SBVP::TAU] * R2Accepted.result() / R2Proposed.result(); /// FIXME, magic number 50 - setBranchCutoff(vParam[SBVP::SIGMA2], vParam[SBVP::SIGMA_BOUND], 50, population.get_golden_electrons()->getTotalNum()); + setBranchCutoff(vParam[SBVP::SIGMA2], vParam[SBVP::SIGMA_BOUND], 50, + population.get_golden_electrons()->getTotalNum()); int nwtot_now = population.get_num_global_walkers(); if (iParam[B_TARGETWALKERS] == 0) @@ -168,8 +169,7 @@ void SFNBranch::updateParamAfterPopControl(int pop_int, const MCDataTypegetSimulationCell().getKLists().kpts_cart[ki], sourcePtcl->getSimulationCell().getKLists().kpts_cart[ki]); + RealType k = dot(sourcePtcl->getSimulationCell().getKLists().kpts_cart[ki], + sourcePtcl->getSimulationCell().getKLists().kpts_cart[ki]); k = std::sqrt(k) - K_0; Fk[ki] = OneOverN * V_0 * std::exp(-k * k); // app_log()< makeCopyWithBF(std::unique_ptr&& spo, BackflowTransformation& BF) const; - std::unique_ptr makeCopy(std::unique_ptr&& spo) const override + [[noreturn]] std::unique_ptr makeCopy(std::unique_ptr&& spo) const override { throw std::runtime_error("makeCopy spo should not be called."); - return nullptr; } void testDerivFjj(ParticleSet& P, int pa); diff --git a/src/QMCWaveFunctions/Fermion/MultiDiracDeterminant.2.cpp b/src/QMCWaveFunctions/Fermion/MultiDiracDeterminant.2.cpp index 8949ec64b2..0fa9259dc1 100644 --- a/src/QMCWaveFunctions/Fermion/MultiDiracDeterminant.2.cpp +++ b/src/QMCWaveFunctions/Fermion/MultiDiracDeterminant.2.cpp @@ -779,7 +779,7 @@ void MultiDiracDeterminant::mw_evaluateDetsAndGradsForPtclMove( for (size_t iw = 0; iw < nw; iw++) { GradType ratioGradRef_local(0); - PRAGMA_OFFLOAD("omp parallel for reduction(+ : ratioGradRef_local)") + //PRAGMA_OFFLOAD("omp parallel for reduction(+ : ratioGradRef_local)") for (size_t i = 0; i < NumPtcls; i++) { const size_t J = confgListOccup_ptr[i]; diff --git a/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp b/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp index d9e8506176..e7acde7df6 100644 --- a/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp +++ b/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.cpp @@ -867,7 +867,7 @@ bool SlaterDetBuilder::readDetList(xmlNodePtr cur, for (size_t i = 0; i < confgLists[grp].size(); i++) { bool found = false; - size_t k = -1; + int k = -1; for (size_t j = 0; j < uniqueConfgs[grp].size(); j++) { if (confgLists[grp][i] == uniqueConfgs[grp][j]) diff --git a/src/QMCWaveFunctions/Fermion/SmallMatrixDetCalculator.h b/src/QMCWaveFunctions/Fermion/SmallMatrixDetCalculator.h index 736ec354f3..6d2e564a39 100644 --- a/src/QMCWaveFunctions/Fermion/SmallMatrixDetCalculator.h +++ b/src/QMCWaveFunctions/Fermion/SmallMatrixDetCalculator.h @@ -296,7 +296,6 @@ inline VALUE calcSmallDeterminant(size_t n, const VALUE* table_matrix, const int default: throw std::runtime_error("calculateSmallDeterminant only handles the number of excitations <= 5."); } - return 0.0; } diff --git a/src/QMCWaveFunctions/SPOSet.cpp b/src/QMCWaveFunctions/SPOSet.cpp index 693ce63ed3..88292d3a97 100644 --- a/src/QMCWaveFunctions/SPOSet.cpp +++ b/src/QMCWaveFunctions/SPOSet.cpp @@ -188,7 +188,6 @@ void SPOSet::evaluate_notranspose(const ParticleSet& P, std::unique_ptr SPOSet::makeClone() const { throw std::runtime_error("Missing SPOSet::makeClone for " + className); - return std::unique_ptr(); } void SPOSet::basic_report(const std::string& pad) const diff --git a/src/QMCWaveFunctions/SPOSet.h b/src/QMCWaveFunctions/SPOSet.h index d73cb53451..bc031a4591 100644 --- a/src/QMCWaveFunctions/SPOSet.h +++ b/src/QMCWaveFunctions/SPOSet.h @@ -489,7 +489,7 @@ class SPOSet : public QMCTraits /** make a clone of itself * every derived class must implement this to have threading working correctly. */ - virtual std::unique_ptr makeClone() const; + [[noreturn]] virtual std::unique_ptr makeClone() const; /** Used only by cusp correction in AOS LCAO. * Ye: the SoA LCAO moves all this responsibility to the builder.