mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	Merge branch 'develop' into feature/contractor
This commit is contained in:
		@@ -233,7 +233,8 @@ class GridLimeReader : public BinaryIO {
 | 
			
		||||
	//	std::cout << " ReadLatticeObject from offset "<<offset << std::endl;
 | 
			
		||||
	BinarySimpleMunger<sobj,sobj> munge;
 | 
			
		||||
	BinaryIO::readLatticeObject< vobj, sobj >(field, filename, munge, offset, format,nersc_csum,scidac_csuma,scidac_csumb);
 | 
			
		||||
 | 
			
		||||
  std::cout << GridLogMessage << "SciDAC checksum A " << std::hex << scidac_csuma << std::dec << std::endl;
 | 
			
		||||
  std::cout << GridLogMessage << "SciDAC checksum B " << std::hex << scidac_csumb << std::dec << std::endl;
 | 
			
		||||
	/////////////////////////////////////////////
 | 
			
		||||
	// Insist checksum is next record
 | 
			
		||||
	/////////////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
@@ -263,7 +263,7 @@ void A2AVectorsIo::write(const std::string fileStem, std::vector<Field> &vec,
 | 
			
		||||
    Record       record;
 | 
			
		||||
    GridBase     *grid = vec[0]._grid;
 | 
			
		||||
    ScidacWriter binWriter(grid->IsBoss());
 | 
			
		||||
    std::string  filename = vecFilename(fileStem, multiFile, trajectory);
 | 
			
		||||
    std::string  filename = vecFilename(fileStem, trajectory, multiFile);
 | 
			
		||||
 | 
			
		||||
    if (multiFile)
 | 
			
		||||
    {
 | 
			
		||||
@@ -301,7 +301,7 @@ void A2AVectorsIo::read(std::vector<Field> &vec, const std::string fileStem,
 | 
			
		||||
{
 | 
			
		||||
    Record       record;
 | 
			
		||||
    ScidacReader binReader;
 | 
			
		||||
    std::string  filename = vecFilename(fileStem, multiFile, trajectory);
 | 
			
		||||
    std::string  filename = vecFilename(fileStem, trajectory, multiFile);
 | 
			
		||||
 | 
			
		||||
    if (multiFile)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -242,8 +242,12 @@ void TA2AVectors<FImpl, Pack>::execute(void)
 | 
			
		||||
    // I/O if necessary
 | 
			
		||||
    if (!par().output.empty())
 | 
			
		||||
    {
 | 
			
		||||
        A2AVectorsIo::write(par().output + "_w", w, par().multiFile, vm().getTrajectory());
 | 
			
		||||
        startTimer("V I/O");
 | 
			
		||||
        A2AVectorsIo::write(par().output + "_v", v, par().multiFile, vm().getTrajectory());
 | 
			
		||||
        stopTimer("V I/O");
 | 
			
		||||
        startTimer("W I/O");
 | 
			
		||||
        A2AVectorsIo::write(par().output + "_w", w, par().multiFile, vm().getTrajectory());
 | 
			
		||||
        stopTimer("W I/O");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ using namespace Hadrons;
 | 
			
		||||
template <typename FOut, typename FIn>
 | 
			
		||||
void convert(const std::string outFilename, const std::string inFilename, 
 | 
			
		||||
             const unsigned int Ls, const bool rb, const unsigned int size, 
 | 
			
		||||
             const bool multiFile)
 | 
			
		||||
             const bool multiFile, const bool testRead)
 | 
			
		||||
{
 | 
			
		||||
    assert(outFilename != inFilename);
 | 
			
		||||
    
 | 
			
		||||
@@ -102,6 +102,7 @@ void convert(const std::string outFilename, const std::string inFilename,
 | 
			
		||||
    LOG(Message) << "Out type      : " << typeName<FOut>() << std::endl;
 | 
			
		||||
    LOG(Message) << "#vectors      : " << size << std::endl;
 | 
			
		||||
    LOG(Message) << "Multifile     : " << (multiFile ? "yes" : "no") << std::endl;
 | 
			
		||||
    LOG(Message) << "Test read     : " << (testRead ? "yes" : "no") << std::endl;
 | 
			
		||||
    if (multiFile)
 | 
			
		||||
    {
 | 
			
		||||
        for(unsigned int k = 0; k < size; ++k)
 | 
			
		||||
@@ -112,6 +113,8 @@ void convert(const std::string outFilename, const std::string inFilename,
 | 
			
		||||
            LOG(Message) << "==== Converting vector " << k << std::endl;
 | 
			
		||||
            LOG(Message) << "In : " << inV  << std::endl;
 | 
			
		||||
            LOG(Message) << "Out: " << outV << std::endl;
 | 
			
		||||
            // conversion
 | 
			
		||||
            LOG(Message) << "-- Doing conversion" << std::endl;
 | 
			
		||||
            makeFileDir(outV, gOut);
 | 
			
		||||
            binWriter.open(outV);
 | 
			
		||||
            binReader.open(inV);
 | 
			
		||||
@@ -121,10 +124,20 @@ void convert(const std::string outFilename, const std::string inFilename,
 | 
			
		||||
            EigenPackIo::writeElement<FIn, FOut>(binWriter, bufIn, eval, k, &bufOut, &testIn);
 | 
			
		||||
            binWriter.close();
 | 
			
		||||
            binReader.close();
 | 
			
		||||
            // read test
 | 
			
		||||
            if (testRead)
 | 
			
		||||
            {
 | 
			
		||||
                LOG(Message) << "-- Test read" << std::endl;
 | 
			
		||||
                binReader.open(outV);
 | 
			
		||||
                EigenPackIo::readElement<FOut>(bufOut, eval, k, binReader);
 | 
			
		||||
                binReader.close();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        // conversion
 | 
			
		||||
        LOG(Message) << "-- Doing conversion" << std::endl;
 | 
			
		||||
        makeFileDir(outFilename, gOut);
 | 
			
		||||
        binWriter.open(outFilename);
 | 
			
		||||
        binReader.open(inFilename);
 | 
			
		||||
@@ -137,6 +150,18 @@ void convert(const std::string outFilename, const std::string inFilename,
 | 
			
		||||
        }
 | 
			
		||||
        binWriter.close();
 | 
			
		||||
        binReader.close();
 | 
			
		||||
        // read test
 | 
			
		||||
        if (testRead)
 | 
			
		||||
        {
 | 
			
		||||
            LOG(Message) << "-- Test read" << std::endl;
 | 
			
		||||
            binReader.open(outFilename);
 | 
			
		||||
            EigenPackIo::readHeader(record, binReader);
 | 
			
		||||
            for(unsigned int k = 0; k < size; ++k)
 | 
			
		||||
            {
 | 
			
		||||
                EigenPackIo::readElement<FOut>(bufOut, eval, k, binReader);
 | 
			
		||||
            }
 | 
			
		||||
            binReader.close();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -154,11 +179,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
    // parse command line
 | 
			
		||||
    std::string  outFilename, inFilename;
 | 
			
		||||
    unsigned int size, Ls;
 | 
			
		||||
    bool         rb, multiFile;
 | 
			
		||||
    bool         rb, multiFile, testRead;
 | 
			
		||||
    
 | 
			
		||||
    if (argc < 7)
 | 
			
		||||
    if (argc < 8)
 | 
			
		||||
    {
 | 
			
		||||
        std::cerr << "usage: " << argv[0] << " <out eigenpack> <in eigenpack> <Ls> <red-black (0|1)> <#vector> <multifile (0|1)> [Grid options]";
 | 
			
		||||
        std::cerr << "usage: " << argv[0] << " <out eigenpack> <in eigenpack> <Ls> <red-black {0|1}> <#vector> <multifile {0|1}> <test read {0|1}> [Grid options]";
 | 
			
		||||
        std::cerr << std::endl;
 | 
			
		||||
        std::exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
@@ -168,6 +193,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
    rb          = (std::string(argv[4]) != "0");
 | 
			
		||||
    size        = std::stoi(std::string(argv[5]));
 | 
			
		||||
    multiFile   = (std::string(argv[6]) != "0");
 | 
			
		||||
    testRead    = (std::string(argv[7]) != "0");
 | 
			
		||||
    
 | 
			
		||||
    // initialization
 | 
			
		||||
    Grid_init(&argc, &argv);
 | 
			
		||||
@@ -176,7 +202,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
    // execution
 | 
			
		||||
    try
 | 
			
		||||
    {
 | 
			
		||||
        convert<FOUT, FIN>(outFilename, inFilename, Ls, rb, size, multiFile);
 | 
			
		||||
        convert<FOUT, FIN>(outFilename, inFilename, Ls, rb, size, multiFile, testRead);
 | 
			
		||||
    }
 | 
			
		||||
    catch (const std::exception& e)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user