#hanging when setting boardsize to 9 after initialzing

1 messages · Page 1 of 1 (latest)

versed mirage
#

I have been writing a gui with python which hosts katago and shows moves. This is for children beginners to play go so that its strength should be 30k - 20k. One task is to simulate the followings:
katago gtp -config gtp_human5k_example.cfg -model network.bin.gz -human-model b18c384nbt-humanv0.bin.gz
It is not hard to implement this one with python subprocess, but the default boardsize is 19. 19x19 board is too big for children. after initialzing trying to set boardsize 9 cause hanging. What causes hanging?

def send_command_boardsize(self, command):
    """Send the boardsize command and log all output."""
    if self.process.poll() is not None:
        print("Engine process has terminated.")
        return None

    print(f"Sending command: {command}")
    try:
        self.process.stdin.write(command + "\n")
        self.process.stdin.flush()
    except OSError as e:
        print(f"Error sending command '{command}': {e}")
        return None

    response_lines = []
    while True:
        line = self.process.stdout.readline().strip()
        if line:
            print(f"Received line: {line}")  # Log each line
            response_lines.append(line)
            if line == "=":  # Stop reading when the final confirmation is received
                break

    return "\n".join(response_lines)
thorn sun
#

what is command set to?

versed mirage
#

send_command_boardsize("boardsize 9") # using the above methd.

thorn sun
#

So iirc one thing that occurs when sending a board size change is that the neural network must be reinitialized. Is the hanging you are experiencing just this? (Check stderr)

versed mirage
#

I do not know whether the neuralnet is reinitialzed (though on the command line case it seems to reinitialze). I believe haning occurs during the processing of the above method.

thorn sun
#

Do you ever consume stderr? If not, the text written to stderr might have filled up the buffer and the engine process is blocking on writing diagnostic information to the pipe.

#

You should try to consume stderr and either throw it away or log it to a file or something

versed mirage
#

You're right. On adding error consuming routine, setting board size seems to be sucessful. I can see full of text output like those shown in the command line. For this progress I thank you a lot. However, this time the engine does not generate a move. It can take a huma move but do not give its own move. How do I figure out this problem? Some tip please.

thorn sun
#

So for clarity, you play a move, such as by writing play black E5\n to stdin. Then you receive a response from the engine from stdout which might look like =2.

Then you issue genmove white\n and the engine hangs without error or diagnostic?

thorn sun
#

(if the above is correct, does this also happen if you put several play commands back to back?)

modern holly
#

More accurately, it is “genmove white”.

thorn sun
#

My bad

#

Fixed