instanceinfo.cpp 1.34 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
#include <iostream>
#include <getopt.h>
#include <string>
#include <vector>

#include "instance.h"
#include "util.h"

using namespace std;


static const int opt_no_convert = 10;
static const int opt_no_header = 12;

static struct option long_options[] = {
  {"no-convert",   no_argument, 0,  opt_no_convert},
  {"no-header", no_argument, 0, opt_no_header},
  {0,         0,                 0,  0 }
};

static const char* optstring = "";

int main(int argc, char* argv[]) {

  
  bool convertIndices = true;
  bool printHeader = true; 
  vector<string> inputFiles; 

  int longindex = 0; 
  int opt = getopt_long(argc, argv, optstring, long_options, & longindex);
  while(opt != -1) {
    switch(opt) {
    case opt_no_convert:
      convertIndices = false;
      break;
    case opt_no_header:
      printHeader = false;
      break;
    default:
      break;
    }
    opt = getopt_long(argc, argv, optstring, long_options, & longindex);
  }
  for(int a = optind; a < argc; ++a)
    inputFiles.push_back(string(argv[a]));

  if(printHeader) {
    cout << "input nbTasks depth" << endl; 
  }
  
  for(string &file: inputFiles) {
    Instance* instance = new Instance(file, convertIndices);
    int nbTasks = instance->nbTasks;
    int depth = getMax(instance->computeUnitRank());
    cout << file << " " << nbTasks << " " << depth << endl;
    delete instance; 
  }
  
}