It is currently Fri Apr 19, 2024 4:08 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
Offline
 Post subject: Using the Optimus GPU on a laptop for Leela Zero
Post #1 Posted: Sun Jun 24, 2018 12:14 pm 
Lives in sente

Posts: 923
Location: UK
Liked others: 72
Was liked: 479
Rank: 5 dan
KGS: macelee
I have been troubled by this for quite a while and could not find a solution.

My new laptop comes with a NVidia card. It is the so-called Optimus setting: the integrated GPU with the Intel processor handles day to day jobs, and the NVidia card can be used to do more intensive jobs.

I have installed Fedora 28 Linux on this machine. I then installed Bumblebee, which supplies the driver for the NVidia card, and a means to switch to the NVidia card to run applications. This appears to work well.

But I have no idea how to use the GPU on this machine to run Leela Zero. Has anyone tried this before?

I was troubled by the poor performance of using the Intel CPU to run LZ. I knew it would be poor. But I was quite shocked when I tried LZ with a 10-year-old NVidia card on a very old desktop PC - the old machine was about 4 times faster.

Top
 Profile  
 
Offline
 Post subject: Re: Using the Optimus GPU on a laptop for Leela Zero
Post #2 Posted: Sun Jun 24, 2018 4:24 pm 
Lives in gote

Posts: 388
Liked others: 416
Was liked: 198
Sorry I don't exactly have an answer to your question, but just one idea to look for: make sure you have installed the OpenCL driver for Nvidia, since I think LeelaZero can only make use of your Nvidia GPU via OpenCL.

The other kind of GPU driver that Nvdia may use is CUDA, but LeelaZero doesn't use that (yet: https://github.com/gcp/leela-zero/issues/211).

_________________
Sorin - 361points.com

Top
 Profile  
 
Offline
 Post subject: Re: Using the Optimus GPU on a laptop for Leela Zero
Post #3 Posted: Sun Jun 24, 2018 11:03 pm 
Lives with ko
User avatar

Posts: 284
Liked others: 94
Was liked: 153
Rank: OGS 7 kyu
You should check what LeelaZero is saying when you run it a terminal (./leelaz -w weights.txt). Here is what I get, it's clear what GPU is used (it's also clear I have only one to use):
Code:
Initializing OpenCL.
Detected 1 OpenCL platforms.
Platform version: OpenCL 1.2 CUDA 9.1.84
Platform profile: FULL_PROFILE
Platform name:    NVIDIA CUDA
Platform vendor:  NVIDIA Corporation
Device ID:     0
Device name:   GeForce GT 720M
Device type:   GPU
Device vendor: NVIDIA Corporation
Device driver: 390.25
Device speed:  1550 MHz
Device cores:  2 CU
Device score:  1112
Selected platform: NVIDIA CUDA
Selected device: GeForce GT 720M
with OpenCL 1.2 capability.


Then, if it's not the expected GPU, try this, to tell LZ to use others GPU, until you get the expected GPU:
Code:
./leelaz -w weights.txt --gpu 0
./leelaz -w weights.txt --gpu 1
./leelaz -w weights.txt --gpu 2


sorin wrote:
Sorry I don't exactly have an answer to your question, but just one idea to look for: make sure you have installed the OpenCL driver for Nvidia, since I think LeelaZero can only make use of your Nvidia GPU via OpenCL.
I agree with this one.
On my Ubuntu, I have to also install the latest nvidia driver (nvidia-390), even though my nvidia card only really requires and uses an older version (nvidia-340). Installing the latest driver must somehow install some tool/framework/idontknowwhat that helps unlocking the latest OpenCL.

_________________
I am the author of GoReviewPartner, a small software aimed at assisting reviewing a game of Go. Give it a try!


This post by pnprog was liked by: Waylon
Top
 Profile  
 
Offline
 Post subject: Re: Using the Optimus GPU on a laptop for Leela Zero
Post #4 Posted: Mon Jun 25, 2018 1:02 am 
Lives in sente

Posts: 923
Location: UK
Liked others: 72
Was liked: 479
Rank: 5 dan
KGS: macelee
So I must have a problem with the OpenCL driver. This is LZ's output:

