Rev 154 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 154 | Rev 156 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | ******************************************************************************* |
44 | ******************************************************************************* |
| 45 | */ |
45 | */ |
| 46 | void AutoTune(int nargs, char *args[]) { |
46 | void AutoTune(int nargs, char *args[]) { |
| 47 | unsigned int target_time = 3000, accuracy = 4, atstart, atend; |
47 | unsigned int target_time = 3000, accuracy = 4, atstart, atend; |
| 48 | unsigned int time, current, setting[64], times[64], last_time, stageii; |
48 | unsigned int time, current, setting[64], times[64], last_time, stageii; |
| 49 | int benchd, i, v |
49 | int benchd, i, v; unsigned int p; int best; unsigned int bestv; int samples; // Pierre-Marie Baty -- fixed types |
| 50 | FILE *craftyrc = fopen(".craftyrc", "a"); |
50 | FILE *craftyrc = fopen(".craftyrc", "a"); |
| 51 | 51 | ||
| 52 | /* |
52 | /* |
| 53 | ************************************************************ |
53 | ************************************************************ |
| 54 | * * |
54 | * * |
| Line 95... | Line 95... | ||
| 95 | Print(4095, "\nBegin stage I (calibration)\n"); |
95 | Print(4095, "\nBegin stage I (calibration)\n"); |
| 96 | last_time = 0; |
96 | last_time = 0; |
| 97 | for (benchd = -5; benchd < 10; benchd++) { |
97 | for (benchd = -5; benchd < 10; benchd++) { |
| 98 | Print(4095, "bench %2d:", benchd); |
98 | Print(4095, "bench %2d:", benchd); |
| 99 | time = 0; |
99 | time = 0; |
| 100 | for (v = 0; v < accuracy; v++) |
100 | for (v = 0; v < (int) accuracy; v++) // Pierre-Marie Baty -- added type cast |
| 101 | time += Bench(benchd, 1); |
101 | time += Bench(benchd, 1); |
| 102 | time /= accuracy; |
102 | time /= accuracy; |
| 103 | Print(4095, " ->%s\n", DisplayHHMMSS(time)); |
103 | Print(4095, " ->%s\n", DisplayHHMMSS(time)); |
| 104 | if (time > 6 * target_time) |
104 | if (time > 6 * target_time) |
| 105 | break; |
105 | break; |
| Line 135... | Line 135... | ||
| 135 | for (v = 0; v < autotune_params; v++) { |
135 | for (v = 0; v < autotune_params; v++) { |
| 136 | Print(4095, "auto-tuning %s (%d ~ %d by %d)\n", tune[v].description, |
136 | Print(4095, "auto-tuning %s (%d ~ %d by %d)\n", tune[v].description, |
| 137 | tune[v].min, tune[v].max, tune[v].increment); |
137 | tune[v].min, tune[v].max, tune[v].increment); |
| 138 | current = *tune[v].parameter; |
138 | current = *tune[v].parameter; |
| 139 | samples = 0; |
139 | samples = 0; |
| 140 | if (v == 0 && tune[v].min > smp_max_threads) { |
140 | if (v == 0 && tune[v].min > (unsigned int) smp_max_threads) { // Pierre-Marie Baty -- added type cast |
| 141 | samples = 1; |
141 | samples = 1; |
| 142 | times[0] = 0; |
142 | times[0] = 0; |
| 143 | setting[0] = smp_max_threads; |
143 | setting[0] = smp_max_threads; |
| 144 | } else |
144 | } else |
| 145 | for (current = tune[v].min; current <= tune[v].max; |
145 | for (current = tune[v].min; current <= tune[v].max; |