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 for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
58 for (int i=0; i<100; i++) {
59 for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
64 for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
71 void o815::parseArgs(int argc, char **argv) {
74 while( (opt = getopt(argc, argv, "L:N:S:E:o:O:c:C:w:i:j:")) != -1 )
77 listArg(comargs.lsize, 2, optarg);
80 comargs.nmeas = atoi(optarg);
83 comargs.nskip = atoi(optarg);
86 comargs.nequi = atoi(optarg);
89 comargs.obscache.first = optarg;
90 comargs.obscache.second = 1;
93 comargs.obscache.first = optarg;
94 comargs.obscache.second = 2;
97 comargs.confcache.first = optarg;
98 comargs.confcache.second = 1;
101 comargs.confcache.first = optarg;
102 comargs.confcache.second = 2;
105 comargs.outdir = optarg;
108 comargs.idonly = atoi(optarg);
111 comargs.showjobnum = atoi(optarg);
116 void o815::listArg(int *target, int tlen, char *listarg) {
119 for( int pos=0; pos<strlen(listarg); pos++ )
120 if( listarg[pos] == ':' ) nargs++;
123 for(int i=0; i<tlen; i++) target[i] = atoi(listarg);
126 target[0] = atoi(strtok(listarg, ":"));
127 for(int i=0; i<nargs; i++)
128 target[i+1] = atoi(strtok(NULL, ":"));
132 string o815::headMaster()
136 hm << "-L" << comargs.lsize[0] << "_" << comargs.lsize[1] << "-E" << comargs.nequi << "-S" << comargs.nskip << "-N" << comargs.nmeas
137 << paraQ->rangeString();
143 if(comargs.outdir=="") {
144 MPI_Barrier(MPI_COMM_WORLD);
146 cout << "#end" << endl << flush;
149 cout << "bu:" << rank << endl;