It is currently Thu Mar 28, 2024 7:42 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
Offline
 Post subject: Leela zero install on Ubuntu
Post #1 Posted: Wed Sep 05, 2018 7:57 am 
Dies in gote

Posts: 61
Liked others: 56
Was liked: 7
Rank: EGF 5k
KGS: 2k
IGS: 2k
OGS: 3k
Can someone explain how i can install Leela on my Ubuntu? I am basically a moron with Linux and the stuff i've seen on Github seem confusing. Any ideas would be appreciated

Top
 Profile  
 
Offline
 Post subject: Re: Leela zero install on Ubuntu
Post #2 Posted: Fri Sep 07, 2018 1:17 am 
Dies in gote

Posts: 37
Location: Frankfurt, Germany
Liked others: 2
Was liked: 19
Rank: IGS 9k EGF 6k
KGS: Revilo
IGS: Revilo
Well, this is quite a pain in the neck. What eventually worked on my machine was the procedure Example of compiling and running - Ubuntu described here: https://github.com/gcp/leela-zero

Code:
# Test for OpenCL support & compatibility
sudo apt install clinfo && clinfo

# Clone github repo
git clone https://github.com/gcp/leela-zero
cd leela-zero/src
sudo apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev
make
cd ..
wget http://zero.sjeng.org/best-network
src/leelaz --weights best-network


In an ideal world, you would excecute these commands in the shell and be done with it. In practice, you are very likely going to run into some issues, like missing dependencies. Also very likely, you will have to create symbolic links in e.g. usr/etc and the like.

So let's walk through the commands one-by-one. I hope the following will help you through this maze.

Code:
sudo apt install clinfo && clinfo


The tool clinfo is for GPU diagnostics. It is not needed to run LZ as such. However, you can use it to check if you've got the GPU drivers up and running. Execute the command in the shell and pray that your graphic card is listed as one of the available devices in the command output. If it is not, it's time for specific troubleshooting. Most likely, you will have to install a vendor-provided driver for your GPU. There's also a way to compile LZ without GPU support (see later).

Code:
git clone -b next https://github.com/gcp/leela-zero
cd leela-zero/src


With these commands, you will check out the LZ source code from GitHub. The folder leela-zero will be created by the git tool. In contrast to the command given on the LZ GitHub page, the command here will check out the next branch via the option -b next. This is basically a future release candidate. However, it is both faster and also required to use LZ in Lizzie.

Before you execute these commands, create a directory for self-compiled tools in your home directory and navigate into this directory before checking out. This is not necessary as such but will help you find your stuff more easily, like for example when you need to enter the path to LZ in a Go GUI.

You may find that git isn't installed. In this case the error message should point you to the required actions, very likely something like sudo apt install git. Note, that sudo is used to execute a command with super user rights. You will be prompted to enter the root password.

Once you have succeeded in checking out the source code and navigated into the source directory (second command), you're ready for the real fun.

Code:
sudo apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev


This part of the procedure installs the dependencies. Just hope that you don't run into weird errors, because then it's time for Google, i.e. search Google for the error messages and try to find forum posts describing the remedy. The remedy will usually be something like installing another depencency, editing a configuration file or creating a symbolic link.

Code:
make


Given that the dependencies have been installed properly, this command will build the binary. If you run into errors, some of the remedies mentioned above (symbolic links, configuration file entries...) might help here as well. Before starting over, it's a good idea to do so from scratch by executing the command make clean first.

Code:
cd ..
wget http://zero.sjeng.org/best-network


When the binary has been built successfully, the rest is piece of cake. Navigate to the folder containing the binary and download the current best network weights using wget. That way, the network weights and the binary will be stored in the same folder.

Code:
leelaz --weights best-network


The binary will be called leelaz. It must be executed with the shown command line argument for the weights file. When you configure a Go GUI to use LZ, you might have to prepend the absolute path to the folder where then binary and weight file are located.

EDIT #1:

If you want to build LZ without GPU support, you will have to insert the following line into the file config.h in the directory src.

Code:
#define USE_CPU_ONLY


EDIT #2:

Changed GitHub part to checking out the next branch.


