「KataGo/Linux」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
(未顯示同一使用者於中間所作的 35 次修訂)
第10行: 第10行:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
apt install -y build-essential cmake git libboost-filesystem-dev libgoogle-perftools-dev libzip-dev nvidia-435 ocl-icd-opencl-dev zlib1g-dev
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
</syntaxhighlight>
 
雲端上面可能已經有顯示卡的驅動了,這時候不要裝Nvidia驅動:
 
<syntaxhighlight lang="bash">
sudo apt install -y build-essential clinfo cmake git libboost-filesystem-dev libgoogle-perftools-dev libzip-dev ocl-icd-opencl-dev unzip zlib1g-dev
</syntaxhighlight>
</syntaxhighlight>


第16行: 第22行:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
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; make -j8
</syntaxhighlight>
 
然後把KataGo的執行檔丟到[[Lizzie]]目錄下:
 
<syntaxhighlight lang="bash">
cd ~/KataGo/cpp; cp katago ~/Lizzie
</syntaxhighlight>
</syntaxhighlight>


第24行: 第36行:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd KataGo/cpp; cp configs/gtp_example.cfg ~/Lizzie/
cd ~/KataGo/cpp; cp configs/gtp_example.cfg ~/Lizzie/
</syntaxhighlight>
</syntaxhighlight>


== 下載最新的訓練資料 ==
== 下載最新的訓練資料 ==


 這邊會下載 前最強的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">
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
</syntaxhighlight>
 
== 測試 ==
 
先測試Nvidia顯卡有沒有生效(要記得先重開機讓驅動程式生效)


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cd ~/Lizzie/; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s1349368064-d524332537.zip; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s1287828224-d525929064.zip; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s2430231552-d525879064.zip; echo *.zip | xargs -n1 unzip
nvidia-smi
</syntaxhighlight>
</syntaxhighlight>
接下來可以跑KataGo的測試:
<syntaxhighlight lang="bash">
cd ~/KataGo/; ./katago benchmark -model g170e-b20c256x2-s3761649408-d809581368/model.bin.gz -config gtp_example.cfg
</syntaxhighlight>
跑完測試後可以依照建議修改<code>gtp_example.cfg</code>裡的<code>numSearchThreads</code>以加快速度。


== 快速安裝 ==
== 快速安裝 ==
這邊包括了KataGo、[[Lizzie]]以及[[VNC]]相關的套件。
<syntaxhighlight lang="bash">
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
</syntaxhighlight>
雲端上面不裝顯示卡的驅動:
<syntaxhighlight lang="bash">
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
</syntaxhighlight>
重開機後連進去再跑:
<syntaxhighlight lang="bash">
cd ~/Lizzie; ./katago benchmark -model g170e-b20c256x2-s3761649408-d809581368/model.bin.gz -config gtp_example.cfg
</syntaxhighlight>
== 執行 ==
先把[[VNC]]跑起來:
<syntaxhighlight lang="bash">
tightvncserver -geometry 1680x1050 -depth 24
</syntaxhighlight>
透過VNC連進去後,用終端機(Terminal,預設是xterm)後執行[[Lizzie]]:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo apt update; sudo apt install -y build-essential cmake git libboost-filesystem-dev libgoogle-perftools-dev libzip-dev nvidia-435 ocl-icd-opencl-dev zlib1g-dev; git clone https://github.com/lightvector/KataGo.git; cd KataGo/cpp; cmake . -DBUILD_MCTS=1 -DUSE_BACKEND=OPENCL -DUSE_TCMALLOC=1; make -j8; cd ~/KataGo/cpp; cp configs/gtp_example.cfg ~/Lizzie/; cd ~/Lizzie/; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b40c256x2-s1349368064-d524332537.zip; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170-b30c320x2-s1287828224-d525929064.zip; wget https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b20c256x2-s2430231552-d525879064.zip; echo *.zip | xargs -n1 unzip
cd ~/Lizzie; java -jar lizzie.jar
</synaxhighlight>
</syntaxhighlight>
 
另外也可以考慮設定<code>sun.java2d.opengl</code>讓畫面比較不卡:
 
<syntaxhighlight lang="bash">
cd ~/Lizzie; java -Dsun.java2d.opengl=true -jar lizzie.jar
</syntaxhighlight>


== 相關連結 ==
== 相關連結 ==


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


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

於 2021年1月24日 (日) 13:53 的修訂

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; make -j8

然後把KataGo的執行檔丟到Lizzie目錄下:

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

設定

等下會使用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). 

外部連結