KataGo/Linux:修订间差异

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
 
(未显示同一用户的7个中间版本)
第1行: 第1行:
'''KataGo''' 是一套電腦圍棋軟體
'''KataGo/Linux''' 說明怎麼在[[Linux]]系統上使用[[KataGo]]


== 基本環境 ==
== 基本環境 ==
第22行: 第22行:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd ~; git clone https://github.com/lightvector/KataGo.git; cd ~/KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=OPENCL -DUSE_TCMALLOC=1; make -j8
cd ~; git clone https://github.com/lightvector/KataGo.git; cd ~/KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=OPENCL -DUSE_TCMALLOC=1; renice 20 $$; make -j
</syntaxhighlight>
</syntaxhighlight>


第29行: 第29行:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd ~/KataGo/cpp; cp katago ~/Lizzie
cd ~/KataGo/cpp; cp katago ~/Lizzie
</syntaxhighlight>
另外一種方式是編Eigen的版本:
<syntaxhighlight lang="bash">
cd ~; git clone https://github.com/lightvector/KataGo.git; cd ~/KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=EIGEN -DUSE_AVX2=1 -DUSE_TCMALLOC=1; renice 20 $$; make -j
</syntaxhighlight>
</syntaxhighlight>


第41行: 第47行:
== 下載最新的訓練資料 ==
== 下載最新的訓練資料 ==


 這邊會下載 前最強的20 blocks、30 blocks與40 blocks版本到[[Lizzie]]的目錄下並且解開:
最新的訓練資料可以在KataGo Distributed Training取得<ref>{{Cite web |url=https://katagotraining.org/ |title=KataGo Distributed Training |language=en |accessdate=2020-01-24}}</ref>。
 
 這邊會下載 前最強的20 blocks、30 blocks與40 blocks版本到[[Lizzie]]的目錄下並且解開:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
第105行: 第113行:
== 相關連結 ==
== 相關連結 ==


* [[KataGo]]
* [[Lizzie]]
* [[Lizzie]]
== 參考資料 ==
{{Reflist|2}}


== 外部連結 ==
== 外部連結 ==

2022年1月5日 (三) 13:24的最新版本

KataGo/Linux说明怎么在Linux系统上使用KataGo

基本环境

这边是用AWS上的Ubuntu 18.04,开g4dn.xlarge测试的。

编译

先安装需要的套件:

sudo apt install -y build-essential cmake clinfo 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 wget zlib1g-dev

云端上面可能已经有显卡的驱动了,这时候不要装Nvidia驱动:

sudo apt install -y build-essential clinfo cmake git libboost-filesystem-dev libgoogle-perftools-dev libzip-dev 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; renice 20 $$; make -j

然后把KataGo的执行档丢到Lizzie目录下:

cd ~/KataGo/cpp; cp katago ~/Lizzie

另外一种方式是编Eigen的版本:

cd ~; git clone https://github.com/lightvector/KataGo.git; cd ~/KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=EIGEN -DUSE_AVX2=1 -DUSE_TCMALLOC=1; renice 20 $$; make -j

设定

等下会使用Lizzie当作前端,所以这边会把KataGo的设定档丢到Lizzie的目录下:

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

下载最新的训练资料

最新的训练资料可以在KataGo Distributed Training取得[1]

这边会下载先前最强的20 blocks、30 blocks与40 blocks版本到Lizzie的目录下并且解开:

cd ~/Lizzie/; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s3761649408-d809581368.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s2846858752-d829865719.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s2990766336-d830712531.zip; echo *.zip | xargs -n1 unzip

测试

先测试Nvidia显卡有没有生效(要记得先重开机让驱动程式生效):

nvidia-smi

接下来可以跑KataGo的测试:

cd ~/KataGo/; ./katago benchmark -model g170e-b20c256x2-s3761649408-d809581368/model.bin.gz -config gtp_example.cfg

跑完测试后可以依照建议修改gtp_example.cfg里的numSearchThreads以加快速度。

快速安装

这边包括了KataGo、Lizzie以及VNC相关的套件。

sudo apt update; sudo apt install -y build-essential clinfo cmake default-jdk git icewm 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 tightvncserver unzip wget 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 katago ~/Lizzie; cp configs/gtp_example.cfg ~/Lizzie; cd ~/Lizzie; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s3761649408-d809581368.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s2846858752-d829865719.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s2990766336-d830712531.zip; echo *.zip | xargs -n1 unzip; sudo reboot

云端上面不装显卡的驱动:

sudo apt update; sudo apt install -y build-essential clinfo cmake default-jdk git icewm libboost-filesystem-dev libgoogle-perftools-dev libzip-dev ocl-icd-opencl-dev tightvncserver unzip wget 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 katago ~/Lizzie; cp configs/gtp_example.cfg ~/Lizzie; cd ~/Lizzie; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s3761649408-d809581368.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s2846858752-d829865719.zip https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s2990766336-d830712531.zip; echo *.zip | xargs -n1 unzip; sudo reboot

重开机后连进去再跑:

cd ~/Lizzie; ./katago benchmark -model g170e-b20c256x2-s3761649408-d809581368/model.bin.gz -config gtp_example.cfg

执行

先把VNC跑起来:

tightvncserver -geometry 1680x1050 -depth 24

透过VNC连进去后,用终端机(Terminal,预设是xterm)后执行Lizzie

cd ~/Lizzie; java -jar lizzie.jar

另外也可以考虑设定sun.java2d.opengl让画面比较不卡:

cd ~/Lizzie; java -Dsun.java2d.opengl=true -jar lizzie.jar

相关连结

参考资料

  1. KataGo Distributed Training. [2020-01-24] (English). 

外部链接