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.
Using the Optimus GPU on a laptop for Leela Zero
-
sorin
- Lives in gote
- Posts: 389
- Joined: Wed Apr 21, 2010 9:14 pm
- Has thanked: 418 times
- Been thanked: 198 times
Re: Using the Optimus GPU on a laptop for Leela Zero
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).
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
- pnprog
- Lives with ko
- Posts: 286
- Joined: Thu Oct 20, 2016 7:21 am
- Rank: OGS 7 kyu
- GD Posts: 0
- Has thanked: 94 times
- Been thanked: 153 times
Re: Using the Optimus GPU on a laptop for Leela Zero
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):
Then, if it's not the expected GPU, try this, to tell LZ to use others GPU, until you get the expected GPU:
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.
Code: Select all
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.Code: Select all
./leelaz -w weights.txt --gpu 0
./leelaz -w weights.txt --gpu 1
./leelaz -w weights.txt --gpu 2I agree with this one.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.
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!
-
macelee
- Lives in sente
- Posts: 928
- Joined: Mon Dec 31, 2012 1:46 pm
- Rank: 5 dan
- GD Posts: 0
- KGS: macelee
- Location: UK
- Has thanked: 72 times
- Been thanked: 480 times
- Contact:
Re: Using the Optimus GPU on a laptop for Leela Zero
So I must have a problem with the OpenCL driver. This is LZ's output:
The output contains this error message:
Any idea what caused this?
Code: Select all
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.
Code: Select all
Error getting device(s): clGetDeviceIDs: -1- pnprog
- Lives with ko
- Posts: 286
- Joined: Thu Oct 20, 2016 7:21 am
- Rank: OGS 7 kyu
- GD Posts: 0
- Has thanked: 94 times
- Been thanked: 153 times
Re: Using the Optimus GPU on a laptop for Leela Zero
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:
On my computer with a proprietary Nvidia driver, I get:
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:
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: Select all
lspci -vnn | grep -A 12 '\''[030[02]\]' | grep -Ei "vga|3d|display|kernel"Code: Select all
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_drmOne a computer using nouveau, the result would be like this:
Code: Select all
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, nvidiafbI am the author of GoReviewPartner, a small software aimed at assisting reviewing a game of Go. Give it a try!
-
macelee
- Lives in sente
- Posts: 928
- Joined: Mon Dec 31, 2012 1:46 pm
- Rank: 5 dan
- GD Posts: 0
- KGS: macelee
- Location: UK
- Has thanked: 72 times
- Been thanked: 480 times
- Contact:
Re: Using the Optimus GPU on a laptop for Leela Zero
Thank you for your advice. I can see a problem in my case. This is my output if running the same command line:
Also I found the following from the unfiltered output:
Any suggestions? Thanks again!
Code: Select all
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
Code: Select all
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
- pnprog
- Lives with ko
- Posts: 286
- Joined: Thu Oct 20, 2016 7:21 am
- Rank: OGS 7 kyu
- GD Posts: 0
- Has thanked: 94 times
- Been thanked: 153 times
Re: Using the Optimus GPU on a laptop for Leela Zero
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.
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!