lightvector / KataGo

GTP engine and self-play learning in Go
https://katagotraining.org/
Other
3.56k stars 564 forks source link

The katago binary on linux is large #455

Open jano-wol opened 3 years ago

jano-wol commented 3 years ago

Hi,

can you explain me in a few words why katago.exe is relatively large? (~90Mb with eigen backend, ~120Mb with opencl backend)

I am experimenting with katago, and ideally, I would like to get a katago.exe around ~5Mb. What do you think, do I have a chance to get a much smaller katago.exe? Performance is not that important for me, and I only need the core functions of katago (the move candidate distribution and the evaluation for positions). I do not even need the search function.

Friday9i commented 3 years ago

How do you get 100Mb??? Official KataGo is between 2 and 3Mb! Here it is: https://github.com/lightvector/KataGo/releases Same when I compile it myself: less than 3Mb...

Maybe you speak about Katrain which is indeed around 100Mb (but it includes a GUI and a network)? Or do you speak of the memory used by KataGo?? Anyway, your question is unclear...

jano-wol commented 3 years ago

Hmm, I was also surprised by the size of the compiled binary, its nice to know that I am doing something wrong. I just reproduced the compiling, and the katago binary (sorry katago.exe was misleading) on my Ubuntu 20.04 is again 100Mb.

My method: I cloned out the KataGo repo. I am on the master branch (last commit 2021 March 14). In the cpp folder I cast: cmake . -DUSE_BACKEND=EIGEN -DUSE_AVX2=1 and after that: make

mega-optimus commented 3 years ago

After unzipping the katago-v1.8.1-eigenavx2-linux-x64.zip file from official site, the executable is indeed over 100MB, whereas the windows counterpart is around 3MB. The size difference is likely caused by static vs dynamic linking.

jano-wol commented 3 years ago

Thank you very much for all your points! I tried to compile katago on Windows and the result is in fact a ~3Mb katago.exe which is portable (that is: if I put katago.exe to another clean windows and the ~100KB libz.dll is copied next to katago.exe, then katago.exe is working fine).

Based on these observations I edit the name of the issue and change "katago.exe" to "The katago binary on linux".

l1t1 commented 3 years ago

try linux strip command?

l1t1 commented 3 years ago

also try https://github.com/upx/upx/

svblsvljb commented 1 year ago

also try https://github.com/upx/upx/

This is too much...