KataGo/Linux

来自Gea-Suan Lin's Wiki
Gslin讨论 | 贡献2020年3月7日 (六) 20:58的版本 →‎編譯
跳到导航 跳到搜索

KataGo是一套電腦圍棋軟體。

基本環境

這邊是用AWS上的Ubuntu 18.04,開g4dn.xlarge測試的。

編譯

先安裝需要的套件:

sudo apt install -y build-essential cmake git libboost-filesystem-dev libgoogle-perftools-dev libzip-dev nvidia-compute-utils-435 nvidia-driver-435 nvidia-headless-435 nvidia-utils-435 ocl-icd-opencl-dev unzip zlib1g-dev

再來編譯:

cd ~; git clone https://github.com/lightvector/KataGo.git; cd ~/KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=OPENCL -DUSE_TCMALLOC=1; make -j8

設定

等下會使用Lizzie當作前端,所以這邊會把KataGo的設定檔丟到Lizzie的目錄下:

cd KataGo/cpp; cp configs/gtp_example.cfg ~/Lizzie/

下載最新的訓練資料

這邊會下載目前最強的20 blocks、30 blocks與40 blocks版本到Lizzie的目錄下並且解開:

cd ~/Lizzie/; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s1349368064-d524332537.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s1287828224-d525929064.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s2430231552-d525879064.zip; echo *.zip | xargs -n1 unzip

測試

先測試Nvidia顯卡有沒有生效(要記得先重開機讓驅動程式生效):

nvidia-smi

接下來可以跑KataGo的測試:

cd ~/KataGo/; ./katago benchmark -model g170-b40c256x2-s1349368064-d524332537/model.bin.gz -config gtp_example.cfg

跑完測試後可以依照建議修改gtp_example.cfg裡的numSearchThreads以加快速度。

快速安裝

sudo apt update; sudo apt install -y build-essential cmake default-jdk git libboost-filesystem-dev libgoogle-perftools-dev libzip-dev nvidia-435 ocl-icd-opencl-dev unzip zlib1g-dev; cd /tmp; wget https://github.com/featurecat/lizzie/releases/download/0.7.2/Lizzie.0.7.2.Mac-Linux.zip; cd ~; unzip /tmp/Lizzie.0.7.2.Mac-Linux.zip; git clone https://github.com/lightvector/KataGo.git; cd KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=OPENCL -DUSE_TCMALLOC=1; make -j8; cp configs/gtp_example.cfg ~/Lizzie; cd ~/Lizzie; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s1349368064-d524332537.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s1287828224-d525929064.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s2430231552-d525879064.zip; echo *.zip | xargs -n1 unzip; sudo reboot

重開機後連進去再跑:

cd ~/KataGo; ./katago benchmark -model g170-b40c256x2-s1349368064-d524332537/model.bin.gz -config gtp_example.cfg

相關連結

外部連結