Communitacion with Lizzie - GrahamML/docker-for-AQ GitHub Wiki

1. Overview

This wiki explains how to link a built docker image with Lizzie on a client PC.
The following system is assumed:
system

2. Generating and registering the SSH key pair

Generate a key pair for SSH access from the client PC to the GPU server. Then register the public key to the GPU server.

2-1. Key pair generation

  1. Start the PowerShell or Command Prompt on client PC (Windows 10).
  2. Use the following procedure to generate a key pair. This example uses the Ed25519 signature system to generate a key pair.
PS C:\Users\foo> mkdir .ssh
PS C:\Users\foo> ssh-keygen -t ed25519
Generating public/private ed25519 key pair.
Enter file in which to save the key (C:\Users\foo\.ssh\id_ed25519): enter
Enter passphrase (empty for no passphrase): enter
Enter same passphrase again: enter
Your identification has been saved in C:\Users\foo\.ssh\id_ed25519.
Your public key has been saved in C:\Users\foo\.ssh\id_ed25519.pub.
The key fingerprint is:
:
  • The generated key is stored under .ssh in the user directory.
  • The public key is id_ed25519.pub and the private key is id_ed25519. The contents of the public key can be found with a text editor.

2-2. Key registration

Register the contents of the public key generated above to the GPU server as follows:

  1. Login to the GPU server via SSH with your username and password.
  2. Write the contents of the public key to ".ssh/authorized_keys" file in your home directory.
    • If there is no file in your home, create a new one.
    • If another public key has already been written in the file, add it.
    • The public key has three parts. Copy everything as is.
    $ cd
    $ vi .ssh/authorized_keys
    
  3. Confirm that you can log in to the GPU server via SSH without a password.

3. Setup the SSH client (PuTTY)

Communication on the client PC side is handled by "PuTTY(plink)". Therefore, it is necessary to install PuTTY and register your SSH private key to it.

3-1. Installation of PuTTY

  1. Download the PuTTY MSI ('Windows Installer').
  2. Double-click the installer (.msi) to install.

3-2. Private key registration

  1. Start the "puttygen.exe". The following panel will open. Press the "Load" button.
    Key_Load
  2. Give the location of the private key (C:\Users\foo\.ssh\id_ed25519) generated above.
    Note: Set the file type filter to "All Files".
  3. The read private key is converted to PuTTY format. Press the "Save Private key" button to save the PuTTY format private key.
    Key_Save
  4. Specify C:\Users\foo\.ssh\id_ed25519.ppk as the file name to save.
  5. Close the "PuTTY Key Generator" panel.

4. Setup the Lizzie

Install the Lizzie on the client PC and set it up to enable GTP communication with the GPU server container via SSH.

4-1. Installation of Lizzie

  1. Download the release package of the Lizzie. One of the following files depending on the environment of your PC.
    Lizzie.x.y.z.Windows.x64.CPU.zip
    Lizzie.x.y.z.Windows.x64.GPU.zip
  2. Unzip the downloaded package.

4-2. Setup the Lizzie

  1. Edit the "engine-command-list" block in "config.txt" under the Lizzie folder. Each line corresponds to a call to the GPU server's "KataGo", "AQ", "LeelaZero" containers.
    "engine-command-list": [
      "./engine/katago.bat -w KataGO",
      "./engine/aq.bat -w AQ",
      "./engine/leelaz.bat -w LeelaZero",
      "",
      "",
      "",
      "",
      "",
      ""
    ],
    
  2. Or you can set it in "Settings -> Engine" in the menu of Lezzie.
    Engine
  3. Create a folder named "engine" under the Lizzie folder and put the katago.bat, aq.bat and leelaz.bat files defined above in it.
    Dir
  4. Create each .bat file as follows.
  5. For the first time, double click on these *.bat files and confirm in the command prompt window that they launch successfully.
  6. After the batch processing progresses, it will stop while waiting for GTP commands, so stop it with Ctrl-C.
  7. Start the Lizzie (lizzie.jar) and select the engine from the menu. Select

katago.bat

@echo off
set GPU_SERVER={IP_Address or Domain_name}
set USER_ID={User_ID}
set PLINK_PATH="C:\Program Files\PuTTY\plink.exe"
set KEY_PATH="C:\Users\hoge\.ssh\id_ed25519.ppk"

@echo on
%PLINK_PATH% -ssh -i %KEY_PATH% %USER_ID%@%GPU_SERVER% docker exec -i {container_name} /workspace/katago/katago gtp -model /workspace/katago/g170-b40c256x2-s5095420928-d1229425124.bin.gz

aq.bat

@echo off
set GPU_SERVER={IP_Address or Domain_name}
set USER_ID={User_ID}
set PLINK_PATH="C:\Program Files\PuTTY\plink.exe"
set KEY_PATH="C:\Users\hoge\.ssh\id_ed25519.ppk"

@echo on
%PLINK_PATH% -ssh -i %KEY_PATH% %USER_ID%@%GPU_SERVER% docker exec -i {container_name} /workspace/AQ/AQ --rule=1 --komi=6.5 --lizzie

leelaz.bat

@echo off
@echo off
set GPU_SERVER={IP_Address or Domain_name}
set USER_ID={User_ID}
set PLINK_PATH="C:\Program Files\PuTTY\plink.exe"
set KEY_PATH="C:\Users\hoge\.ssh\id_ed25519.ppk"

@echo on
%PLINK_PATH% -ssh -i %KEY_PATH% %USER_ID%@%GPU_SERVER% docker exec -i {container_name} /workspace/leela-zero/build/leelaz --gtp --lagbuffer 0 --threads 2 --weights /workspace/leela-zero/build/best-network

The meanings of the variables and definitions are as follows:

  • GPU_SERVER: IP address or domain name of GPU server. (e.g. GPU_SEVR=192.168.0.1)
  • USER_ID: User ID of GPU server. (e.g. USER_ID=foo)
  • PLINK_PATH: Path to "plink.exe" included in PuTTY installed above.
  • KEY_PATH: Path to the private key generated above.
  • docker exec -i: Run the new command in the container launched on the GPU server. See the docker manual for details.
  • {container_name}: The name of the container on the GPU server.
  • /workspace/katago/katago: Katago launch command.
  • /workspace/AQ/AQ: AQ launch command.
  • /workspace/leela-zero/build/leelaz: Leela-zero launch command.
  • Change the arguments of each launch command to suit your needs. (e.g. --komi=6.5 of AQ)