コード例 #1
0
ファイル: main.cpp プロジェクト: pranamibhatt/booksim
int main( int argc, char **argv )
{

  BookSimConfig config;

  if ( !ParseArgs( &config, argc, argv ) ) {
    cout << "Usage: " << argv[0] << " configfile" << endl;
    return 0;
  }

  /*print the configuration file at the begining of the reprot
   */
  ifstream in(argv[1]);
  char c;
  cout << "BEGIN Configuration File" << endl;
  cout << "Name: " << argv[1] << endl;
  while (!in.eof()) {
    in.get(c);
    cout << c ;
  }
  cout << "END Configuration File" << endl;

  _threads = config.GetInt("threads");

  /*initialize routing, traffic, injection functions
   */
  InitializeRoutingMap( );
  InitializeTrafficMap( );
  InitializeInjectionMap( );

  _print_activity = (config.GetInt("print_activity")==1);
  _trace = (config.GetInt("viewer trace")==1);
  
  _use_read_write = (config.GetInt("use_read_write")==1);
  
  config.GetStr( "watch_file", watch_file );

  _use_noc_latency = (config.GetInt("use_noc_latency")==1);

  /*configure and run the simulator
   */
  bool result;
  //  for(int i = 0; i<2; i++){
    result = AllocatorSim( config );
    //}
  return result ? -1 : 0;
}
コード例 #2
0
void init_interconnect (char* config_file,
                        unsigned int n_shader, 
                        unsigned int n_mem )
{
   _n_shader = n_shader;
   _n_mem = n_mem;
   if (! config_file ) {
      cout << "Interconnect Requires a configfile" << endl;
      exit (-1);
   }
   icnt_config.Parse( config_file );

   net_c = icnt_config.GetInt( "network_count" );
   if (net_c==2) {
      doub_net = true;    
   } else if (net_c<1 || net_c>2) {
      cout <<net_c<<" Network_count less than 1 or more than 2 not supported."<<endl;
      abort();
   }

   g_num_vcs = icnt_config.GetInt( "num_vcs" );
   InitializeRoutingMap( );
   InitializeTrafficMap( );
   InitializeInjectionMap( );

   RandomSeed( icnt_config.GetInt("seed") );

   Network_gpgpu **net;

   traffic = new TrafficManager *[net_c];
   net = new Network_gpgpu *[net_c];

   for (unsigned i=0;i<net_c;i++) {
      string topo;

      icnt_config.GetStr( "topology", topo );

      if ( topo == "torus" ) {
         net[i] = new KNCube( icnt_config, true ); 
      } else if (   topo =="mesh"  ) {
         net[i] = new KNCube( icnt_config, false );
      } else if ( topo == "fly" ) {
         net[i] = new KNFly( icnt_config );
      } else if ( topo == "single" ) {
         net[i] = new SingleNet( icnt_config );
      } else {
         cerr << "Unknown topology " << topo << endl;
         exit(-1);
      }

      if ( icnt_config.GetInt( "link_failures" ) ) {
         net[i]->InsertRandomFaults( icnt_config );
      }

      traffic[i] = new TrafficManager ( icnt_config, net[i], i/*id*/ );
   }

   fixed_lat_icnt = icnt_config.GetInt( "fixed_lat_per_hop" );

   if (icnt_config.GetInt( "perfect_icnt" )) {
      perfect_icnt = true;
      fixed_lat_icnt = 1;  
   }
   _flit_size = icnt_config.GetInt( "flit_size" );
   if (icnt_config.GetInt("ejection_buf_size")) {
      ejection_buffer_capacity = icnt_config.GetInt( "ejection_buf_size" ) ;
   } else {
      ejection_buffer_capacity = icnt_config.GetInt( "vc_buf_size" );
   }
   boundary_buf_capacity = icnt_config.GetInt( "boundary_buf_size" ) ;
   if (icnt_config.GetInt("input_buf_size")) {
      input_buffer_capacity = icnt_config.GetInt("input_buf_size");
   } else {
      input_buffer_capacity = 9;
   }
   create_buf(traffic[0]->_dests,input_buffer_capacity,icnt_config.GetInt( "num_vcs" )); 
   MATLAB_OUTPUT        = icnt_config.GetInt("MATLAB_OUTPUT");
   DISPLAY_LAT_DIST     = icnt_config.GetInt("DISPLAY_LAT_DIST");
   DISPLAY_HOP_DIST     = icnt_config.GetInt("DISPLAY_HOP_DIST");
   DISPLAY_PAIR_LATENCY = icnt_config.GetInt("DISPLAY_PAIR_LATENCY");
   create_node_map(n_shader,n_mem,traffic[0]->_dests, icnt_config.GetInt("use_map"));
   for (unsigned i=0;i<net_c;i++) {
      traffic[i]->_FirstStep();
   }
}