5 o815::o815(int argc, char **argv, const string& _programid) {
8 programid = _programid;
15 comargs.obscache = make_pair("",0);
16 comargs.confcache = make_pair("",0);
18 comargs.idonly = false;
19 comargs.showjobnum = false;
21 MPI_Init(&argc, &argv);
22 MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
23 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
25 paraQ = new paraq(numprocs, rank);
27 parseArgs(argc, argv);
30 cout << programid << headMaster() << endl << flush;
34 if( comargs.showjobnum ) {
35 for( int i=1; i<=paraQ->getTotalJobs(); i++ ) {
36 if( paraQ->getTotalJobs()%i == 0 ) cout << paraQ->getTotalJobs()/i << "@" << i << " ";
43 timestamp = time(NULL);
44 for(int idest=1; idest<numprocs; idest++)
45 MPI_Send(×tamp, 1, MPI_LONG, idest, 123, MPI_COMM_WORLD);
48 MPI_Recv(×tamp, 1, MPI_LONG, 0, 123, MPI_COMM_WORLD, &mpiStatus);
50 out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs, timestamp);
53 void o815::mainLoop() {
54 *out->log << "OBS: Starting main loop." << endl;
56 for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
60 //while( nextParas() ) {
64 for (int i=0; i<100; i++) {
65 for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
71 for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
76 void o815::parseArgs(int argc, char **argv) {
79 while( (opt = getopt(argc, argv, "L:N:S:E:o:O:c:C:w:i:j:")) != -1 )
82 listArg(comargs.lsize, 2, optarg);
85 comargs.nmeas = atoi(optarg);
88 comargs.nskip = atoi(optarg);
91 comargs.nequi = atoi(optarg);
94 comargs.obscache.first = optarg;
95 comargs.obscache.second = 1;
98 comargs.obscache.first = optarg;
99 comargs.obscache.second = 2;
102 comargs.confcache.first = optarg;
103 comargs.confcache.second = 1;
106 comargs.confcache.first = optarg;
107 comargs.confcache.second = 2;
110 comargs.outdir = optarg;
113 comargs.idonly = atoi(optarg);
116 comargs.showjobnum = atoi(optarg);
121 void o815::listArg(int *target, int tlen, char *listarg) {
124 for( int pos=0; pos<strlen(listarg); pos++ )
125 if( listarg[pos] == ':' ) nargs++;
128 for(int i=0; i<tlen; i++) target[i] = atoi(listarg);
131 target[0] = atoi(strtok(listarg, ":"));
132 for(int i=0; i<nargs; i++)
133 target[i+1] = atoi(strtok(NULL, ":"));
137 string o815::headMaster()
141 hm << "-L" << comargs.lsize[0] << "_" << comargs.lsize[1] << "-E" << comargs.nequi << "-S" << comargs.nskip << "-N" << comargs.nmeas
142 << paraQ->rangeString();
148 if(comargs.outdir=="") {
149 MPI_Barrier(MPI_COMM_WORLD);
151 cout << "#end" << endl << flush;
157 int o815::nextParas()
159 if( paraQ->nextParas() ) {
161 setB( (*paraQ)["beta"] );
162 setK( (*paraQ)["kappa"] );
163 setL( (*paraQ)["lambda"] );
164 setM1( (*paraQ)["mu1"] );
165 setM2( (*paraQ)["mu2"] );