04-20-09-Num Cores

From Msim

Revision as of 23:03, 20 April 2009 by Jloew (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This refers to the fixes to main.c and options.c to handle num_cores in a config file and large config files

Options.c has a limit to the number of arguments it can handle. If there are too many it throws the error: option line too complex in file `%s'
This can be handled by increasing the size of MAX_LINE_ARGS, we have (arbitrarily) increased it to 65536.

#define MAX_LINE_ARGS 65536

In order to handle the command line options for multiple cores, the option "-num_cores" is processed before the option handler takes effect. This is because the number of cores determines what options are available (-rob:size would become -rob:size_0, -rob:size_1... -rob:size_N if multiple cores are present).

The additions (from main.c) are shown in bold:

//Here we pre-process the number of contexts and cores. This enables us to modify the options handler to
//take parameters for multiple cores - and ultimately, to place multiple contexts
contexts_at_init_time = 0;
cores_at_init_time = 1;
for(int i=0;i<argc;i++)
 std::string temp(argv[i]);
  cores_at_init_time = atoi(argv[i+1]);
 //If the num_cores option is in the config file, it won't be read in time
 //Here, we can read it early
  std::ifstream infile;
  std::string temp;
  while(infile >> temp)
    infile >> cores_at_init_time;

Personal tools