#ifndef Hadrons_MIO_LoadA2AMatrixDiskVector_hpp_ #define Hadrons_MIO_LoadA2AMatrixDiskVector_hpp_ #include #include #include #include #include BEGIN_HADRONS_NAMESPACE /****************************************************************************** * LoadA2AMatrixDiskVector * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MIO) class LoadA2AMatrixDiskVectorPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(LoadA2AMatrixDiskVectorPar, std::string, file, std::string, dataset, std::string, diskVectorDir, int, cacheSize); }; template class TLoadA2AMatrixDiskVector: public Module { public: FERM_TYPE_ALIASES(FImpl, ); // constructor TLoadA2AMatrixDiskVector(const std::string name); // destructor virtual ~TLoadA2AMatrixDiskVector(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup virtual void setup(void); // execution virtual void execute(void); }; MODULE_REGISTER_TMP(LoadA2AMatrixDiskVector, TLoadA2AMatrixDiskVector, MIO); /****************************************************************************** * TLoadA2AMatrixDiskVector implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TLoadA2AMatrixDiskVector::TLoadA2AMatrixDiskVector(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TLoadA2AMatrixDiskVector::getInput(void) { std::vector in; return in; } template std::vector TLoadA2AMatrixDiskVector::getOutput(void) { std::vector out = {getName()}; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TLoadA2AMatrixDiskVector::setup(void) { int Ls = 1; std::string dvDir = par().diskVectorDir; std::string dataset = par().dataset; std::string dvFile = dvDir + "/" + getName() + "." + std::to_string(vm().getTrajectory()); int nt = env().getDim(Tp); int cacheSize = par().cacheSize; bool clean = true; GridBase *grid = envGetGrid(FermionField); envCreate(EigenDiskVector, getName(), Ls, dvFile, nt, cacheSize, clean, grid); } // execution /////////////////////////////////////////////////////////////////// template void TLoadA2AMatrixDiskVector::execute(void) { int nt = env().getDim(Tp); std::string file = par().file; std::string dataset = par().dataset; GridBase *grid = envGetGrid(FermionField); auto &mesonFieldDV = envGet(EigenDiskVector, getName()); int traj = vm().getTrajectory(); tokenReplace(file, "traj", traj); LOG(Message) << "-- Loading '" << file << "'-- " << std::endl; double t; A2AMatrixIo mfIO(file, dataset, nt); mfIO.load(mesonFieldDV, &t, grid); LOG(Message) << "Read " << mfIO.getSize() << " bytes in " << t << " usec, " << mfIO.getSize() / t * 1.0e6 / 1024 / 1024 << " MB/s" << std::endl; } END_MODULE_NAMESPACE END_HADRONS_NAMESPACE #endif // Hadrons_MIO_LoadA2AMatrixDiskVector_hpp_