comargs.outdir="";
comargs.idonly = false;
comargs.showjobnum = false;
-
+ comargs.startconfig = "";
+
#ifndef MPI_DISABLED
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
rank = 0;
#endif
- addComOption("lsize", required_argument, NULL, 'L', "define lattice size", "xsize:tsize");
- addComOption("nmeas", required_argument, NULL, 'N', "set number of measurements", "nmeas");
- addComOption("skip", required_argument, NULL, 'S', "set number of skips between configs", "nskip");
- addComOption("nequi", required_argument, NULL, 'E', "set number of equilibrations", "nequi");
- addComOption("ocache", required_argument, NULL, 'O', "set observable cache (mode=oo|ro|wo|rw)", "dir:mode");
- addComOption("ccache", required_argument, NULL, 'C', "set config cache (mode=oo|ro|wo|rw)", "dir:mode");
- addComOption("write", required_argument, NULL, 'W', "data writeout directory", "dir");
- addComOption("idonly", no_argument, &comargs.idonly, 'I', "show output-id only", "");
- addComOption("jobnum", no_argument, &comargs.showjobnum, 'J', "show jobnumber only", "");
-
+ addComOption("lsize", required_argument, NULL, 'L', "define lattice size", "xsize:tsize");
+ addComOption("nmeas", required_argument, NULL, 'N', "set number of measurements", "nmeas");
+ addComOption("skip", required_argument, NULL, 'S', "set number of skips between configs", "nskip");
+ addComOption("nequi", required_argument, NULL, 'E', "set number of equilibrations", "nequi");
+ addComOption("ocache", required_argument, NULL, 'O', "set observable cache (mode=oo|ro|wo|rw)", "dir:mode");
+ addComOption("ccache", required_argument, NULL, 'C', "set config cache (mode=oo|ro|wo|rw)", "dir:mode");
+ addComOption("write", required_argument, NULL, 'W', "data writeout directory", "dir");
+ addComOption("idonly", no_argument, &comargs.idonly, 'I', "show output-id only", "");
+ addComOption("jobnum", no_argument, &comargs.showjobnum, 'J', "show jobnumber only", "");
+ addComOption("startconfig", required_argument, NULL, 'X', "read start config from file", "startconfigfile");
+
vector<comoption>::iterator lastO815Opt = comOptions.end()-1;
if (specOps != NULL)
long timestamp;
if(comargs.idonly) {
- cout << programid << headMaster() << endl << flush;
+ cout << programid << headMaster(true) << endl << flush;
exit(0);
}
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<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit)
(*obsit)->start();
*out->log << ">" << endl << flush;
Sim->_newParas();
+
+ Sim->resetConfig();
progress measProg(comargs.nmeas);
for( int imeas=0; imeas<comargs.nmeas; imeas++ ) {
bool nextAlready = false;
+
for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
bool readnewObs;
int nequileftNewObs;
}
(*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;
}
case 'C':
readCacheArgs(optarg, comargs.confcache.first, comargs.confcache.second);
break;
- case 'w':
+ case 'W':
comargs.outdir = optarg;
break;
+ case 'X':
+ comargs.startconfig = optarg;
+ break;
default:
if ( opt != 0) {
comoption* thisop = getOptionByVal(opt);
}
}
-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();
}
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;
+}