Subversion Repositories Games.Chess Giants

Rev

Rev 108 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 108 Rev 154
Line 56... Line 56...
56
 *                                                          *
56
 *                                                          *
57
 ************************************************************
57
 ************************************************************
58
 */
58
 */
59
  if (smp_max_threads < 2) {
59
  if (smp_max_threads < 2) {
60
    Print(4095, "ERROR: smpmt must be set to > 1 for tuning to work\n");
60
    Print(4095, "ERROR: smpmt must be set to > 1 for tuning to work\n");
-
 
61
    fclose(craftyrc);
61
    return;
62
    return;
62
  }
63
  }
63
  if (nargs > 1)
64
  if (nargs > 1)
64
    target_time = atoi(args[1]) * 100;
65
    target_time = atoi(args[1]) * 100;
65
  if (nargs > 2)
66
  if (nargs > 2)
Line 94... Line 95...
94
  Print(4095, "\nBegin stage I (calibration)\n");
95
  Print(4095, "\nBegin stage I (calibration)\n");
95
  last_time = 0;
96
  last_time = 0;
96
  for (benchd = -5; benchd < 10; benchd++) {
97
  for (benchd = -5; benchd < 10; benchd++) {
97
    Print(4095, "bench %2d:", benchd);
98
    Print(4095, "bench %2d:", benchd);
98
    time = 0;
99
    time = 0;
99
    for (v = 0; v < (int) accuracy; v++) // Pierre-Marie Baty -- added type cast
100
    for (v = 0; v < accuracy; v++)
100
      time += Bench(benchd, 1);
101
      time += Bench(benchd, 1);
101
    time /= accuracy;
102
    time /= accuracy;
102
    Print(4095, " ->%s\n", DisplayHHMMSS(time));
103
    Print(4095, " ->%s\n", DisplayHHMMSS(time));
103
    if (time > 6 * target_time)
104
    if (time > 6 * target_time)
104
      break;
105
      break;
Line 144... Line 145...
144
      for (current = tune[v].min; current <= tune[v].max;
145
      for (current = tune[v].min; current <= tune[v].max;
145
          current += tune[v].increment) {
146
          current += tune[v].increment) {
146
        Print(4095, "Testing %d: ", current);
147
        Print(4095, "Testing %d: ", current);
147
        *tune[v].parameter = current;
148
        *tune[v].parameter = current;
148
        time = 0;
149
        time = 0;
149
        for (p = 0; p < (int) accuracy; p++) // Pierre-Marie Baty -- added type cast
150
        for (p = 0; p < accuracy; p++)
150
          time += Bench(benchd, 1);
151
          time += Bench(benchd, 1);
151
        time /= accuracy;
152
        time /= accuracy;
152
        times[samples] = time;
153
        times[samples] = time;
153
        setting[samples++] = current;
154
        setting[samples++] = current;
154
        Print(4095, " ->%s\n", DisplayHHMMSS(time));
155
        Print(4095, " ->%s\n", DisplayHHMMSS(time));
155
      }
156
      }
156
    best = 0;
157
    best = 0;
157
    bestv = times[0];
158
    bestv = times[0];
158
    for (i = 1; i < samples; i++)
159
    for (i = 1; i < samples; i++)
159
      if (bestv > (int) times[i]) { // Pierre-Marie Baty -- added type cast
160
      if (bestv > times[i]) {
160
        bestv = times[i];
161
        bestv = times[i];
161
        best = i;
162
        best = i;
162
      }
163
      }
163
    fprintf(craftyrc, "%s=%d\n", tune[v].command, setting[best]);
164
    fprintf(craftyrc, "%s=%d\n", tune[v].command, setting[best]);
164
    Print(4095, "adding " "%s=%d" " to .craftyrc file.\n", tune[v].command,
165
    Print(4095, "adding " "%s=%d" " to .craftyrc file.\n", tune[v].command,