Moderator: Andres Valverde
setoption name Threads value x
setoption name Hash value yyy
setoption name Threads value x
setoption name Hashsize value yyy
#include <stdio.h>
void
out(FILE *f, char *s)
{
printf(s); // to GUI
fprintf(f, "out: %s", s); // on log file
fflush(f);
}
int
main(int argc, char **argv)
{
FILE *f = fopen("log.txt", "w");
int j;
for(j=0; j<argc; j++) fprintf(f, "%d. %s\n", j, argv[j]), fflush(f); // command line to log file
out(f, "max threads set to 2\n"); //may I remove this line?
out(f, "XQMS 3.26_10_19. By ¢»Í¥├¶íóı┼├÷.\n");
while(1) {
int i=0, x;
char line[1000], command[100];
fflush(stdout);
while((line[i] = x = getchar()) != EOF && line[i] != '\n') i++;
line[++i] = 0;
fprintf(f, "in: %s", line); fflush(f);
sscanf(line, "%s", command);
if(!strcmp(command, "quit")) return 1;
else if(!strcmp(command, "ucci")) {
out(f, "id name XQMS 3.26_10_19\n");
out(f, "id author ¢»Í¥├¶íóı┼├÷.\n\n");
out(f, "ucciok\n\n");
out(f, "XQMS Use ucci[uci] protocol\n");
}
else if(!strcmp(command, "isready")) out(f, "readyok\n");
}
}
cnchang wrote:It depends on what adhering to UCI/UCCI protocol means. For Anita, it adheres to protocol by announcing options, but no GUI can utilize any of its announced options via standard methods. Maybe its options can still be invoked in some strange way. But, who cares. No one is willing to do the guess work for it, not a bit.
For some UCI/UCCI engines, maybe they think announcing "max threads#" means nothing much because the real max threads# depends on the system limitation. For example, announcing max threads# 32 means nothing on a 4 cores system.
On the other hand, if it hard codes and announces the max threads# is 4 or 6 due to their test results but later finds out it's working well on the newly released 8 or 12 cores systems, do they have to recompile another one? Therefore, maybe the simple and the best way is not to announce something they are not sure about but to allow GUIs to use standard setoption commands to invoke options.
When set to use 4 cores, BHGUI sends "setoption name Threads value 4" to the engines right away, but WBGUI doesn't send anything to the engines even after I tried to use this DefectiveEngineOptions.ini workaround method. Isn't that a little discouraging? All BHGUI did was using standard methods to faithfully invoke all options set by users via its GUI.
For UCI engines, the standard method to set Hash and Threads is --
- Code: Select all
setoption name Threads value x
setoption name Hash value yyy
For UCCI engines, the standard method to set Hash and Threads is --
- Code: Select all
setoption name Threads value x
setoption name Hashsize value yyy
We has seen this in UCI engines. If you want to verify the case for UCCI engines, you can make a spy4ucci.exe and I can operate the Chinese BHGUI to capture a trace for examining. Perhaps I may try to modify your original spy.exe source code to make a UCCI edition like this:
....
Does this spy4ucci source code look OK with the line I marked removed? Is your spy.exe compiled by C# or C++?
recognized 'xiangqi' (-1) as variant xiangqi
recognized 'xiangqi' (-1) as variant xiangqi
WinBoard 4.7.20121129 + ANITA
Reset(1, 0) from gameMode 0
recognized 'xiangqi' (-1) as variant xiangqi
GameEnds(0, (null), 2)
shuffleOpenings = 0
StartChildProcess (dir=".") UCCI2WB -noini "C:\cygwin\home\xq\engines\anita\ANITA.EXE"
nice engine proc to 10
751 >first : xboard
protover 2
801 <first : UCCI2WB 1.8 by Morning Yellow and H.G.Muller
801 <first : # to engine : ucci
801 <first : # from engine: option Threads default 1 min 1 max 4
801 <first :
801 <first : # from engine: protocol UCCI
801 <first : # from engine: id name anita 0.2
801 <first : # from engine: id copyright 2006 - 2006
801 <first : # from engine: id author ÌÕÉÆÎÄ
801 <first : # from engine: id user Unknown User
801 <first : # from engine: id birth Jun 15 2006 10:27:00
801 <first : # from engine: copyprotection OK
801 <first : # from engine: ucciok
801 <first : # from engine: option name Hash type spin default 16 min 4 max 1024
801 <first : # from engine: option name Ponder type check default false
811 <first : # from engine: option name BookFile type string default book.dat
811 <first : # from engine: option name NullMove Reduction type spin default 2 min 1 max 3
811 <first : # from engine: option name History Pruning type check default true
821 <first : feature myname="anita 0.2 (UCCI2WB)"
821 >first : accepted myname
821 <first :
821 <first : feature variants="xiangqi" setboard=1 debug=1 reuse=0 memory=1 smp=1
821 >first : accepted variants
821 >first : accepted setboard
821 >first : accepted debug
821 >first : accepted reuse
821 >first : accepted memory
821 >first : accepted smp
821 <first : feature usermove=1 sigint=0 sigterm=0 colors=0 pause=1 done=1
821 >first : accepted usermove
821 >first : accepted sigint
821 >first : accepted sigterm
821 >first : accepted colors
821 >first : accepted pause
821 >first : accepted done
831 >first : memory 68
831 >first : cores 1
831 >first : new
random
831 >first : variant xiangqi
831 >first : level 40 5 0
831 >first : post
831 >first : hard
Impossible move , type = 0
841 <first : # to engine : setoption threads 1
841 <first : # to engine : setoption newgame
15122 >first : cores 2
Reset(1, 1) from gameMode 0
recognized 'xiangqi' (-1) as variant xiangqi
GameEnds(0, (null), 2)
15132 >first : quit
shuffleOpenings = 0
StartChildProcess (dir=".") UCCI2WB -noini "C:\cygwin\home\xq\engines\anita\ANITA.EXE"
nice engine proc to 10
15673 >first : xboard
protover 2
15673 >first : memory 68
15673 >first : cores 2
15673 >first : new
random
15673 >first : variant xiangqi
15673 >first : level 40 5 0
15673 >first : post
15673 >first : hard
Impossible move , type = 0
15703 <first : UCCI2WB 1.8 by Morning Yellow and H.G.Muller
15703 <first : # to engine : ucci
15703 <first : # from engine: option Threads default 1 min 1 max 4
15703 <first :
15703 <first : # from engine: protocol UCCI
15703 <first : # from engine: id name anita 0.2
15703 <first : # from engine: id copyright 2006 - 2006
15703 <first : # from engine: id author ÌÕÉÆÎÄ
15703 <first : # from engine: id user Unknown User
15703 <first : # from engine: id birth Jun 15 2006 10:27:00
15703 <first : # from engine: copyprotection OK
15703 <first : # from engine: ucciok
15703 <first : # from engine: option name Hash type spin default 16 min 4 max 1024
15703 <first : # from engine: option name Ponder type check default false
15703 <first : # from engine: option name BookFile type string default book.dat
15703 <first : # from engine: option name NullMove Reduction type spin default 2 min 1 max 3
15703 <first : # from engine: option name History Pruning type check default true
15733 <first : feature myname="anita 0.2 (UCCI2WB)"
15733 >first : accepted myname
15743 <first :
15743 <first : feature variants="xiangqi" setboard=1 debug=1 reuse=0 memory=1 smp=1
15743 >first : accepted variants
15743 >first : accepted setboard
15743 >first : accepted debug
15743 >first : accepted reuse
15743 >first : accepted memory
15743 >first : accepted smp
15743 <first : feature usermove=1 sigint=0 sigterm=0 colors=0 pause=1 done=1
15743 >first : accepted usermove
15743 >first : accepted sigint
15743 >first : accepted sigterm
15743 >first : accepted colors
15743 >first : accepted pause
15743 >first : accepted done
15743 <first : # to engine : setoption threads 2
15743 <first : # to engine : setoption newgame
nps: w=-1, b=-1
nps: w=-1, b=-1
19228 >first : time 30000
19228 >first : otim 30000
book hit = (NULL)
19228 >first : usermove 19228 >first : e3e4
19328 <first : # to engine : position fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w - - 0 1 moves e3e4
19328 <first : # to engine : go time 299 movestogo 40
19348 <first : # from engine: info searching openbook...
19348 <first : # from engine: info depth 0
19568 <first : # from engine: info load move from book book.dat fail
20129 <first : # from engine: easy search time is 561
20129 <first : # from engine: info depth 1
20129 <first : # from engine: info depth 1 seldepth 14 score 4 time 561 nodes 495540 pv b7e7
20129 <first : 1 4 56 495540 b7e7
20129 <first : # from engine: info depth 1 seldepth 14 score 8 time 561 nodes 495547 pv b9c7
20129 <first : 1 8 56 495547 b9c7
20139 <first : # from engine: info seldepth 14 time 561 nodes 495594 nps 0
20139 <first : # from engine:
20139 <first : # from engine: info depth 2
20139 <first : # from engine: info depth 2 seldepth 14 score -1 time 561 nodes 495676 pv b9c7 b0c2
20139 <first : 2 -1 56 495676 b9c7 b0c2
20139 <first : # from engine: info depth 2 seldepth 14 score 0 time 561 nodes 495991 pv b7e7 b2e2
20139 <first : 2 0 56 495991 b7e7 b2e2
...
20870 <first : # from engine: info seldepth 16 time 1302 nodes 1041845 nps 800188
20880 <first : # from engine:
20880 <first : # from engine: info depth 9
20880 <first : # from engine: info currmove h7e7 currmovenumber 1
21681 <first : # from engine: info time 2003 nodes 1700000 nps 848727 cpuload 1000
GameEnds(28, xboard exit, 2)
21681 >first : result * {xboard exit}
21681 >first : quit
Indeed, this looks OK. I will make an UCCIspy.exe later, as this is virtually no work. Note, however, that the most urgent problem is to understand why WinBoard/UCCI2WB configured by the DefectiveEngineOptions.ini to do so would NOT send these very same commands to the engine as as BHGUI does. As for me the winboard.debug clearly shows that it does
Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
spy4ucci.cpp:
Error spy4ucci.cpp 31: Function 'strcmp' should have a prototype in function main(int,char * *)
Warning spy4ucci.cpp 39: 'x' is assigned a value that is never used in function main(int,char * *)
*** 1 errors in Compile ***
#include <string.h>
Those are several questions at once. For one, it is very bad, almost criminal, that BHGUI does this. Whoever decided to do that carries most of the responsibility for there being so many crappy UCCI engines today. Second point: yes, it is discouraging if WB does not send anything even with the DefectiveEngineOptions.ini work-around, because it was designed to do so. If things do not work as designed, this really doesn't say anything about the design though. Other designs that do not work as designed will not necessary perform better or even different. Because in the end the only thing that matters is how it works, not how it was designed.
I am a bit surprised that you say it does not work, though: for me it works without problems.
Warning spy4ucci.cpp 39: 'x' is assigned a value that is never used in function main(int,char * *)
cnchang wrote:Regarding adhering to the design standard, I'd really like to discuss with UCI charter members
on:
(1)why it is mandantory for engines to announce all options? BHGUI proves it is not necessary, and sometime, like setting up a tourney, it is better put the control back to users and GUI and let engines to accommodate with the game rule as best as it can.
(2)Why GUI can arbitrarily decide whether to send user's GUI game settings but not let engine decide whether it can cooperate to certain extent?
(3)With multi-core systems getting so common today, why not add their standard for this SMP consideration?
cnchang wrote:Just downloaded UCCISpy, and it failed to load in BHGUI. May I know your C compiler?
I posted the fake cyclone62's spy log yesterday to show you setoption command never sent by WBGUI to engines for Threads#, can you show me if any faked UCI engine has ever received WBGUI's "setoption name Threads ..." in your spy log?
0. Shiga.exe
out: max threads set to 2
out: XQMS 3.26_10_19. By ¢»Í¥+¶íói++÷.
in: uci
out: id name XQMS 3.26_10_19
out: id author ¢»Í¥+¶íói++÷.
out: uciok
out: XQMS Use uci[ucci] protocol
in: setoption name Threads value 2
in: setoption name Hash value 68
in: isready
out: readyok
in: ucinewgame
in: isready
out: readyok
in: fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR r moves e3e4
in: go btime 300000 wtime 300000 movestogo 40
in: fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR r moves e3e4
in: go btime 300000 wtime 300000 movestogo 40
in: quit
1893 <first : # fake engine input
1893 <first : # engine said: option name Hash type spin default 512 min 16 max 512
1893 <first : # engine said: option name Threads type spin default 1 min 1 max 8
1893 <first : # end fake
1943 <first : feature variants="normal,xiangqi" setboard=1 usermove=1 debug=1 ping=1 reuse=0 exclude=1 pause=1 done=0
1943 >first : accepted variants
1943 >first : accepted setboard
1943 >first : accepted usermove
1943 >first : accepted debug
1943 >first : accepted ping
1953 >first : accepted reuse
1953 >first : accepted exclude
1953 >first : accepted pause
1953 >first : accepted done
1953 <first : feature option="UCI2WB debug output -check 1"
1953 >first : accepted option
1953 <first : # engine said: max threads set to 2
1963 <first : # engine said: XQMS 3.26_10_19. By ¢»Í¥+¶íói++÷.
1963 <first : # engine said: id name XQMS 3.26_10_19
1963 <first : feature myname="XQMS 3.26_10_19 (UCI2WB)"
1963 >first : accepted myname
1963 <first : # engine said: id author ¢»Í¥+¶íói++÷.
1963 <first : # engine said:
1973 <first : # engine said: uciok
1973 <first : feature smp=1 memory=1 done=1
1973 >first : accepted smp
1973 >first : accepted memory
1973 >first : accepted done
1973 <first : # engine said:
1973 <first : # engine said: XQMS Use uci[ucci] protocol
1983 >first : memory 68
1983 >first : cores 2
1983 >first : new
random
1983 >first : variant xiangqi
1983 >first : level 40 5 0
1983 >first : post
1983 >first : hard
1983 >first : ping 1
Impossible move , type = 0
2003 <first : # setoption name Threads value 2
2003 <first : # engine said: readyok
2003 <first : # engine said: readyok
2003 <first : pong 1
nps: w=-1, b=-1
nps: w=-1, b=-1
3916 >first : time 30000
3916 >first : otim 30000
book hit = (NULL)
3916 >first : usermove 3916 >first : e3e4
4006 <first : # start search
4006 <first : # fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR r moves e3e4
4006 <first : # go btime 300000 wtime 300000 movestogo 40
option name Hash type spin default 64 min 16 max 512
option name threads type spin default 2 min 1 max 8
option name Ponder type check default true
out: max threads set to 2
out: XQMS 3.26_10_19. By Ⅲ穸+塘鏙++?
in: uci
out: id name XQMS 3.26_10_19
out: id author Ⅲ穸+塘鏙++?
out: uciok
out: XQMS Use uci[ucci] protocol
in: setoption name Hash value 260
in: isready
out: readyok
in: ucinewgame
in: isready
out: readyok
in: quit
out: max threads set to 2
out: XQMS 3.26_10_19. By Ⅲ穸+塘鏙++?
in: uci
out: id name XQMS 3.26_10_19
out: id author Ⅲ穸+塘鏙++?
out: uciok
out: XQMS Use uci[ucci] protocol
in: isready
out: readyok
in: setoption name OwnBook value false
in: setoption name Threads value 4
in: setoption name Hash value 512
in: setoption usebook false
in: setoption useegtb false
in: setoption threads 4
in: setoption hashsize 512
out: max threads set to 2
out: XQMS 3.26_10_19. By Ⅲ穸+塘鏙++?
in: uci
out: id name XQMS 3.26_10_19
out: id author Ⅲ穸+塘鏙++?
out: uciok
out: XQMS Use uci[ucci] protocol
in: setoption name Ponder value true
in: isready
out: readyok
in: setoption name Threads value 2
cnchang wrote:Let's put the design philosophy aside, there are two major issues remaining:
1. the latest UCCIspy.exe doesn't work in BHGUI -> Thus, we can't confirm that BHGUI unilaterally send out setoption commands to engines per user's preferences regardless what engines announced.
* I am still trying to install Cygwin with gcc. Even though there is a chance this gcc compiler doesn't need to explicitly include <string.h>, but I wonder it will eliminate my TurboC's warning "spy4ucci.cpp 39: 'x' is assigned a value that is never used in function main(int,char * *)".
2. You and I have experienced totally different WBGUI behaviors on setting up UCI's Threads#. I just don't see this line in my spy generated trace:
- Code: Select all
in: setoption name Threads value 2
cnchang wrote:You nailed one. It is the "Threads" not "threads" that will trigger WinBoard GUI to send setoption name Threads ...
Oddly enough, I don't recall why I put that lower case "threads" together with other capitalized options; I checked my USB drive for the original version DefectiveEngineOptions.ini. It is shown as Threads there.
But, If name Threads must start with capital T, why many UCCI engines spell out "option threads type spin ..." once received "ucci" command? Why lower case here?
'x' is assigned a value that is never used in function main
while(1) {
int i=0, x;
char line[1000], command[100];
fflush(stdout);
while((line[i] = x = getchar()) != EOF && line[i] != '\n') i++;
line[++i] = 0;
i = 0; while((x = getchar()) != EOF && (line[i] = x) != '\n') i++;
line[++i] = 0; if(x == EOF) { printf("# EOF\n"); exit(-1); }
sscanf(line, "%s", command);
while(1) {
int i=0;
char line[1000], command[100];
fflush(stdout);
while((line[i] = getchar()) != EOF && line[i] != '\n') i++;
line[++i] = 0;
out: protocol UCCI
in: ucci
out: id name anita 0.2
out: id copyright 2006 - 2006
out: id author 夷+?-
out: id user Unknown User
out: id birth Jun 15 2006 10:27:00
out: copyprotection OK
out: ucciok
out: option name Hash type spin default 16 min 4 max 1024
out: option name Ponder type check default false
out: option name BookFile type string default book.dat
out: option name NullMove Reduction type spin default 2 min 1 max 3
out: option name History Pruning type check default true
in: isready
out: readyok
in: setoption usemillisec true
in: setoption repetition asianrule
in: setoption drawmoves 100
in: setoption usebook false
in: setoption useegtb false
in: setoption threads 4
in: setoption hashsize 512
in: setoption usebook false
in: setoption useegtb false
in: setoption threads 4
in: setoption hashsize 512
Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
spy.c:
Turbo Link Version 5.0 Copyright (c) 1992 Borland International
Available memory 4091888
Return to Winboard and related Topics
Users browsing this forum: No registered users and 25 guests