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::parseArgs(int argc, char **argv) {
56 while( (opt = getopt(argc, argv, "L:N:S:E:o:O:c:C:w:i:j:")) != -1 )
59 listArg(comargs.lsize, 2, optarg);
62 comargs.nmeas = atoi(optarg);
65 comargs.nskip = atoi(optarg);
68 comargs.nequi = atoi(optarg);
71 comargs.obscache.first = optarg;
72 comargs.obscache.second = 1;
75 comargs.obscache.first = optarg;
76 comargs.obscache.second = 2;
79 comargs.confcache.first = optarg;
80 comargs.confcache.second = 1;
83 comargs.confcache.first = optarg;
84 comargs.confcache.second = 2;
87 comargs.outdir = optarg;
90 comargs.idonly = atoi(optarg);
93 comargs.showjobnum = atoi(optarg);
98 void o815::listArg(int *target, int tlen, char *listarg) {
101 for( int pos=0; pos<strlen(listarg); pos++ )
102 if( listarg[pos] == ':' ) nargs++;
105 for(int i=0; i<tlen; i++) target[i] = atoi(listarg);
108 target[0] = atoi(strtok(listarg, ":"));
109 for(int i=0; i<nargs; i++)
110 target[i+1] = atoi(strtok(NULL, ":"));
114 string o815::headMaster()
118 hm << "-L" << comargs.lsize[0] << "_" << comargs.lsize[1] << "-E" << comargs.nequi << "-S" << comargs.nskip << "-N" << comargs.nmeas
119 << paraQ->rangeString();