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 5... | Line 5... | ||
| 5 | #if defined(UNIX) |
5 | #if defined(UNIX) |
| 6 | # include <unistd.h> |
6 | # include <unistd.h> |
| 7 | # include <signal.h> |
7 | # include <signal.h> |
| 8 | #endif |
8 | #endif |
| 9 | #include "epdglue.h" |
9 | #include "epdglue.h" |
| - | 10 | #include "tbprobe.h" |
|
| 10 | /* last modified |
11 | /* last modified 08/03/16 */ |
| 11 | /* |
12 | /* |
| 12 | ******************************************************************************* |
13 | ******************************************************************************* |
| 13 | * * |
14 | * * |
| 14 | * Option() is used to handle user input necessary to control/customize the * |
15 | * Option() is used to handle user input necessary to control/customize the * |
| 15 | * program. It performs all functions excepting chess move input which is * |
16 | * program. It performs all functions excepting chess move input which is * |
| Line 123... | Line 124... | ||
| 123 | if (nargs != 6) { |
124 | if (nargs != 6) { |
| 124 | printf("usage: adaptive NPS hmin hmax pmin pmax\n"); |
125 | printf("usage: adaptive NPS hmin hmax pmin pmax\n"); |
| 125 | return 1; |
126 | return 1; |
| 126 | } |
127 | } |
| 127 | if (nargs > 1) { |
128 | if (nargs > 1) { |
| 128 | adaptive_hash = |
129 | adaptive_hash = atoiKMB(args[1]); |
| 129 | adaptive_hash_min = |
130 | adaptive_hash_min = atoiKMB(args[2]); |
| 130 | adaptive_hash_max = |
131 | adaptive_hash_max = atoiKMB(args[3]); |
| 131 | adaptive_hashp_min = |
132 | adaptive_hashp_min = atoiKMB(args[4]); |
| 132 | adaptive_hashp_max = |
133 | adaptive_hashp_max = atoiKMB(args[5]); |
| 133 | } |
134 | } |
| 134 | Print(32, "adaptive estimated NPS = %s\n", DisplayKMB(adaptive_hash, 1)); |
135 | Print(32, "adaptive estimated NPS = %s\n", DisplayKMB(adaptive_hash, 1)); |
| 135 | Print(32, "adaptive minimum hsize = %s\n", DisplayKMB(adaptive_hash_min, |
136 | Print(32, "adaptive minimum hsize = %s\n", DisplayKMB(adaptive_hash_min, |
| 136 | 1)); |
137 | 1)); |
| 137 | Print(32, "adaptive maximum hsize = %s\n", DisplayKMB(adaptive_hash_max, |
138 | Print(32, "adaptive maximum hsize = %s\n", DisplayKMB(adaptive_hash_max, |
| Line 240... | Line 241... | ||
| 240 | * it up. * |
241 | * it up. * |
| 241 | * * |
242 | * * |
| 242 | ************************************************************ |
243 | ************************************************************ |
| 243 | */ |
244 | */ |
| 244 | else if (OptionMatch("bench", *args)) { |
245 | else if (OptionMatch("bench", *args)) { |
| 245 | int mod = 0 |
246 | int mod = 0; |
| 246 | 247 | ||
| 247 | if (nargs > 1) |
248 | if (nargs > 1) |
| 248 | mod = atoi(args[1]); |
249 | mod = atoi(args[1]); |
| 249 |
|
250 | (void) Bench(mod, 0); |
| 250 | Print(32, "time used = %s\n", DisplayTime(time)); |
- | |
| 251 | } |
- | |
| 252 | /* |
- | |
| 253 | *************************************************************** |
- | |
| 254 | * * |
- | |
| 255 | * "pgo" runs an internal performance benchmark used for PGO. * |
- | |
| 256 | * An optional second argument can increase or decrease * |
- | |
| 257 | * the time it takes. "pgo 1" increases the default * |
- | |
| 258 | * by one ply, and "pgo -1" reduces the depth to speed * |
- | |
| 259 | * it up. * |
- | |
| 260 | * * |
- | |
| 261 | ************************************************************ |
- | |
| 262 | */ |
- | |
| 263 | else if (OptionMatch("pgo", *args)) { |
- | |
| 264 | int mod = 0, time; |
- | |
| 265 | - | ||
| 266 | if (nargs > 1) |
- | |
| 267 | mod = atoi(args[1]); |
- | |
| 268 | time = Bench_PGO(mod, 0); |
- | |
| 269 | Print(32, "time used = %s\n", DisplayTime(time)); |
- | |
| 270 | } |
251 | } |
| 271 | /* |
252 | /* |
| 272 | ************************************************************ |
253 | ************************************************************ |
| 273 | * * |
254 | * * |
| 274 | * "bk" book command from xboard sends the suggested book * |
255 | * "bk" book command from xboard sends the suggested book * |
| Line 341... | Line 322... | ||
| 341 | ************************************************************ |
322 | ************************************************************ |
| 342 | */ |
323 | */ |
| 343 | else if (OptionMatch("bookw", *args)) { |
324 | else if (OptionMatch("bookw", *args)) { |
| 344 | if (nargs > 1) { |
325 | if (nargs > 1) { |
| 345 | if (OptionMatch("frequency", args[1])) |
326 | if (OptionMatch("frequency", args[1])) |
| 346 | book_weight_freq = |
327 | book_weight_freq = atof(args[2]); |
| 347 | else if (OptionMatch("evaluation", args[1])) |
328 | else if (OptionMatch("evaluation", args[1])) |
| 348 | book_weight_eval = |
329 | book_weight_eval = atof(args[2]); |
| 349 | else if (OptionMatch("learning", args[1])) |
330 | else if (OptionMatch("learning", args[1])) |
| 350 | book_weight_learn = |
331 | book_weight_learn = atof(args[2]); |
| 351 | } else { |
332 | } else { |
| 352 | Print(32, "frequency (freq)..............%4.2f\n", book_weight_freq); |
333 | Print(32, "frequency (freq)..............%4.2f\n", book_weight_freq); |
| 353 | Print(32, "static evaluation (eval)......%4.2f\n", book_weight_eval); |
334 | Print(32, "static evaluation (eval)......%4.2f\n", book_weight_eval); |
| 354 | Print(32, "learning (learn)..............%4.2f\n", book_weight_learn); |
335 | Print(32, "learning (learn)..............%4.2f\n", book_weight_learn); |
| 355 | } |
336 | } |
| 356 | } |
337 | } |
| 357 | /* |
- | |
| 358 | ************************************************************ |
- | |
| 359 | * * |
- | |
| 360 | * "cache" is used to set the EGTB cache size. As always * |
- | |
| 361 | * bigger is better. The default is 1mb. Sizes can be * |
- | |
| 362 | * specified in bytes, Kbytes or Mbytes as with the hash * |
- | |
| 363 | * commands. * |
- | |
| 364 | * * |
- | |
| 365 | ************************************************************ |
- | |
| 366 | */ |
- | |
| 367 | #if !defined(NOEGTB) |
- | |
| 368 | else if (OptionMatch("cache", *args)) { |
- | |
| 369 | EGTB_cache_size = (size_t) atoiKMB(args[1]); // Pierre-Marie Baty -- added type cast |
- | |
| 370 | if (EGTB_cache) |
- | |
| 371 | free(EGTB_cache); |
- | |
| 372 | EGTB_cache = malloc(EGTB_cache_size); |
- | |
| 373 | if (!EGTB_cache) { |
- | |
| 374 | Print(2095, |
- | |
| 375 | "ERROR: unable to malloc specified cache size, using default\n"); |
- | |
| 376 | EGTB_cache = malloc(4096 * 4096); |
- | |
| 377 | } |
- | |
| 378 | Print(32, "EGTB cache memory = %s bytes.\n", DisplayKMB(EGTB_cache_size, |
- | |
| 379 | 1)); |
- | |
| 380 | FTbSetCacheSize(EGTB_cache, EGTB_cache_size); |
- | |
| 381 | } |
- | |
| 382 | #endif |
- | |
| 383 | /* |
338 | /* |
| 384 | ************************************************************ |
339 | ************************************************************ |
| 385 | * * |
340 | * * |
| 386 | * "clock" command displays chess clock. * |
341 | * "clock" command displays chess clock. * |
| 387 | * * |
342 | * * |
| Line 587... | Line 542... | ||
| 587 | Option(tree); |
542 | Option(tree); |
| 588 | } |
543 | } |
| 589 | /* |
544 | /* |
| 590 | ************************************************************ |
545 | ************************************************************ |
| 591 | * * |
546 | * * |
| 592 | * "egtb" command enables |
547 | * "egtb" command enables syzygy endgame database tables. * |
| 593 | * the number of pieces available for probing. * |
- | |
| 594 | * * |
548 | * * |
| 595 | ************************************************************ |
549 | ************************************************************ |
| 596 | */ |
550 | */ |
| 597 | #if !defined(NOEGTB) |
- | |
| 598 | else if (OptionMatch("egtb", *args)) { |
551 | else if (OptionMatch("egtb", *args)) { |
| 599 |
|
552 | #if defined(SYZYGY) |
| 600 | Print(32, "EGTB access enabled\n"); |
- | |
| 601 | Print(32, "using tbpath=%s\n", tb_path); |
- | |
| 602 | EGTBlimit = IInitializeTb(tb_path); |
- | |
| 603 | Print(32, "%d piece tablebase files found\n", EGTBlimit); |
- | |
| 604 |
|
553 | if (!strcmp(args[1], "off")) |
| 605 |
|
554 | EGTBlimit = 0; |
| 606 | "%dkb of RAM used for TB indices and decompression tables\n", |
- | |
| 607 | (cbEGTBCompBytes + 1023) / 1024); |
- | |
| 608 |
|
555 | else { |
| 609 |
|
556 | if (!EGTB_setup) { |
| 610 | EGTB_cache = malloc(EGTB_cache_size); |
- | |
| 611 |
|
557 | tb_init(tb_path); |
| 612 | Print(32, "ERROR EGTB cache malloc failed\n"); |
- | |
| 613 | EGTB_cache = malloc(4096 * 4096); |
- | |
| 614 | } else |
- | |
| 615 | FTbSetCacheSize(EGTB_cache, EGTB_cache_size); |
- | |
| 616 | EGTB_setup = 1; |
558 | EGTB_setup = 1; |
| 617 | } |
559 | } |
| 618 | } else { |
- | |
| 619 | if (nargs == 1) |
- | |
| 620 | EGTBPV(tree, game_wtm); |
- | |
| 621 | else if (nargs == 2) |
- | |
| 622 |
|
560 | EGTBlimit = TB_LARGEST; |
| 623 | } |
561 | } |
| - | 562 | if (EGTBlimit) |
|
| - | 563 | Print(32, "SYZYGY EGTB access enabled, %d piece TBs found\n", |
|
| - | 564 | TB_LARGEST); |
|
| - | 565 | else |
|
| - | 566 | Print(32, "SYZYGY EGTB access disabled.\n"); |
|
| - | 567 | #else |
|
| - | 568 | Print(32, "SYZYGY support not included (no -DSYZYGY)\n"); |
|
| - | 569 | #endif |
|
| 624 | } |
570 | } |
| 625 | /* |
571 | /* |
| 626 | ************************************************************ |
572 | ************************************************************ |
| 627 | * * |
573 | * * |
| 628 | * "egtbd" command sets the probe depth limit. If the * |
574 | * "egtbd" command sets the probe depth limit. If the * |
| 629 | * remaining depth is < this limit, probes are not done to * |
575 | * remaining depth is < this limit, probes are not done to * |
| 630 | * avoid slowing the search unnecessarily. * |
576 | * avoid slowing the search unnecessarily. * |
| 631 | * * |
577 | * * |
| 632 | ************************************************************ |
578 | ************************************************************ |
| 633 | */ |
579 | */ |
| - | 580 | #if defined(SYZYGY) |
|
| 634 | else if (OptionMatch("egtbd", *args)) { |
581 | else if (OptionMatch("egtbd", *args)) { |
| 635 | if (nargs > 1) |
582 | if (nargs > 1) |
| 636 | EGTB_depth = atoi(args[1]); |
583 | EGTB_depth = atoi(args[1]); |
| 637 | Print(32, "EGTB probe depth set to %d\n", EGTB_depth); |
584 | Print(32, "EGTB probe depth set to %d\n", EGTB_depth); |
| 638 | } |
585 | } |
| Line 921... | Line 868... | ||
| 921 | return 2; |
868 | return 2; |
| 922 | if (nargs > 1) { |
869 | if (nargs > 1) { |
| 923 | allow_memory = 0; |
870 | allow_memory = 0; |
| 924 | if (xboard) |
871 | if (xboard) |
| 925 | Print(4095, "Warning-- xboard 'memory' option disabled\n"); |
872 | Print(4095, "Warning-- xboard 'memory' option disabled\n"); |
| 926 | new_hash_size = |
873 | new_hash_size = atoiKMB(args[1]); |
| 927 | if (new_hash_size < 64 * 1024) { |
874 | if (new_hash_size < 64 * 1024) { |
| 928 | printf("ERROR. Minimum hash table size is 64K bytes.\n"); |
875 | printf("ERROR. Minimum hash table size is 64K bytes.\n"); |
| 929 | return 1; |
876 | return 1; |
| 930 | } |
877 | } |
| 931 | hash_table_size = ((1ull) << MSB(new_hash_size)) / 16; |
878 | hash_table_size = ((1ull) << MSB(new_hash_size)) / 16; |
| 932 | AlignedRemalloc |
879 | AlignedRemalloc((void *) &hash_table, 64, |
| 933 | hash_table_size * sizeof(HASH_ENTRY)); |
880 | hash_table_size * sizeof(HASH_ENTRY)); |
| 934 | if (!hash_table) { |
881 | if (!hash_table) { |
| 935 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
882 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
| 936 | exit(1); |
883 | exit(1); |
| 937 | } |
884 | } |
| Line 963... | Line 910... | ||
| 963 | size_t old_hash_size = hash_path_size, new_hash_size; |
910 | size_t old_hash_size = hash_path_size, new_hash_size; |
| 964 | 911 | ||
| 965 | if (thinking || pondering) |
912 | if (thinking || pondering) |
| 966 | return 2; |
913 | return 2; |
| 967 | if (nargs > 1) { |
914 | if (nargs > 1) { |
| 968 | new_hash_size = |
915 | new_hash_size = atoiKMB(args[1]); |
| 969 | if (new_hash_size < 64 * 1024) { |
916 | if (new_hash_size < 64 * 1024) { |
| 970 | printf("ERROR. Minimum phash table size is 64K bytes.\n"); |
917 | printf("ERROR. Minimum phash table size is 64K bytes.\n"); |
| 971 | return 1; |
918 | return 1; |
| 972 | } |
919 | } |
| 973 | hash_path_size = ((1ull) << MSB(new_hash_size / sizeof(HPATH_ENTRY))); |
920 | hash_path_size = ((1ull) << MSB(new_hash_size / sizeof(HPATH_ENTRY))); |
| 974 | AlignedRemalloc |
921 | AlignedRemalloc((void *) &hash_path, 64, |
| 975 | sizeof(HPATH_ENTRY) * hash_path_size); |
922 | sizeof(HPATH_ENTRY) * hash_path_size); |
| 976 | if (!hash_path) { |
923 | if (!hash_path) { |
| 977 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
924 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
| 978 | hash_path_size = 0; |
925 | hash_path_size = 0; |
| 979 | hash_path = 0; |
926 | hash_path = 0; |
| Line 999... | Line 946... | ||
| 999 | return 2; |
946 | return 2; |
| 1000 | if (nargs > 1) { |
947 | if (nargs > 1) { |
| 1001 | allow_memory = 0; |
948 | allow_memory = 0; |
| 1002 | if (xboard) |
949 | if (xboard) |
| 1003 | Print(4095, "Warning-- xboard 'memory' option disabled\n"); |
950 | Print(4095, "Warning-- xboard 'memory' option disabled\n"); |
| 1004 | new_hash_size = |
951 | new_hash_size = atoiKMB(args[1]); |
| 1005 | if (new_hash_size < 16 * 1024) { |
952 | if (new_hash_size < 16 * 1024) { |
| 1006 | printf("ERROR. Minimum pawn hash table size is 16K bytes.\n"); |
953 | printf("ERROR. Minimum pawn hash table size is 16K bytes.\n"); |
| 1007 | return 1; |
954 | return 1; |
| 1008 | } |
955 | } |
| 1009 | pawn_hash_table_size = |
956 | pawn_hash_table_size = |
| 1010 | 1ull << MSB(new_hash_size / sizeof(PAWN_HASH_ENTRY)); |
957 | 1ull << MSB(new_hash_size / sizeof(PAWN_HASH_ENTRY)); |
| 1011 | AlignedRemalloc |
958 | AlignedRemalloc((void *) &pawn_hash_table, 64, |
| 1012 | sizeof(PAWN_HASH_ENTRY) * pawn_hash_table_size); |
959 | sizeof(PAWN_HASH_ENTRY) * pawn_hash_table_size); |
| 1013 | if (!pawn_hash_table) { |
960 | if (!pawn_hash_table) { |
| 1014 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
961 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
| 1015 | exit(1); |
962 | exit(1); |
| 1016 | } |
963 | } |
| Line 1018... | Line 965... | ||
| 1018 | } |
965 | } |
| 1019 | Print(32, "pawn hash table memory = %s bytes", |
966 | Print(32, "pawn hash table memory = %s bytes", |
| 1020 | DisplayKMB(pawn_hash_table_size * sizeof(PAWN_HASH_ENTRY), 1)); |
967 | DisplayKMB(pawn_hash_table_size * sizeof(PAWN_HASH_ENTRY), 1)); |
| 1021 | Print(32, " (%s entries).\n", DisplayKMB(pawn_hash_table_size, 1)); |
968 | Print(32, " (%s entries).\n", DisplayKMB(pawn_hash_table_size, 1)); |
| 1022 | InitializeHashTables(old_hash_size != pawn_hash_table_size); |
969 | InitializeHashTables(old_hash_size != pawn_hash_table_size); |
| 1023 | } |
- | |
| 1024 | /* |
- | |
| 1025 | ************************************************************ |
- | |
| 1026 | * * |
- | |
| 1027 | * "hashe" command controls the eval hash table size. * |
- | |
| 1028 | * * |
- | |
| 1029 | ************************************************************ |
- | |
| 1030 | */ |
- | |
| 1031 | else if (OptionMatch("hashe", *args)) { |
- | |
| 1032 | size_t old_hash_size = eval_hash_table_size, new_hash_size; |
- | |
| 1033 | - | ||
| 1034 | if (thinking || pondering) |
- | |
| 1035 | return 2; |
- | |
| 1036 | if (nargs > 1) { |
- | |
| 1037 | allow_memory = 0; |
- | |
| 1038 | if (xboard) |
- | |
| 1039 | Print(4095, "Warning-- xboard 'memory' option disabled\n"); |
- | |
| 1040 | new_hash_size = (size_t) atoiKMB(args[1]); // Pierre-Marie Baty -- added type cast |
- | |
| 1041 | if (new_hash_size < 16 * 1024) { |
- | |
| 1042 | printf("ERROR. Minimum eval hash table size is 16K bytes.\n"); |
- | |
| 1043 | return 1; |
- | |
| 1044 | } |
- | |
| 1045 | eval_hash_table_size = 1ull << MSB(new_hash_size / sizeof(uint64_t)); |
- | |
| 1046 | AlignedRemalloc((void *) ((void *) &eval_hash_table), 64, |
- | |
| 1047 | sizeof(uint64_t) * eval_hash_table_size); |
- | |
| 1048 | if (!eval_hash_table) { |
- | |
| 1049 | printf("AlignedRemalloc() failed, not enough memory.\n"); |
- | |
| 1050 | exit(1); |
- | |
| 1051 | } |
- | |
| 1052 | eval_hash_mask = eval_hash_table_size - 1; |
- | |
| 1053 | } |
- | |
| 1054 | Print(32, "eval hash table memory = %s bytes", |
- | |
| 1055 | DisplayKMB(eval_hash_table_size * sizeof(uint64_t), 1)); |
- | |
| 1056 | Print(32, " (%s entries).\n", DisplayKMB(eval_hash_table_size, 1)); |
- | |
| 1057 | InitializeHashTables(old_hash_size != eval_hash_table_size); |
- | |
| 1058 | } |
970 | } |
| 1059 | /* |
971 | /* |
| 1060 | ************************************************************ |
972 | ************************************************************ |
| 1061 | * * |
973 | * * |
| 1062 | * "help" command lists commands/options. * |
974 | * "help" command lists commands/options. * |
| Line 1155... | Line 1067... | ||
| 1155 | Print(32, "hash table memory = %s bytes", DisplayKMB(hash_table_size * 64, |
1067 | Print(32, "hash table memory = %s bytes", DisplayKMB(hash_table_size * 64, |
| 1156 | 1)); |
1068 | 1)); |
| 1157 | Print(32, " (%s entries).\n", DisplayKMB(hash_table_size * 5, 0)); |
1069 | Print(32, " (%s entries).\n", DisplayKMB(hash_table_size * 5, 0)); |
| 1158 | Print(32, "pawn hash table memory = %5s\n", |
1070 | Print(32, "pawn hash table memory = %5s\n", |
| 1159 | DisplayKMB(pawn_hash_table_size * sizeof(PAWN_HASH_ENTRY), 1)); |
1071 | DisplayKMB(pawn_hash_table_size * sizeof(PAWN_HASH_ENTRY), 1)); |
| 1160 | #if !defined(NOEGTB) |
- | |
| 1161 | Print(32, "EGTB cache memory = %5s\n", DisplayKMB(EGTB_cache_size, |
- | |
| 1162 | 1)); |
- | |
| 1163 | #endif |
- | |
| 1164 | if (!tc_sudden_death) { |
1072 | if (!tc_sudden_death) { |
| 1165 | Print(32, "%d moves/%d minutes %d seconds primary time control\n", |
1073 | Print(32, "%d moves/%d minutes %d seconds primary time control\n", |
| 1166 | tc_moves, tc_time / 6000, (tc_time / 100) % 60); |
1074 | tc_moves, tc_time / 6000, (tc_time / 100) % 60); |
| 1167 | Print(32, "%d moves/%d minutes %d seconds secondary time control\n", |
1075 | Print(32, "%d moves/%d minutes %d seconds secondary time control\n", |
| 1168 | tc_secondary_moves, tc_secondary_time / 6000, |
1076 | tc_secondary_moves, tc_secondary_time / 6000, |
| Line 1308... | Line 1216... | ||
| 1308 | int optimal_hash_size; |
1216 | int optimal_hash_size; |
| 1309 | 1217 | ||
| 1310 | TimeSet(think); |
1218 | TimeSet(think); |
| 1311 | time_limit /= 100; |
1219 | time_limit /= 100; |
| 1312 | positions_per_move = time_limit * adaptive_hash / 16; |
1220 | positions_per_move = time_limit * adaptive_hash / 16; |
| 1313 | optimal_hash_size = |
1221 | optimal_hash_size = positions_per_move * 16; |
| 1314 | printf("optimal=%d\n", optimal_hash_size); |
1222 | printf("optimal=%d\n", optimal_hash_size); |
| 1315 | optimal_hash_size = Max(optimal_hash_size, |
1223 | optimal_hash_size = Max(optimal_hash_size, adaptive_hash_min); |
| 1316 | optimal_hash_size = Min(optimal_hash_size, |
1224 | optimal_hash_size = Min(optimal_hash_size, adaptive_hash_max); |
| 1317 | sprintf(buffer, "hash=%d\n", optimal_hash_size); |
1225 | sprintf(buffer, "hash=%d\n", optimal_hash_size); |
| 1318 | Option(tree); |
1226 | Option(tree); |
| 1319 | percent = |
1227 | percent = |
| 1320 | (float) (optimal_hash_size - |
1228 | (float) (optimal_hash_size - |
| 1321 | adaptive_hash_min) / (float) (adaptive_hash_max - |
1229 | adaptive_hash_min) / (float) (adaptive_hash_max - |
| 1322 | adaptive_hash_min); |
1230 | adaptive_hash_min); |
| 1323 | optimal_hash_size = |
1231 | optimal_hash_size = |
| 1324 |
|
1232 | adaptive_hashp_min + percent * (adaptive_hashp_max - |
| 1325 | adaptive_hashp_min |
1233 | adaptive_hashp_min); |
| 1326 | optimal_hash_size = Max(optimal_hash_size, |
1234 | optimal_hash_size = Max(optimal_hash_size, adaptive_hashp_min); |
| 1327 | sprintf(buffer, "hashp=%d\n", optimal_hash_size); |
1235 | sprintf(buffer, "hashp=%d\n", optimal_hash_size); |
| 1328 | Option(tree); |
1236 | Option(tree); |
| 1329 | } |
1237 | } |
| 1330 | } |
1238 | } |
| 1331 | /* |
1239 | /* |
| Line 1513... | Line 1421... | ||
| 1513 | } |
1421 | } |
| 1514 | Print(32, "\n"); |
1422 | Print(32, "\n"); |
| 1515 | } |
1423 | } |
| 1516 | } |
1424 | } |
| 1517 | } |
1425 | } |
| - | 1426 | } |
|
| - | 1427 | /* |
|
| - | 1428 | ************************************************************ |
|
| - | 1429 | * * |
|
| - | 1430 | * "lmp" command sets the formla parameters that produce * |
|
| - | 1431 | * LMP pruning bounds array. * |
|
| - | 1432 | * * |
|
| - | 1433 | * lmp <maxdepth> <base> <scale> * |
|
| - | 1434 | * * |
|
| - | 1435 | * <maxdepth> is the max depth at which LMP is done. * |
|
| - | 1436 | * * |
|
| - | 1437 | * <base> is the base pruning move count. The function is * |
|
| - | 1438 | * an exponential of the form x = base + f(y). The * |
|
| - | 1439 | * default is currently 3. * |
|
| - | 1440 | * * |
|
| - | 1441 | * <scale> is the exponent of the exponential function. * |
|
| - | 1442 | * larger numbers produce more conservative (larger) move * |
|
| - | 1443 | * counts. Smaller values are more aggressive. The * |
|
| - | 1444 | * default is currently 1.9. * |
|
| - | 1445 | * * |
|
| - | 1446 | ************************************************************ |
|
| - | 1447 | */ |
|
| - | 1448 | else if (OptionMatch("lmp", *args)) { |
|
| - | 1449 | int i; |
|
| - | 1450 | ||
| - | 1451 | if ((nargs > 1 && nargs < 4) || nargs > 4) { |
|
| - | 1452 | printf("usage: lmp <maxdepth> <base> <scale>\n"); |
|
| - | 1453 | return 1; |
|
| - | 1454 | } |
|
| - | 1455 | if (nargs > 1) { |
|
| - | 1456 | LMP_depth = atoi(args[1]); |
|
| - | 1457 | LMP_base = atoi(args[2]); |
|
| - | 1458 | LMP_scale = atof(args[3]); |
|
| - | 1459 | InitializeLMP(); |
|
| - | 1460 | } |
|
| - | 1461 | Print(32, "LMP depth=%d base=%d scale=%f\n", LMP_depth, LMP_base, |
|
| - | 1462 | LMP_scale); |
|
| - | 1463 | Print(32, "depth: "); |
|
| - | 1464 | for (i = 1; i < 16; i++) |
|
| - | 1465 | Print(32, "%4d", i); |
|
| - | 1466 | Print(32, "\n"); |
|
| - | 1467 | Print(32, "movcnt: "); |
|
| - | 1468 | for (i = 1; i < 16; i++) |
|
| - | 1469 | Print(32, "%4d", LMP[i]); |
|
| - | 1470 | Print(32, "\n"); |
|
| 1518 | } |
1471 | } |
| 1519 | /* |
1472 | /* |
| 1520 | ************************************************************ |
1473 | ************************************************************ |
| 1521 | * * |
1474 | * * |
| 1522 | * "lmr" command sets the formla parameters that produce * |
1475 | * "lmr" command sets the formla parameters that produce * |
| Line 1562... | Line 1515... | ||
| 1562 | LMR_min = atoi(args[1]); |
1515 | LMR_min = atoi(args[1]); |
| 1563 | LMR_max = Min(atoi(args[2]), 15); |
1516 | LMR_max = Min(atoi(args[2]), 15); |
| 1564 | LMR_db = atof(args[3]); |
1517 | LMR_db = atof(args[3]); |
| 1565 | LMR_mb = atof(args[4]); |
1518 | LMR_mb = atof(args[4]); |
| 1566 | LMR_s = atof(args[5]); |
1519 | LMR_s = atof(args[5]); |
| 1567 |
|
1520 | InitializeLMR(); |
| 1568 | } |
1521 | } |
| 1569 | if (nargs > 6) { |
1522 | if (nargs > 6) { |
| 1570 | char *axis = "|||||||||||depth left|||||||||||"; |
1523 | char *axis = "|||||||||||depth left|||||||||||"; |
| 1571 | 1524 | ||
| 1572 | Print(32, |
1525 | Print(32, |
| Line 1583... | Line 1536... | ||
| 1583 | for (j = 0; j < 64; j += 1) |
1536 | for (j = 0; j < 64; j += 1) |
| 1584 | Print(32, " %2d", LMR[i][j]); |
1537 | Print(32, " %2d", LMR[i][j]); |
| 1585 | Print(32, "\n"); |
1538 | Print(32, "\n"); |
| 1586 | } |
1539 | } |
| 1587 | } else { |
1540 | } else { |
| 1588 | - | ||
| 1589 | char *axis = "||depth left|||"; |
1541 | char *axis = "||depth left|||"; |
| - | 1542 | ||
| 1590 | Print(32, |
1543 | Print(32, |
| 1591 | "LMR values: %d(min) %d(max) %.2f(depth) %.2f(moves) %.2f(scale).\n", |
1544 | "LMR values: %d(min) %d(max) %.2f(depth) %.2f(moves) %.2f(scale).\n", |
| 1592 | LMR_min, LMR_max, LMR_db, LMR_mb, LMR_s); |
1545 | LMR_min, LMR_max, LMR_db, LMR_mb, LMR_s); |
| 1593 | Print(32, "\n LMR reductions[depth][moves]\n"); |
1546 | Print(32, "\n LMR reductions[depth][moves]\n"); |
| 1594 | Print(32, " ----------------------moves searched------------------\n"); |
1547 | Print(32, " ----------------------moves searched------------------\n"); |
| Line 1669... | Line 1622... | ||
| 1669 | if (!strcmp(args[0], "setboard")) { |
1622 | if (!strcmp(args[0], "setboard")) { |
| 1670 | Option(tree); |
1623 | Option(tree); |
| 1671 | break; |
1624 | break; |
| 1672 | } |
1625 | } |
| 1673 | } |
1626 | } |
| - | 1627 | fclose(prob_file); |
|
| 1674 | } |
1628 | } |
| 1675 | /* |
1629 | /* |
| 1676 | ************************************************************ |
1630 | ************************************************************ |
| 1677 | * * |
1631 | * * |
| 1678 | * "log" command turns log on/off, and also lets you view * |
1632 | * "log" command turns log on/off, and also lets you view * |
| Line 1683... | Line 1637... | ||
| 1683 | * to this file instead. * |
1637 | * to this file instead. * |
| 1684 | * * |
1638 | * * |
| 1685 | ************************************************************ |
1639 | ************************************************************ |
| 1686 | */ |
1640 | */ |
| 1687 | else if (OptionMatch("log", *args)) { |
1641 | else if (OptionMatch("log", *args)) { |
| 1688 | FILE *output_file; |
- | |
| 1689 | char filename[64 |
1642 | char filename[64]; |
| 1690 | 1643 | ||
| 1691 | if (nargs < 2) { |
1644 | if (nargs < 2) { |
| 1692 | printf("usage: log on|off|n [filename]\n"); |
1645 | printf("usage: log on|off|n [filename]\n"); |
| 1693 | return 1; |
1646 | return 1; |
| 1694 | } |
1647 | } |
| Line 1706... | Line 1659... | ||
| 1706 | log_file = 0; |
1659 | log_file = 0; |
| 1707 | sprintf(filename, "%s/log.%03d", log_path, log_id - 1); |
1660 | sprintf(filename, "%s/log.%03d", log_path, log_id - 1); |
| 1708 | remove(filename); |
1661 | remove(filename); |
| 1709 | sprintf(filename, "%s/game.%03d", log_path, log_id - 1); |
1662 | sprintf(filename, "%s/game.%03d", log_path, log_id - 1); |
| 1710 | remove(filename); |
1663 | remove(filename); |
| 1711 | } else if (args[1][0] >= '0' && args[1][0] <= '9') |
1664 | } else if (args[1][0] >= '0' && args[1][0] <= '9') |
| 1712 | if (log_id == 0) |
- | |
| 1713 |
|
1665 | log_id = atoi(args[1]); |
| 1714 | } else { |
- | |
| 1715 | char *eof; |
- | |
| 1716 | FILE *log; |
- | |
| 1717 | int nrecs, trecs, lrecs; |
- | |
| 1718 | - | ||
| 1719 | nrecs = atoi(args[1]); |
- | |
| 1720 | output_file = stdout; |
- | |
| 1721 | if (nargs > 2) |
- | |
| 1722 | output_file = fopen(args[2], "w"); |
- | |
| 1723 | log = fopen(log_filename, "r"); |
- | |
| 1724 | for (trecs = 1; trecs < 99999999; trecs++) { |
- | |
| 1725 | eof = fgets(buffer, 128, log); |
- | |
| 1726 | if (eof) { |
- | |
| 1727 | char *delim; |
- | |
| 1728 | - | ||
| 1729 | delim = strchr(buffer, '\n'); |
- | |
| 1730 | if (delim) |
- | |
| 1731 | *delim = 0; |
- | |
| 1732 | delim = strchr(buffer, '\r'); |
- | |
| 1733 | if (delim) |
- | |
| 1734 | *delim = ' '; |
- | |
| 1735 | } else |
- | |
| 1736 | break; |
- | |
| 1737 | } |
- | |
| 1738 | fseek(log, 0, SEEK_SET); |
- | |
| 1739 | for (lrecs = 1; lrecs < trecs - nrecs; lrecs++) { |
- | |
| 1740 | eof = fgets(buffer, 128, log); |
- | |
| 1741 | if (eof) { |
- | |
| 1742 | char *delim; |
- | |
| 1743 | - | ||
| 1744 | delim = strchr(buffer, '\n'); |
- | |
| 1745 | if (delim) |
- | |
| 1746 | *delim = 0; |
- | |
| 1747 | delim = strchr(buffer, '\r'); |
- | |
| 1748 | if (delim) |
- | |
| 1749 | *delim = ' '; |
- | |
| 1750 | } else |
- | |
| 1751 | break; |
- | |
| 1752 | } |
- | |
| 1753 | for (; lrecs < trecs; lrecs++) { |
- | |
| 1754 | eof = fgets(buffer, 128, log); |
- | |
| 1755 | if (eof) { |
- | |
| 1756 | char *delim; |
- | |
| 1757 | - | ||
| 1758 | delim = strchr(buffer, '\n'); |
- | |
| 1759 | if (delim) |
- | |
| 1760 | *delim = 0; |
- | |
| 1761 | delim = strchr(buffer, '\r'); |
- | |
| 1762 | if (delim) |
- | |
| 1763 | *delim = ' '; |
- | |
| 1764 | } else |
- | |
| 1765 | break; |
- | |
| 1766 | fprintf(output_file, "%s\n", buffer); |
- | |
| 1767 | } |
- | |
| 1768 | if (output_file != stdout) |
- | |
| 1769 | fclose(output_file); |
- | |
| 1770 | } |
- | |
| 1771 | } |
1666 | } |
| 1772 | /* |
1667 | /* |
| 1773 | ************************************************************ |
1668 | ************************************************************ |
| 1774 | * * |
1669 | * * |
| 1775 | * "memory" command is used to set the max memory to use * |
1670 | * "memory" command is used to set the max memory to use * |
| Line 1825... | Line 1720... | ||
| 1825 | book_weight_freq = 1.0; |
1720 | book_weight_freq = 1.0; |
| 1826 | book_weight_eval = 0.5; |
1721 | book_weight_eval = 0.5; |
| 1827 | } else if (!strcmp(args[1], "match")) { |
1722 | } else if (!strcmp(args[1], "match")) { |
| 1828 | mode = normal_mode; |
1723 | mode = normal_mode; |
| 1829 | book_weight_learn = 1.0; |
1724 | book_weight_learn = 1.0; |
| 1830 | book_weight_freq = 0. |
1725 | book_weight_freq = 0.2; |
| 1831 | book_weight_eval = 0. |
1726 | book_weight_eval = 0.1; |
| 1832 | } else { |
1727 | } else { |
| 1833 | printf("usage: mode normal|tournament|match\n"); |
1728 | printf("usage: mode normal|tournament|match\n"); |
| 1834 | mode = normal_mode; |
1729 | mode = normal_mode; |
| 1835 | book_weight_learn = 1.0; |
1730 | book_weight_learn = 1.0; |
| 1836 | book_weight_freq = 1.0; |
1731 | book_weight_freq = 1.0; |
| Line 1935... | Line 1830... | ||
| 1935 | * "new" command initializes for a new game. * |
1830 | * "new" command initializes for a new game. * |
| 1936 | * * |
1831 | * * |
| 1937 | ************************************************************ |
1832 | ************************************************************ |
| 1938 | */ |
1833 | */ |
| 1939 | else if (OptionMatch("new", *args)) { |
1834 | else if (OptionMatch("new", *args)) { |
| 1940 | new_game = 1; |
- | |
| 1941 | if (thinking || pondering) |
- | |
| 1942 | return 3; |
- | |
| 1943 | if (smp_max_threads) { |
- | |
| 1944 | int proc; |
- | |
| 1945 | - | ||
| 1946 |
|
1835 | Print(4095, "NOTICE: ""new"" command not implemented, please exit and\n"); |
| 1947 | for (proc = 1; proc < CPUS; proc++) |
- | |
| 1948 |
|
1836 | Print(4095, "restart crafty to re-initialize everything for a new game\n"); |
| 1949 | } |
- | |
| 1950 | NewGame(0); |
- | |
| 1951 | return |
1837 | return 1; |
| 1952 | } |
1838 | } |
| 1953 | /* |
1839 | /* |
| 1954 | ************************************************************ |
1840 | ************************************************************ |
| 1955 | * * |
1841 | * * |
| 1956 | * "noise" command sets a minimum limit on time searched * |
1842 | * "noise" command sets a minimum limit on time searched * |
| Line 1965... | Line 1851... | ||
| 1965 | else if (OptionMatch("noise", *args)) { |
1851 | else if (OptionMatch("noise", *args)) { |
| 1966 | if (nargs < 2) { |
1852 | if (nargs < 2) { |
| 1967 | printf("usage: noise <n>\n"); |
1853 | printf("usage: noise <n>\n"); |
| 1968 | return 1; |
1854 | return 1; |
| 1969 | } |
1855 | } |
| 1970 | noise_level = |
1856 | noise_level = atof(args[1]) * 100; |
| 1971 | Print(32, "noise level set to %.2f seconds.\n", |
1857 | Print(32, "noise level set to %.2f seconds.\n", |
| 1972 | (float) noise_level / 100.0); |
1858 | (float) noise_level / 100.0); |
| 1973 | } |
1859 | } |
| 1974 | /* |
1860 | /* |
| 1975 | ************************************************************ |
1861 | ************************************************************ |
| Line 2251... | Line 2137... | ||
| 2251 | if (!strchr(args[1], '(')) { |
2137 | if (!strchr(args[1], '(')) { |
| 2252 | if (strstr(args[0], "bookpath")) |
2138 | if (strstr(args[0], "bookpath")) |
| 2253 | strcpy(book_path, args[1]); |
2139 | strcpy(book_path, args[1]); |
| 2254 | else if (strstr(args[0], "logpath")) |
2140 | else if (strstr(args[0], "logpath")) |
| 2255 | strcpy(log_path, args[1]); |
2141 | strcpy(log_path, args[1]); |
| 2256 | #if |
2142 | #if defined(SYZYGY) |
| 2257 | else if (strstr(args[0], "tbpath")) |
2143 | else if (strstr(args[0], "tbpath")) |
| 2258 | strcpy(tb_path, args[1]); |
2144 | strcpy(tb_path, args[1]); |
| 2259 | #endif |
2145 | #endif |
| - | 2146 | ||
| 2260 | } else { |
2147 | } else { |
| 2261 | if (strchr(args[1], ')')) { |
2148 | if (strchr(args[1], ')')) { |
| 2262 | *strchr(args[1], ')') = 0; |
2149 | *strchr(args[1], ')') = 0; |
| 2263 | if (strstr(args[0], "bookpath")) |
2150 | if (strstr(args[0], "bookpath")) |
| 2264 | strcpy(book_path, args[1] + 1); |
2151 | strcpy(book_path, args[1] + 1); |
| 2265 | else if (strstr(args[0], "logpath")) |
2152 | else if (strstr(args[0], "logpath")) |
| 2266 | strcpy(log_path, args[1] + 1); |
2153 | strcpy(log_path, args[1] + 1); |
| 2267 | #if |
2154 | #if defined(SYZYGY) |
| 2268 | else if (strstr(args[0], "tbpath")) |
2155 | else if (strstr(args[0], "tbpath")) |
| 2269 | strcpy(tb_path, args[1] + 1); |
2156 | strcpy(tb_path, args[1] + 1); |
| 2270 | #endif |
2157 | #endif |
| 2271 | } else |
2158 | } else |
| 2272 | Print(4095, "ERROR multiple paths must be enclosed in ( and )\n"); |
2159 | Print(4095, "ERROR multiple paths must be enclosed in ( and )\n"); |
| Line 2485... | Line 2372... | ||
| 2485 | int pversion = atoi(args[1]); |
2372 | int pversion = atoi(args[1]); |
| 2486 | 2373 | ||
| 2487 | if (pversion >= 1 && pversion <= 3) { |
2374 | if (pversion >= 1 && pversion <= 3) { |
| 2488 | if (pversion >= 2) { |
2375 | if (pversion >= 2) { |
| 2489 | Print(-1, "feature ping=1 setboard=1 san=1 time=1 draw=1\n"); |
2376 | Print(-1, "feature ping=1 setboard=1 san=1 time=1 draw=1\n"); |
| 2490 | Print(-1, "feature sigint=0 sigterm=0 |
2377 | Print(-1, "feature sigint=0 sigterm=0 reuse=0 analyze=1\n"); |
| 2491 | Print(-1, "feature myname=\"Crafty-%s\" name=1\n", version); |
2378 | Print(-1, "feature myname=\"Crafty-%s\" name=1\n", version); |
| 2492 | Print(-1, "feature playother=1 colors=0 memory=%d\n", allow_memory); |
2379 | Print(-1, "feature playother=1 colors=0 memory=%d\n", allow_memory); |
| 2493 | #if (CPUS > 1) |
2380 | #if (CPUS > 1) |
| 2494 | Print(-1, "feature smp=%d\n", allow_cores); |
2381 | Print(-1, "feature smp=%d\n", allow_cores); |
| 2495 | #endif |
2382 | #endif |
| Line 3211... | Line 3098... | ||
| 3211 | mgw = tree->score_mg - mgw; |
3098 | mgw = tree->score_mg - mgw; |
| 3212 | egw = tree->score_eg - egw; |
3099 | egw = tree->score_eg - egw; |
| 3213 | tb = (mgb * phase + egb * (62 - phase)) / 62; |
3100 | tb = (mgb * phase + egb * (62 - phase)) / 62; |
| 3214 | tw = (mgw * phase + egw * (62 - phase)) / 62; |
3101 | tw = (mgw * phase + egw * (62 - phase)) / 62; |
| 3215 | Print(32, "kings..........%s |", DisplayEvaluation(tb + tw, 1)); |
3102 | Print(32, "kings..........%s |", DisplayEvaluation(tb + tw, 1)); |
| 3216 | Print(32, " %s", DisplayEvaluation(tw, 1)); |
- | |
| 3217 | Print(32, " %s", DisplayEvaluation(mgw, 1)); |
- | |
| 3218 | Print(32, " %s |", DisplayEvaluation(egw, 1)); |
- | |
| 3219 | Print(32, " %s", DisplayEvaluation(tb, 1)); |
- | |
| 3220 | Print(32, " %s", DisplayEvaluation(mgb, 1)); |
- | |
| 3221 | Print(32, " %s |\n", DisplayEvaluation(egb, 1)); |
- | |
| 3222 | mgb = tree->score_mg; |
- | |
| 3223 | egb = tree->score_eg; |
- | |
| 3224 | EvaluateCastling(tree, 1, black); |
- | |
| 3225 | mgb = tree->score_mg - mgb; |
- | |
| 3226 | egb = tree->score_eg - egb; |
- | |
| 3227 | mgw = tree->score_mg; |
- | |
| 3228 | egw = tree->score_eg; |
- | |
| 3229 | EvaluateCastling(tree, 1, white); |
- | |
| 3230 | mgw = tree->score_mg - mgw; |
- | |
| 3231 | egw = tree->score_eg - egw; |
- | |
| 3232 | tb = (mgb * phase + egb * (62 - phase)) / 62; |
- | |
| 3233 | tw = (mgw * phase + egw * (62 - phase)) / 62; |
- | |
| 3234 | Print(32, "castling.......%s |", DisplayEvaluation(tb + tw, 1)); |
- | |
| 3235 | Print(32, " %s", DisplayEvaluation(tw, 1)); |
3103 | Print(32, " %s", DisplayEvaluation(tw, 1)); |
| 3236 | Print(32, " %s", DisplayEvaluation(mgw, 1)); |
3104 | Print(32, " %s", DisplayEvaluation(mgw, 1)); |
| 3237 | Print(32, " %s |", DisplayEvaluation(egw, 1)); |
3105 | Print(32, " %s |", DisplayEvaluation(egw, 1)); |
| 3238 | Print(32, " %s", DisplayEvaluation(tb, 1)); |
3106 | Print(32, " %s", DisplayEvaluation(tb, 1)); |
| 3239 | Print(32, " %s", DisplayEvaluation(mgb, 1)); |
3107 | Print(32, " %s", DisplayEvaluation(mgb, 1)); |
| Line 3418... | Line 3286... | ||
| 3418 | /* |
3286 | /* |
| 3419 | ************************************************************ |
3287 | ************************************************************ |
| 3420 | * * |
3288 | * * |
| 3421 | * "skill" command sets a value from 1-100 that affects * |
3289 | * "skill" command sets a value from 1-100 that affects * |
| 3422 | * Crafty's playing skill level. 100 => max skill, 1 => * |
3290 | * Crafty's playing skill level. 100 => max skill, 1 => * |
| 3423 | * minimal skill. This is used to |
3291 | * minimal skill. This is used to slow the search speed * |
| 3424 | * |
3292 | * (and depth) significantly. * |
| 3425 | * * |
3293 | * * |
| 3426 | ************************************************************ |
3294 | ************************************************************ |
| 3427 | */ |
3295 | */ |
| 3428 | #if defined(SKILL) |
3296 | #if defined(SKILL) |
| 3429 | else if (OptionMatch("skill", *args)) { |
3297 | else if (OptionMatch("skill", *args)) { |
| Line 3438... | Line 3306... | ||
| 3438 | if (skill < 1 || skill > 100) { |
3306 | if (skill < 1 || skill > 100) { |
| 3439 | printf("ERROR: skill range is 1-100 only\n"); |
3307 | printf("ERROR: skill range is 1-100 only\n"); |
| 3440 | skill = 100; |
3308 | skill = 100; |
| 3441 | } |
3309 | } |
| 3442 | Print(32, "skill level set to %d%%\n", skill); |
3310 | Print(32, "skill level set to %d%%\n", skill); |
| 3443 | null_depth = (null_depth * skill + 50) / 100; |
- | |
| 3444 | if (skill < 100) |
- | |
| 3445 | null_divisor = null_divisor + 2 * (100 - skill) / 10; |
- | |
| 3446 | check_depth = (check_depth * skill + 50) / 100; |
- | |
| 3447 | LMR_min = (LMR_min * skill + 50) / 100; |
- | |
| 3448 | LMR_max = (LMR_max * skill + 50) / 100; |
- | |
| 3449 | InitializeReductions(); |
- | |
| 3450 | } |
3311 | } |
| 3451 | } |
3312 | } |
| 3452 | #endif |
3313 | #endif |
| 3453 | /* |
3314 | /* |
| 3454 | ************************************************************ |
3315 | ************************************************************ |
| Line 3544... | Line 3405... | ||
| 3544 | return 3; |
3405 | return 3; |
| 3545 | allow_cores = 0; |
3406 | allow_cores = 0; |
| 3546 | if (xboard) |
3407 | if (xboard) |
| 3547 | Print(4095, "Warning-- xboard 'cores' option disabled\n"); |
3408 | Print(4095, "Warning-- xboard 'cores' option disabled\n"); |
| 3548 | smp_max_threads = atoi(args[1]); |
3409 | smp_max_threads = atoi(args[1]); |
| - | 3410 | if (smp_max_threads > hardware_processors) { |
|
| - | 3411 | Print(4095, "ERROR - machine has %d processors.\n", |
|
| - | 3412 | hardware_processors); |
|
| - | 3413 | Print(4095, "ERROR - max threads can not exceed this limit.\n"); |
|
| - | 3414 | smp_max_threads = hardware_processors; |
|
| - | 3415 | } |
|
| 3549 | if (smp_max_threads > CPUS) { |
3416 | if (smp_max_threads > CPUS) { |
| 3550 | Print(4095, "ERROR - Crafty was compiled with CPUS=%d.", CPUS); |
3417 | Print(4095, "ERROR - Crafty was compiled with CPUS=%d.", CPUS); |
| 3551 | Print(4095, " mt can not exceed this value.\n"); |
3418 | Print(4095, " mt can not exceed this value.\n"); |
| 3552 | smp_max_threads = CPUS; |
3419 | smp_max_threads = CPUS; |
| 3553 | } |
3420 | } |
| Line 3559... | Line 3426... | ||
| 3559 | if (smp_max_threads) |
3426 | if (smp_max_threads) |
| 3560 | Print(32, "max threads set to %d.\n", smp_max_threads); |
3427 | Print(32, "max threads set to %d.\n", smp_max_threads); |
| 3561 | else |
3428 | else |
| 3562 | Print(32, "parallel threads disabled.\n"); |
3429 | Print(32, "parallel threads disabled.\n"); |
| 3563 | for (proc = 1; proc < CPUS; proc++) |
3430 | for (proc = 1; proc < CPUS; proc++) |
| 3564 | if (proc >= |
3431 | if (proc >= smp_max_threads) |
| 3565 | thread[proc].terminate = 1; |
3432 | thread[proc].terminate = 1; |
| 3566 | } else if (OptionMatch("smpnice", *args)) { |
3433 | } else if (OptionMatch("smpnice", *args)) { |
| 3567 | if (nargs < 2) { |
3434 | if (nargs < 2) { |
| 3568 | printf("usage: smpnice 0|1\n"); |
3435 | printf("usage: smpnice 0|1\n"); |
| 3569 | return 1; |
3436 | return 1; |
| Line 3659... | Line 3526... | ||
| 3659 | else if (OptionMatch("st", *args)) { |
3526 | else if (OptionMatch("st", *args)) { |
| 3660 | if (nargs < 2) { |
3527 | if (nargs < 2) { |
| 3661 | printf("usage: st <time>\n"); |
3528 | printf("usage: st <time>\n"); |
| 3662 | return 1; |
3529 | return 1; |
| 3663 | } |
3530 | } |
| 3664 | search_time_limit = |
3531 | search_time_limit = atof(args[1]) * 100; |
| 3665 | Print(32, "search time set to %.2f.\n", |
3532 | Print(32, "search time set to %.2f.\n", |
| 3666 | (float) search_time_limit / 100.0); |
3533 | (float) search_time_limit / 100.0); |
| 3667 | } |
3534 | } |
| 3668 | /* |
3535 | /* |
| 3669 | ************************************************************ |
3536 | ************************************************************ |