X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/594f56b186b5d2f5e25293d6952c9325576aa080..061e6469f58f3e3e892f1cd1f6fdd2aad9c644e8:/o815/o815.cpp diff --git a/o815/o815.cpp b/o815/o815.cpp index 17581ec..c559281 100644 --- a/o815/o815.cpp +++ b/o815/o815.cpp @@ -111,7 +111,7 @@ void o815::postParaInit() { long timestamp; if(comargs.idonly) { - cout << programid << headMaster() << endl << flush; + cout << programid << headMaster(true) << endl << flush; exit(0); } @@ -123,12 +123,15 @@ void o815::postParaInit() { exit(0); } - out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs); + out = new writeout(comargs.outdir, programid+headMaster(true), rank, numprocs); } void o815::mainLoop() { *out->log << "OBS: Starting main loop." << endl; + if ( observables.size() == 0 ) + *out->log << "O815: Running in 0-observable-mode." << endl; + for (vector::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) (*obsit)->start(); @@ -149,6 +152,7 @@ void o815::mainLoop() { for( int imeas=0; imeas::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) { bool readnewObs; int nequileftNewObs; @@ -165,9 +169,12 @@ void o815::mainLoop() { } (*obsit)->meas(false, imeas); hypercache::writeO( (*obsit)->ocid ); - } - + } } + + if ( observables.size() == 0 ) + Sim->nextConfig(); + while( measProg.madeStep(imeas) ) *out->log << "O815: " << measProg.done()*100 << "% of measurements done." << endl << flush; } @@ -226,7 +233,7 @@ void o815::parseArgs(int argc, char **argv, comoption specOps[]) { case 'C': readCacheArgs(optarg, comargs.confcache.first, comargs.confcache.second); break; - case 'w': + case 'W': comargs.outdir = optarg; break; default: @@ -267,12 +274,16 @@ void o815::listArg(int *target, int tlen, char *listarg) { } } -string o815::headMaster() +string o815::headMaster(bool hashedrange) { stringstream hm; - hm << "-L" << comargs.lsize[0] << "_" << comargs.lsize[1] << "-E" << comargs.nequi << "-S" << comargs.nskip << "-N" << comargs.nmeas - << paraQ->rangeString(); + hm << "_L" << comargs.lsize[0] << "x" << comargs.lsize[1] << "_E" << comargs.nequi << "_S" << comargs.nskip << "_N" << comargs.nmeas; + + if( ! hashedrange ) + hm << paraQ->rangeString(); + else + hm << "_" << hash( paraQ->rangeString() ); return hm.str(); } @@ -331,3 +342,13 @@ void o815::readCacheArgs(const string& arg, string& cachedir, int& cachemode) cachedir = arg.substr( 0, arg.rfind(":") ); } + +unsigned long o815::hash(const string& str) +{ + unsigned long hash = 5381; + + for(string::const_iterator it=str.begin();it!=str.end();it++) + hash = ((hash << 5) + hash) + *it; /* hash * 33 + character */ + + return hash; +}