Code:
Detecting residual layers...v1...192 channels...15 blocks.
Initializing OpenCL.
Detected 2 OpenCL platforms.
Platform version: OpenCL 1.2 pocl 1.1 RelWithDebInfo, LLVM 6.0.0, SPIR, SLEEF, DISTRO, POCL_DEBUG
Platform profile: FULL_PROFILE
Platform name:    Portable Computing Language
Platform vendor:  The pocl project
Device ID:     0
Device name:   pthread-Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Device type:   CPU
Device vendor: GenuineIntel
Device driver: 1.1
Device speed:  4000 MHz
Device cores:  8 CU
Device score:  512
Platform version: OpenCL 1.1 Mesa 18.0.5
Platform profile: FULL_PROFILE
Platform name:    Clover
Platform vendor:  Mesa
Error getting device(s): clGetDeviceIDs: -1
Selected platform: Portable Computing Language
Selected device: pthread-Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
with OpenCL 1.2 capability.



The output contains this error message:

Code:
Error getting device(s): clGetDeviceIDs: -1

Any idea what caused this?

Top
 Profile  
 
Offline
 Post subject: Re: Using the Optimus GPU on a laptop for Leela Zero
Post #5 Posted: Mon Jun 25, 2018 2:15 am 
Lives with ko
User avatar

Posts: 284
Liked others: 94
Was liked: 153
Rank: OGS 7 kyu
Most probably an issue with your Nvidia driver.
As a first step, check what version of the driver is currently running. This could be that you are running the opensource driver ("nouveau").

On ubuntu (but I guess it will work on fedora as well), you can type:
Code:
lspci -vnn | grep -A 12 '\''[030[02]\]' | grep -Ei "vga|3d|display|kernel"

On my computer with a proprietary Nvidia driver, I get:
Code:
00:02.0 VGA compatible controller [0300]: Intel Corporation 3rd Gen Core processor Graphics Controller [8086:0166] (rev 09) (prog-if 00 [VGA controller])
   Kernel driver in use: i915
   Kernel modules: i915
01:00.0 3D controller [0302]: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] [10de:1140] (rev a1)
   Kernel driver in use: nvidia
   Kernel modules: nvidiafb, nouveau, nvidia_390, nvidia_390_drm
One can see that both nouveau and nvidia_390 are installed, but nvidia is in use.
One a computer using nouveau, the result would be like this:
Code:
00:0d.0 VGA compatible controller [0300]: NVIDIA Corporation C61 [GeForce 6150SE nForce 430] [10de:03d0] (rev a2) (prog-if 00 [VGA controller])
   Kernel driver in use: nouveau
   Kernel modules: nouveau, nvidiafb

_________________
I am the author of GoReviewPartner, a small software aimed at assisting reviewing a game of Go. Give it a try!

Top
 Profile  
 
Offline
 Post subject: Re: Using the Optimus GPU on a laptop for Leela Zero
Post #6 Posted: Mon Jun 25, 2018 4:12 am 
Lives in sente

Posts: 923
Location: UK
Liked others: 72
Was liked: 479
Rank: 5 dan
KGS: macelee
Thank you for your advice. I can see a problem in my case. This is my output if running the same command line:

Code:
lspci -vnn | grep -A 12 '\''[030[02]\]' | grep -Ei "vga|3d|display|kernel"
00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 620 [8086:5917] (rev 07) (prog-if 00 [VGA controller])
   Kernel driver in use: i915
   Kernel modules: i915
02:00.0 3D controller [0302]: NVIDIA Corporation GP108M [GeForce MX150] [10de:1d10] (rev ff) (prog-if ff)
   Kernel modules: nouveau, nvidia_drm, nvidia
   Kernel driver in use: iwlwifi
   Kernel modules: iwlwifi


Also I found the following from the unfiltered output:

Code:
02:00.0 3D controller [0302]: NVIDIA Corporation GP108M [GeForce MX150] [10de:1d10] (rev ff) (prog-if ff)
   !!! Unknown header type 7f
   Kernel modules: nouveau, nvidia_drm, nvidia


Any suggestions? Thanks again!

Top
 Profile  
 
Offline
 Post subject: Re: Using the Optimus GPU on a laptop for Leela Zero
Post #7 Posted: Mon Jun 25, 2018 6:02 am 
Lives with ko
User avatar

Posts: 284
Liked others: 94
Was liked: 153
Rank: OGS 7 kyu
Well, I now believe your computer is using the nouveau driver, and that you should try to install the latest nvidia proprietary driver, then remove the nouveau driver.

It's better if you refer to the Fedora documentation for that as I have no experience with Fedora. With Ubuntu, it's a pretty straightforward process, I guess it should be easy for Fedora as well.

_________________
I am the author of GoReviewPartner, a small software aimed at assisting reviewing a game of Go. Give it a try!

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