diff --git a/CMakeLists.txt b/CMakeLists.txt index a72be7e0ca..d49985fc0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -652,8 +652,6 @@ endif() find_package(HDF5 COMPONENTS C) if(HDF5_FOUND) - set(HAVE_LIBHDF5 1) - if(HDF5_IS_PARALLEL) message(STATUS "Parallel HDF5 library found") option(ENABLE_PHDF5 "Enable code paths using parallel HDF5" ON) @@ -692,7 +690,7 @@ if(HDF5_FOUND) add_library(IO::HDF5 INTERFACE IMPORTED) target_include_directories(IO::HDF5 INTERFACE "${HDF5_INCLUDE_DIR}") - target_compile_definitions(IO::HDF5 INTERFACE "HAVE_LIBHDF5;H5_USE_16_API") + target_compile_definitions(IO::HDF5 INTERFACE "H5_USE_16_API") target_link_libraries(IO::HDF5 INTERFACE "${HDF5_LIBRARIES}") if(ENABLE_PHDF5) target_compile_definitions(IO::HDF5 INTERFACE "ENABLE_PHDF5") diff --git a/doxygen/config.h b/doxygen/config.h index a9b65e7d51..9f6a0e7ad4 100644 --- a/doxygen/config.h +++ b/doxygen/config.h @@ -36,9 +36,6 @@ /* Enable OpenMP parallelization. */ #define QMC_OMP 1 -/* Define to 1 if you have the `hdf5' library (-lhdf5). */ -#define HAVE_LIBHDF5 1 - /* Define to 1 if you want to use parallel hdf5 for frequent output */ /* #undef ENABLE_PHDF5 */ diff --git a/src/Particle/HDFWalkerInputManager.cpp b/src/Particle/HDFWalkerInputManager.cpp index d91b537002..5b9e4a4604 100644 --- a/src/Particle/HDFWalkerInputManager.cpp +++ b/src/Particle/HDFWalkerInputManager.cpp @@ -16,9 +16,7 @@ #include "HDFWalkerInputManager.h" #include "OhmmsData/AttributeSet.h" -#if defined(HAVE_LIBHDF5) #include "Particle/HDFWalkerInput_0_4.h" -#endif #include "Message/Communicate.h" #include "hdf/HDFVersion.h" @@ -28,7 +26,6 @@ HDFWalkerInputManager::HDFWalkerInputManager(WalkerConfigurations& wc_list, size HDFWalkerInputManager::~HDFWalkerInputManager() {} -#if defined(HAVE_LIBHDF5) bool HDFWalkerInputManager::put(xmlNodePtr cur) { //reference revision number @@ -61,13 +58,4 @@ bool HDFWalkerInputManager::put(xmlNodePtr cur) CurrentFileRoot = cfile; return success; } -#else -bool HDFWalkerInputManager::put(xmlNodePtr cur) { return false; } -#endif - -void HDFWalkerInputManager::rewind(const std::string& h5root, int blocks) -{ - // HDFWalkerInputCollect WO(h5root); - // WO.rewind(wc_list_,blocks); -} } // namespace qmcplusplus diff --git a/src/Particle/HDFWalkerInputManager.h b/src/Particle/HDFWalkerInputManager.h index c76732dd5b..35825ecdba 100644 --- a/src/Particle/HDFWalkerInputManager.h +++ b/src/Particle/HDFWalkerInputManager.h @@ -37,8 +37,6 @@ class HDFWalkerInputManager //bool put(std::vector& mset, int pid); //bool put(std::vector& mset, Communicate* comm); std::string getFileRoot() { return CurrentFileRoot; } - - void rewind(const std::string& h5root, int blocks); }; } // namespace qmcplusplus diff --git a/src/QMCDrivers/DMC/DMCBatched.cpp b/src/QMCDrivers/DMC/DMCBatched.cpp index 7fbd51a717..1ba784c979 100644 --- a/src/QMCDrivers/DMC/DMCBatched.cpp +++ b/src/QMCDrivers/DMC/DMCBatched.cpp @@ -380,7 +380,7 @@ void DMCBatched::process(xmlNodePtr node) qmcdriver_input_.get_walkers_per_rank(), dmcdriver_input_.get_reserve(), qmcdriver_input_.get_num_crowds()); - Base::startup(node, awc); + Base::initializeQMC(awc); } catch (const UniformCommunicateError& ue) { diff --git a/src/QMCDrivers/MCPopulation.cpp b/src/QMCDrivers/MCPopulation.cpp index dd4577f3ca..9583c75a5c 100644 --- a/src/QMCDrivers/MCPopulation.cpp +++ b/src/QMCDrivers/MCPopulation.cpp @@ -257,14 +257,6 @@ void MCPopulation::measureGlobalEnergyVariance(Communicate& comm, variance = weight_energy_variance[2] / weight_energy_variance[0] - ener * ener; } -void MCPopulation::set_variational_parameters(const opt_variables_type& active) -{ - for (auto it_twfs = walker_trial_wavefunctions_.begin(); it_twfs != walker_trial_wavefunctions_.end(); ++it_twfs) - { - (*it_twfs).get()->resetParameters(active); - } -} - void MCPopulation::checkIntegrity() const { // check active walkers diff --git a/src/QMCDrivers/MCPopulation.h b/src/QMCDrivers/MCPopulation.h index 56d41c6eaf..b19f043aa7 100644 --- a/src/QMCDrivers/MCPopulation.h +++ b/src/QMCDrivers/MCPopulation.h @@ -226,10 +226,6 @@ class MCPopulation /** }@ */ - - /// Set variational parameters for the per-walker copies of the wavefunction. - void set_variational_parameters(const opt_variables_type& active); - /// check if all the internal vector contain consistent sizes; void checkIntegrity() const; diff --git a/src/QMCDrivers/QMCDriverNew.cpp b/src/QMCDrivers/QMCDriverNew.cpp index e06187217a..15b66f5a90 100644 --- a/src/QMCDrivers/QMCDriverNew.cpp +++ b/src/QMCDrivers/QMCDriverNew.cpp @@ -129,22 +129,7 @@ void QMCDriverNew::checkNumCrowdsLTNumThreads(const int num_crowds) } } -/** process a element - * @param cur xmlNode with qmc tag - * - * This function is called before QMCDriverNew::run and following actions are taken: - * - Initialize basic data to execute run function. - * -- distance tables - * -- resize deltaR and drift with the number of particles - * -- assign cur to qmcNode - * - process input file - * -- putQMCInfo: s for generic QMC - * -- put : extra data by derived classes - * - initialize branchEngine to accumulate energies - * - initialize Estimators - * - initialize Walkers - */ -void QMCDriverNew::startup(xmlNodePtr cur, const QMCDriverNew::AdjustedWalkerCounts& awc) +void QMCDriverNew::initializeQMC(const AdjustedWalkerCounts& awc) { ScopedTimer local_timer(timers_.startup_timer); diff --git a/src/QMCDrivers/QMCDriverNew.h b/src/QMCDrivers/QMCDriverNew.h index e0056be84f..54529ad77d 100644 --- a/src/QMCDrivers/QMCDriverNew.h +++ b/src/QMCDrivers/QMCDriverNew.h @@ -102,10 +102,6 @@ class QMCDriverNew : public QMCDriverInterface, public MPIObjectBase std::bitset qmc_driver_mode_; protected: - /// inject additional barrier and measure load imbalance. - void measureImbalance(const std::string& tag) const; - /// end of a block operations. Aggregates statistics across all MPI ranks and write to disk. - void endBlock(); /** This is a data structure strictly for QMCDriver and its derived classes * * i.e. its nested in scope for a reason @@ -117,6 +113,16 @@ class QMCDriverNew : public QMCDriverInterface, public MPIObjectBase std::vector walkers_per_crowd; RealType reserve_walkers; }; + /** Do common section starting tasks for VMC and DMC + * + * set up population_, crowds_, rngs and step_contexts_ + */ + void initializeQMC(const AdjustedWalkerCounts& awc); + + /// inject additional barrier and measure load imbalance. + void measureImbalance(const std::string& tag) const; + /// end of a block operations. Aggregates statistics across all MPI ranks and write to disk. + void endBlock(); public: /// Constructor. @@ -228,15 +234,6 @@ class QMCDriverNew : public QMCDriverInterface, public MPIObjectBase */ void process(xmlNodePtr cur) override = 0; - /** Do common section starting tasks - * - * \todo This should not take xmlNodePtr - * It should either take BranchEngineInput and EstimatorInput - * And these are the arguments to the branch_engine and estimator_manager - * Constructors or these objects should be created elsewhere. - */ - void startup(xmlNodePtr cur, const QMCDriverNew::AdjustedWalkerCounts& awc); - static void initialLogEvaluation(int crowd_id, UPtrVector& crowds, UPtrVector& step_context); diff --git a/src/QMCDrivers/VMC/VMCBatched.cpp b/src/QMCDrivers/VMC/VMCBatched.cpp index 62445d37b4..7c1c8a8bf6 100644 --- a/src/QMCDrivers/VMC/VMCBatched.cpp +++ b/src/QMCDrivers/VMC/VMCBatched.cpp @@ -265,7 +265,7 @@ void VMCBatched::process(xmlNodePtr node) adjustGlobalWalkerCount(myComm->size(), myComm->rank(), qmcdriver_input_.get_total_walkers(), qmcdriver_input_.get_walkers_per_rank(), 1.0, qmcdriver_input_.get_num_crowds()); - Base::startup(node, awc); + Base::initializeQMC(awc); } catch (const UniformCommunicateError& ue) { diff --git a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp index 0abd7b0aae..2d7a351db6 100644 --- a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp +++ b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimize.cpp @@ -548,6 +548,8 @@ bool QMCFixedSampleLinearOptimize::put(xmlNodePtr q) if (!hybridEngineObj) hybridEngineObj = std::make_unique(myComm, q); + hybridEngineObj->incrementStepCounter(); + return processOptXML(hybridEngineObj->getSelectedXML(), vmcMove, ReportToH5 == "yes", useGPU == "yes"); } else diff --git a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp index b0d10c1d11..89ebfa7b1b 100644 --- a/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp +++ b/src/QMCDrivers/WFOpt/QMCFixedSampleLinearOptimizeBatched.cpp @@ -299,7 +299,6 @@ void QMCFixedSampleLinearOptimizeBatched::generateSamples() t1.restart(); // W.reset(); samples_.resetSampleCount(); - population_.set_variational_parameters(optTarget->getOptVariables()); vmcEngine->run(); app_log() << " Execution time = " << std::setprecision(4) << t1.elapsed() << std::endl; @@ -654,38 +653,11 @@ void QMCFixedSampleLinearOptimizeBatched::process(xmlNodePtr q) hybridEngineObj->incrementStepCounter(); - //Overwrite sampling information with input from selected optimizer block of a hybrid run - QMCDriverInput qmcdriver_input_copy = qmcdriver_input_; - VMCDriverInput vmcdriver_input_copy = vmcdriver_input_; - - qmcdriver_input_copy.readXML(hybridEngineObj->getSelectedXML()); - vmcdriver_input_copy.readXML(hybridEngineObj->getSelectedXML()); - - processOptXML(hybridEngineObj->getSelectedXML(), vmcMove, ReportToH5 == "yes", useGPU == "yes"); - - - QMCDriverNew::AdjustedWalkerCounts awc = - adjustGlobalWalkerCount(myComm->size(), myComm->rank(), qmcdriver_input_copy.get_total_walkers(), - qmcdriver_input_copy.get_walkers_per_rank(), 1.0, - qmcdriver_input_copy.get_num_crowds()); - QMCDriverNew::startup(q, awc); } else { - //Also need to overwrite input information again in case this method was preceded by hybrid method optimization - QMCDriverInput qmcdriver_input_copy = qmcdriver_input_; - qmcdriver_input_copy.readXML(q); - processOptXML(q, vmcMove, ReportToH5 == "yes", useGPU == "yes"); - - auto& qmcdriver_input = vmcEngine->getQMCDriverInput(); - // This code is also called when setting up vmcEngine. Would be nice to not duplicate the call. - QMCDriverNew::AdjustedWalkerCounts awc = - adjustGlobalWalkerCount(myComm->size(), myComm->rank(), qmcdriver_input_copy.get_total_walkers(), - qmcdriver_input_copy.get_walkers_per_rank(), 1.0, - qmcdriver_input_copy.get_num_crowds()); - QMCDriverNew::startup(q, awc); } } diff --git a/src/QMCDrivers/tests/QMCDriverNewTestWrapper.h b/src/QMCDrivers/tests/QMCDriverNewTestWrapper.h index 151d7ae7dd..7d8e5454a2 100644 --- a/src/QMCDrivers/tests/QMCDriverNewTestWrapper.h +++ b/src/QMCDrivers/tests/QMCDriverNewTestWrapper.h @@ -56,7 +56,7 @@ class QMCDriverNewTestWrapper : public QMCDriverNew adjustGlobalWalkerCount(myComm->size(), myComm->rank(), qmcdriver_input_.get_total_walkers(), qmcdriver_input_.get_walkers_per_rank(), 1.0, qmcdriver_input_.get_num_crowds()); - Base::startup(node, awc); + Base::initializeQMC(awc); } void testAdjustGlobalWalkerCount() diff --git a/src/QMCWaveFunctions/LCAO/LCAOSpinorBuilder.cpp b/src/QMCWaveFunctions/LCAO/LCAOSpinorBuilder.cpp index c17c43a00d..e0144e9fed 100644 --- a/src/QMCWaveFunctions/LCAO/LCAOSpinorBuilder.cpp +++ b/src/QMCWaveFunctions/LCAO/LCAOSpinorBuilder.cpp @@ -117,7 +117,6 @@ bool LCAOSpinorBuilder::loadMO(LCAOrbitalSet& up, LCAOrbitalSet& dn, xmlNodePtr bool LCAOSpinorBuilder::putFromH5(LCAOrbitalSet& up, LCAOrbitalSet& dn, xmlNodePtr occ_ptr) { #ifdef QMC_COMPLEX -#if defined(HAVE_LIBHDF5) if (up.getBasisSetSize() == 0 || dn.getBasisSetSize() == 0) { myComm->barrier_and_abort("LCASpinorBuilder::loadMO detected ZERO BasisSetSize"); @@ -198,10 +197,6 @@ bool LCAOSpinorBuilder::putFromH5(LCAOrbitalSet& up, LCAOrbitalSet& dn, xmlNodeP myComm->comm.broadcast_n(dn.C->data(), dn.C->size()); #endif -#else - myComm->barrier_and_abort("LCAOSpinorBuilder::putFromH5 HDF5 is disabled"); -#endif - #else myComm->barrier_and_abort("LCAOSpinorBuilder::putFromH5 Must build with QMC_COMPLEX"); #endif diff --git a/src/QMCWaveFunctions/LCAO/LCAOrbitalBuilder.cpp b/src/QMCWaveFunctions/LCAO/LCAOrbitalBuilder.cpp index 936efa293a..4ae825a5bd 100644 --- a/src/QMCWaveFunctions/LCAO/LCAOrbitalBuilder.cpp +++ b/src/QMCWaveFunctions/LCAO/LCAOrbitalBuilder.cpp @@ -661,7 +661,6 @@ bool LCAOrbitalBuilder::putFromXML(LCAOrbitalSet& spo, xmlNodePtr coeff_ptr) */ bool LCAOrbitalBuilder::putFromH5(LCAOrbitalSet& spo, xmlNodePtr coeff_ptr) { -#if defined(HAVE_LIBHDF5) int neigs = spo.getBasisSetSize(); int setVal = -1; std::string setname; @@ -723,9 +722,6 @@ bool LCAOrbitalBuilder::putFromH5(LCAOrbitalSet& spo, xmlNodePtr coeff_ptr) } } myComm->bcast(spo.C->data(), spo.C->size()); -#else - APP_ABORT("LCAOrbitalBuilder::putFromH5 HDF5 is disabled.") -#endif return true; } @@ -736,7 +732,6 @@ bool LCAOrbitalBuilder::putFromH5(LCAOrbitalSet& spo, xmlNodePtr coeff_ptr) */ bool LCAOrbitalBuilder::putPBCFromH5(LCAOrbitalSet& spo, xmlNodePtr coeff_ptr) { -#if defined(HAVE_LIBHDF5) ReportEngine PRE("LCAOrbitalBuilder", "LCAOrbitalBuilder::putPBCFromH5"); int norbs = spo.getOrbitalSetSize(); int neigs = spo.getBasisSetSize(); @@ -822,10 +817,6 @@ bool LCAOrbitalBuilder::putPBCFromH5(LCAOrbitalSet& spo, xmlNodePtr coeff_ptr) #ifdef HAVE_MPI myComm->comm.broadcast_n(spo.C->data(), spo.C->size()); #endif - -#else - APP_ABORT("LCAOrbitalBuilder::putFromH5 HDF5 is disabled.") -#endif return true; } diff --git a/src/io/OhmmsData/HDFAttribIO.h b/src/io/OhmmsData/HDFAttribIO.h index 5f75f7e027..00ae8087dd 100644 --- a/src/io/OhmmsData/HDFAttribIO.h +++ b/src/io/OhmmsData/HDFAttribIO.h @@ -17,14 +17,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#if defined(HAVE_LIBHDF5) #include "hdf5.h" -#else -using hid_t = int; -using hsize_t = std::size_t; -const int H5P_DEFAULT = 0; -#endif - #include diff --git a/src/io/hdf/hdf_archive.h b/src/io/hdf/hdf_archive.h index fc84e0d3bb..07240d0cb2 100644 --- a/src/io/hdf/hdf_archive.h +++ b/src/io/hdf/hdf_archive.h @@ -18,12 +18,9 @@ #include "hdf_datatype.h" #include "hdf_dataspace.h" #include "hdf_dataproxy.h" -#if defined(HAVE_LIBHDF5) #include "hdf_pete.h" #include "hdf_stl.h" #include "hdf_hyperslab.h" -//#include "hdf_double_hyperslab.h" -#endif #include #include #ifdef HAVE_MPI diff --git a/src/io/hdf/hdf_datatype.h b/src/io/hdf/hdf_datatype.h index 4620e2e8cc..c9b3c979e1 100644 --- a/src/io/hdf/hdf_datatype.h +++ b/src/io/hdf/hdf_datatype.h @@ -14,13 +14,10 @@ #define QMCPLUSPLUS_H5DATATYPE_DEFINE_H #include -#if defined(HAVE_LIBHDF5) #include -#endif namespace qmcplusplus { -#if defined(HAVE_LIBHDF5) /** map C types to hdf5 native types * bool is explicit removed due to the fact that it is implementation-dependant */ @@ -44,24 +41,8 @@ BOOSTSUB_H5_DATATYPE(unsigned short, H5T_NATIVE_USHORT); BOOSTSUB_H5_DATATYPE(unsigned int, H5T_NATIVE_UINT); BOOSTSUB_H5_DATATYPE(unsigned long, H5T_NATIVE_ULONG); BOOSTSUB_H5_DATATYPE(unsigned long long, H5T_NATIVE_ULLONG); -//BOOSTSUB_H5_DATATYPE(uint32_t, H5T_NATIVE_UINT32); -//BOOSTSUB_H5_DATATYPE(uint64_t, H5T_NATIVE_UINT64); BOOSTSUB_H5_DATATYPE(float, H5T_NATIVE_FLOAT); BOOSTSUB_H5_DATATYPE(double, H5T_NATIVE_DOUBLE); -#else -using hid_t = int; -using herr_t = int; -using hsize_t = std::size_t; -const int H5P_DEFAULT = 0; - -//return a non-sense integer -template -inline hid_t get_h5_datatype(const T&) -{ - return 0; -} - -#endif } // namespace qmcplusplus #endif