Skip to content

Commit 0f59733

Browse files
committed
Parameter tuning, Min_Threads added
Set chess piece values to those from the GH compile of Fire 2.2. Introduce Min_Threads and remove doubling of the CPU number to get the number of threads. Now it is still possible to have more threads than processors if one wants to, but such a setting is no longer the default, which was bad.
1 parent de05982 commit 0f59733

File tree

5 files changed

+51
-13
lines changed

5 files changed

+51
-13
lines changed

src/fire.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ along with this program. If not, see http://www.gnu.org/licenses/.
132132
// Piece Values
133133
#define DEFAULT_PAWN_VALUE 100 // Original: 100; DO NOT ALTER! IT SETS THE SCALE. Yuri Censor, 03/25/2013
134134
#define MAX_PAWN_VALUE 200
135-
#define DEFAULT_KNIGHT_VALUE 320 // Original: 320; Modified: 317 (03/28/2013)
135+
#define DEFAULT_KNIGHT_VALUE 300 // Original: 320; Modified: 317 (03/28/2013); GH: 300 (5/21/2013)
136136
#define MAX_KNIGHT_VALUE 640
137-
#define DEFAULT_BISHOP_VALUE 330 // Original: 330; Modified: 333 (03/28/2013)
137+
#define DEFAULT_BISHOP_VALUE 310 // Original: 330; Modified: 333 (03/28/2013); GH: 310 (5/21/2013)
138138
#define MAX_BISHOP_VALUE 640
139-
#define DEFAULT_ROOK_VALUE 510 // Original: 510; Modified: 520 (03/28/2013)
139+
#define DEFAULT_ROOK_VALUE 500 // Original: 510; Modified: 520 (03/28/2013); GH: 500 (5/21/2013)
140140
#define MAX_ROOK_VALUE 1000
141-
#define DEFAULT_QUEEN_VALUE 1000 // Original: 1000; Modified: 960 (03/28/2013)
141+
#define DEFAULT_QUEEN_VALUE 950 // Original: 1000; Modified: 960 (03/28/2013); GH: 950 (5/21/2013)
142142
#define MAX_QUEEN_VALUE 2000
143-
#define DEFAULT_BISHOP_PAIR_VALUE 50 // Original: 50
143+
#define DEFAULT_BISHOP_PAIR_VALUE 45 // Original: 50; Modified: 50 (03/28/2013); GH: 45 (5/21/2013)
144144
#define MAX_BISHOP_PAIR_VALUE 200
145145

146146
// Eval Weights
@@ -323,6 +323,7 @@ int MultiPV;
323323
int OptHashSize;
324324
int OptPHashSize;
325325
int OptMaxThreads;
326+
int OptMinThreads; // Added 5/22/2013 by Yuri Censor for Firenzina
326327
int RandRange;
327328

328329
#if defined(_WIN32) && !defined(__GNUC__) || defined(_WIN64) && !defined(__GNUC__)

src/init.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ static void parse_option(const char *str)
183183
{
184184
int input = atoi(arg[1]);
185185
OptMaxThreads = input;
186-
if (OptMaxThreads == 0)
186+
if (OptMaxThreads <= 0) // Modified 5/22/2013 by Yuri Censor for Firenzina
187+
OptMaxThreads = MaxCPUs;
188+
else if (OptMaxThreads > MaxCPUs)
187189
OptMaxThreads = MaxCPUs;
188190
Send("Max Threads: %d\n", OptMaxThreads);
189191
if (VerboseUCI)
@@ -196,6 +198,27 @@ static void parse_option(const char *str)
196198
fprintf(log_file, "Max Threads: %d\n", OptMaxThreads);
197199
close_log();
198200
}
201+
#endif
202+
}
203+
if (!strcmp(arg[0], "Min_Threads")) // Added 5/22/2013 by Yuri Censor for Firenzina
204+
{
205+
int input = atoi(arg[1]);
206+
OptMinThreads = input;
207+
if (OptMinThreads <= 0)
208+
OptMinThreads = 1;
209+
else if (OptMinThreads > MaxCPUs)
210+
OptMinThreads = MaxCPUs;
211+
Send("Min Threads: %d\n", OptMinThreads);
212+
if (VerboseUCI)
213+
Send("info string Min Threads: %d\n", OptMinThreads);
214+
215+
#ifdef Log
216+
if (WriteLog)
217+
{
218+
log_file = fopen(log_filename, "a");
219+
fprintf(log_file, "Min Threads: %d\n", OptMinThreads);
220+
close_log();
221+
}
199222
#endif
200223
}
201224
if (!strcmp(arg[0], "MultiPV"))
@@ -1814,6 +1837,7 @@ void gen_cfg_file(char *file_name)
18141837
fprintf(fp, "Hash %d\n", DEFAULT_HASH_SIZE);
18151838
fprintf(fp, "Pawn_Hash %d\n", DEFAULT_PAWN_HASH_SIZE);
18161839
fprintf(fp, "Max_Threads %d\n", OptMaxThreads);
1840+
fprintf(fp, "Min_Threads %d\n", OptMinThreads); // Added 5/22/2013 by Yuri Censor for Firenzina
18171841
fprintf(fp, "MultiPV %d\n", DEFAULT_MULTIPV);
18181842
fprintf(fp, "Random_Range %d\n", RandRange);
18191843

