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) {
69 void o815::parseArgs(int argc, char **argv) {
72 while( (opt = getopt(argc, argv, "L:N:S:E:o:O:c:C:w:i:j:")) != -1 )
75 listArg(comargs.lsize, 2, optarg);
78 comargs.nmeas = atoi(optarg);
81 comargs.nskip = atoi(optarg);
84 comargs.nequi = atoi(optarg);
87 comargs.obscache.first = optarg;
88 comargs.obscache.second = 1;
91 comargs.obscache.first = optarg;
92 comargs.obscache.second = 2;
95 comargs.confcache.first = optarg;
96 comargs.confcache.second = 1;
99 comargs.confcache.first = optarg;
100 comargs.confcache.second = 2;
103 comargs.outdir = optarg;
106 comargs.idonly = atoi(optarg);
109 comargs.showjobnum = atoi(optarg);
114 void o815::listArg(int *target, int tlen, char *listarg) {
117 for( int pos=0; pos<strlen(listarg); pos++ )
118 if( listarg[pos] == ':' ) nargs++;
121 for(int i=0; i<tlen; i++) target[i] = atoi(listarg);
124 target[0] = atoi(strtok(listarg, ":"));
125 for(int i=0; i<nargs; i++)
126 target[i+1] = atoi(strtok(NULL, ":"));
130 string o815::headMaster()
134 hm << "-L" << comargs.lsize[0] << "_" << comargs.lsize[1] << "-E" << comargs.nequi << "-S" << comargs.nskip << "-N" << comargs.nmeas
135 << paraQ->rangeString();
141 if(comargs.outdir=="") {
142 MPI_Barrier(MPI_COMM_WORLD);
144 cout << "#end" << endl << flush;