Last edited by Revilo on Sat Sep 08, 2018 1:53 am, edited 1 time in total.

This post by Revilo was liked by 4 people: Bill Spight, Drew, joellercoaster, Sampi
Top
 Profile  
 
Offline
 Post subject: Re: Leela zero install on Ubuntu
Post #3 Posted: Fri Sep 07, 2018 5:22 pm 
Oza
User avatar

Posts: 2401
Location: Tokyo, Japan
Liked others: 2338
Was liked: 1332
Rank: Jp 6 dan
KGS: ez4u
One point! Whether you want only Leela Zero or LZ plus Lizzie, you should download and compile the "next" branch of LZ. So see the instructions for Lizzie. On my Mint (Ubuntu varient) machine, the old main branch code runs at least 50% slower than "next".

_________________
Dave Sigaty
"Short-lived are both the praiser and the praised, and rememberer and the remembered..."
- Marcus Aurelius; Meditations, VIII 21


This post by ez4u was liked by 2 people: Bill Spight, Revilo
Top
 Profile  
 
Offline
 Post subject: Re: Leela zero install on Ubuntu
Post #4 Posted: Sat Sep 08, 2018 1:55 am 
Dies in gote

Posts: 37
Location: Frankfurt, Germany
Liked others: 2
Was liked: 19
Rank: IGS 9k EGF 6k
KGS: Revilo
IGS: Revilo
Good point. I've updated my post.

Maybe this thread could also be moved to or linked to the Computer Go subforum?

Top
 Profile  
 
Offline
 Post subject: Re: Leela zero install on Ubuntu
Post #5 Posted: Tue Oct 23, 2018 7:27 pm 
Beginner
User avatar

Posts: 6
Liked others: 12
Was liked: 5
Universal go server handle: Fox: mycophobia
For anyone getting weird errors about missing Eigen/Dense in Ubuntu Bionic as I was today, you can symlink /usr/include/eigen3/Eigen to /usr/include/Eigen, like so:

Code:
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen


and then hopefully it'll build! :D

Top
 Profile  
 
Offline
 Post subject: Re: Leela zero install on Ubuntu
Post #6 Posted: Wed Apr 22, 2020 4:11 am 
Beginner

Posts: 1
Liked others: 0
Was liked: 0
Hi everyone,
Mycophobia, I'm not sure you will still be here but hope so (18 mounth after your post ^^)

I have this exact same error message
"fatal error: Eigen/Dense: No file or folder of this type
compilation terminated."

and i tried your solution but maybe didn't quite get it right

you mean pasting
Code:
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen

While still in the leela-zero/src folder?

right now if i paste this wile in the leela-zero/src folder, I get a message saying
"impossible to create the symbolic link '/usr/include/Eigen': the file exists"

which should be good, if it already exists, but when I paste again the command
Code:
make


I still get the fatal error about "Eigen/Dense: no file or folder of this type"

Have i done something wrong?

Thanks to anyone who can help me :)

Top
 Profile  
 
Offline
 Post subject: Re: Leela zero install on Ubuntu
Post #7 Posted: Tue Apr 28, 2020 5:43 am 
Beginner

Posts: 10
Liked others: 1
Was liked: 1
Rank: Low dan
GeneOntology wrote:
you mean pasting
Code:
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen

While still in the leela-zero/src folder?

"impossible to create the symbolic link '/usr/include/Eigen': the file exists"

With the / in /usr the path is absolute so you can invoke it from any folder.

What are the contents of /usr/include/Eigen compared to /usr/include/eigen3/Eigen? If both are folders with differing contents I would try various variations like:
Code:
sudo ln -s /usr/include/eigen3/Eigen/ /usr/include/Eigen/
sudo ln -s /usr/include/eigen3/Eigen/Dense /usr/include/Eigen
sudo ln -s /usr/include/eigen3/Eigen/Dense /usr/include/Eigen/
sudo ln -s /usr/include/eigen3/Eigen/Dense /usr/include/Eigen/Dense


If /usr/include/Eigen is a file then try deleting it in between the various variations.

This thread: https://askubuntu.com/questions/543516/ ... ists-error
Suggests --force option, ie try ln -sf

_________________
Triangular Go: http://triangulargo.club/

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group