alacritty: Alacritty Does Not Use GPU In Hybrid Graphics Mode
I’m not sure if I would really describe this as a bug, however when my laptop is running in hybrid graphics mode, alacritty doesn’t seem to acquire use of the GPU, and instead will use the CPU for rendering.
Here is the output from nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64 Driver Version: 440.64 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1650 Off | 00000000:01:00.0 Off | N/A |
| N/A 37C P8 7W / N/A | 31MiB / 3911MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1726 G /usr/lib/xorg/Xorg 14MiB |
| 0 2225 G /usr/lib/xorg/Xorg 14MiB |
+-----------------------------------------------------------------------------+
Notice that under the processes, it’s just Xorg, and the alacrity process isn’t listed there
System
OS: Linux Version: solidity@gray ~/C/R/Temporal> Linux/BSD:Pop!_OS (pretty sure DE)
Logs
Crashes: not applicable Font/Terminal size:
Created log file at "/tmp/Alacritty-4360.log"
[2020-04-13 16:47] [INFO] Welcome to Alacritty
[2020-04-13 16:47] [INFO] Configuration loaded from "/home/solidity/.alacritty.yml"
[2020-04-13 16:47] [DEBUG] Estimated DPR: 1
[2020-04-13 16:47] [DEBUG] Estimated Cell Size: 9 x 17
[2020-04-13 16:47] [DEBUG] Estimated Dimensions: None
[2020-04-13 16:47] [INFO] Device pixel ratio: 1
[2020-04-13 16:47] [INFO] Initializing glyph cache...
[2020-04-13 16:47] [INFO] ... finished initializing glyph cache in 0.004614572s
[2020-04-13 16:47] [INFO] Cell Size: 9 x 17
[2020-04-13 16:47] [INFO] Padding: 0 x 0
[2020-04-13 16:47] [INFO] Width: 800, Height: 600
[2020-04-13 16:47] [INFO] PTY Dimensions: Line(35) x Column(88)
[2020-04-13 16:47] [INFO] Initialisation complete
[2020-04-13 16:47] [DEBUG] Term::resize dimensions unchanged
[2020-04-13 16:47] [INFO] Width: 800, Height: 600
[2020-04-13 16:47] [DEBUG] [unhandled osc_dispatch]: [['7',],['f','i','l','e',':','/','/','g','r','a','y','/','h','o','m','e','/','s','o','l','i','d','i','t','y','/','C','o','d','e','/','R','T','r','a','d','e','L','t','d','/','T','e','m','p','o','r','a','l',],] at line 758
Keyboard and bindings: ive attached as file Alacritty-4441.log
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 25 (13 by maintainers)
In PopOS, I also use Hybrid Graphics. I run alacritty using the following command based on this:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia alacritty
Now my alacritty is running on Nvidia.
I bind the command to a shortcut so that I don’t have to open gnome-terminal to run the command. Apparently, can’t make the command to bind on keyboard shortcut under Settings. I used Simple X Hotkey Daemon for binding.
Hi all, I’ve been trying to support this too and I’ve just now encountered something that’s a bit weird. I’m on a MBP 16" with 5300M graphics, all set to automatic graphics switching. When I launch Alacritty application it won’t switch to dedicated gpu even with
energy: Performance
set accordingly, however, if I launch alacritty from a terminal, it will switch to the dedicated gpu. I have no idea what’s going on, how could I help to try to see what’s going on under the hood?Editting thisi comment just to confirm that when I launch alacritty from the generated .app located at
/Applications/Alacritty.app/Contents/MacOS/alacritty
it won’t trigger my dedicated gpu, where as when I launch alacritty from the symlink located at/usr/local/bin/alacritty
it will actually trigger the dedicated GPU.Further edit, when I run alacritty with the config and some random string for the value of
energy
there is no error in the configuration load. Command:alacritty -v --config-file
Here is the result of the output:So I’m guessing that the config part related to energy is not being read correctly.
If I can help any way, please let me know, I’m actually an IT student and I’m quite interested in Open Source projects such as this, so I’m more than happy to provide any assistance.
Thank you for this great project!
Yes, my laptop were running on wall power. I totally understand this. I’m ok with the default configs, but it would be nice if there was an option for this in configuration.
Hmm okay. So on macOS with our application settings having it set to
None
just means that it will use the iGPU on battery and the dGPU when plugged in. I feel like that’s probably the ideal approach, but I’m not quite sure how to achieve that on Linux/Windows.Just to confirm, when testing this you are running on wall power, not battery, right?
Alacritty’s primary goal is performance, so it seems tough to justify picking anything other than the optimal performance options by default. However that’s useless when you cannot use the application because it immediately drains all battery. So I think that dGPU on wallpower is really the best choice we have.
Alternatively I could imagine adding a configuration option for this. Something that can be set to
true
/false
/None
maybe, wheretrue
will always enable the dGPU andNone
will only activate it when plugged in the wall.Hey thanks for the response, I think I misspoke by saying “using the cpu”, and meant to say the CPU’s integrated GPU processor or w.e. the things intel CPUs use to do rendering.
Yea I switched to to using nvidia graphics instead of hybrid graphics and
nvidia-smi
shows alacritty process:Sure I can try that tomorrow
Alacritty should never use the CPU for rendering, unless the OpenGL implementation is specifically told to do so.
I’d assume you mean Alacritty uses the integrated GPU, instead of the dedicated one?
If you disable the integrated GPU, do you then see it use the dedicated GPU successfully?
Could you try changing the following line to take
Some(true)
instead ofNone
to see if that works?https://github.com/alacritty/alacritty/blob/master/alacritty/src/window.rs#L120
Alacritty by default doesn’t require the dedicated GPU, I believe the reasoning behind that was saving power. However that decision was made back in 2018 so I don’t quite remember (see #1403).