src/input.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ UCItype UCIOptions[256] =
9797
#endif
9898

9999
{ "Max_Threads", "SMP", UCISpin, 1, MaxCPUs, MaxCPUs, &OptMaxThreads, &InitSMP },
100+
{ "Min_Threads", "SMP", UCISpin, 1, MaxCPUs, 1, &OptMinThreads, &InitSMP }, // Added 5/22/2013 by Yuri Censor for Firenzina
100101
{ "MultiPV", "System", UCISpin, 1, MAX_MULTIPV, DEFAULT_MULTIPV, &MultiPV, NULL },
101102
// Split Depths
102103
{ "AN_Split_Depth", "SMP", UCISpin, MIN_AN_SPLIT_DEPTH, MAX_AN_SPLIT_DEPTH, DEFAULT_AN_SPLIT_DEPTH, &ANSplitDepth, NULL },
@@ -194,6 +195,7 @@ UCItype BaseUCIOptions[256] =
194195
{ "Hash", "System", UCISpin, 1, MAX_HASH_SIZE, DEFAULT_HASH_SIZE, &CurrentHashSize, &InitHash },
195196
{ "Pawn_Hash", "System", UCISpin, 1, MAX_PAWN_HASH_SIZE, DEFAULT_PAWN_HASH_SIZE, &CurrentPHashSize, &InitPawnHashWrapper },
196197
{ "Max_Threads", "SMP", UCISpin, 1, MaxCPUs, MaxCPUs, &OptMaxThreads, &InitSMP },
198+
{ "Min_Threads", "SMP", UCISpin, 1, MaxCPUs, 1, &OptMinThreads, &InitSMP }, // Added 5/22/2013 by Yuri Censor for Firenzina
197199
{ "MultiPV", "System", UCISpin, 1, MAX_MULTIPV, DEFAULT_MULTIPV, &MultiPV, NULL },
198200
{ "", "", -1, 0, 0, false, NULL, NULL }
199201
};

src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ void InitGlobals()
168168
MultiPV = DEFAULT_MULTIPV;
169169
NumThreads = 1;
170170
OptMaxThreads = MaxCPUs;
171+
OptMinThreads = 1; // Added 5/22/2013 by Yuri Censor for Firenzina
171172
Ponder = false;
172173
RandRange = 20;
173174
SearchIsDone = true;

src/utility.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,25 @@ NumCPUs = get_nprocs();
423423

424424
}
425425

426-
NumThreads = NumCPUs<<1; // Modification by Yuri Censor for Firenzina, 2/16/2013
427-
// Was: NumThreads = NumCPUs;
428-
// Problem: We couldn't have more threads than processors
426+
NumThreads = NumCPUs;
429427
if(NumThreads > MaxCPUs)
430428
NumThreads = MaxCPUs;
431-
432-
if(NumThreads > OptMaxThreads)
433-
NumThreads = OptMaxThreads;
434-
429+
if (OptMaxThreads > OptMinThreads) // normal; Added 5/22/2013 by Yuri Censor for Firenzina
430+
{
431+
if(NumThreads > OptMaxThreads)
432+
NumThreads = OptMaxThreads;
433+
else if (NumThreads < OptMinThreads) // Added 5/22/2013 by Yuri Censor for Firenzina
434+
NumThreads = OptMinThreads;
435+
}
436+
else if (OptMinThreads > OptMaxThreads) // abnormal; Added 5/22/2013 by Yuri Censor for Firenzina
437+
{
438+
if(NumThreads > OptMinThreads) // Treat OptMinThreads as OptMaxThreads and vice versa
439+
NumThreads = OptMinThreads;
440+
else if (NumThreads < OptMaxThreads)
441+
NumThreads = OptMaxThreads;
442+
}
443+
else // if (OptMinThreads == OptMaxThreads)
444+
NumThreads = OptMaxThreads;
435445

436446
if(NumThreads > 1)
437447
{

0 commit comments

Comments
 (0)