====== Linux Nvidia Graphic Card ====== ===== Ubuntu Nvidia 최신 드라이버 ===== * [[http://www.binarytides.com/install-nvidia-drivers-ubuntu-14-04/|How to install nvidia drivers ubuntu 14.04]] * [[linux:ubuntu:xorg|Ubuntu x.org]] 참조하여 설치 * [[linux:ubuntu:ubuntu_drivers|Ubuntu Drivers]] ==== nvidia-settings 에서 xorg.conf 저장 안 될 때 ==== * ''/usr/share/screen-resolution-extra/nvidia-polkit'' 파일에 실행 권한이 없어서 ''/etc/X11/xorg.conf'' 파일 생성을 못하기도 한다. Error executing /usr/share/screen-resolution-extra/nvidia-polkit: Permission denied ERROR: Unable to open X config file '/etc/X11/xorg.conf' for writing. * 다음과 같이 실행권한을 추가하면 된다. sudo chmod +x /usr/share/screen-resolution-extra/nvidia-polkit ===== Screen tearing ===== * [[https://www.youtube.com/watch?v=MfL_JkcEFbE|Screen tearing test]] * [[https://www.youtube.com/watch?v=rg_0D96ZGSY|Screen Tearing Example]] 실제 Screen Tearing 이 발생할 때 어떤 모습인지 보여줌. {{:linux:screentearing.png?600|Screen Tearing 이 발생할 때의 동영상에 나타나는 느낌}} * nvidia 사용시에 화면 갱신시 찦어지는 듯한 현상이 나타나서 눈을 아프게 할 수 있다. * 단, Screen Tearing 을 방지할 경우에는 Video 성능이 떨어질 수 있다. 안 좋은 비디오 카드에서는 성능 저하를 경험할 수 있다. * [[linux:wayland|Wayland]] 에서는 이 현상이 해결 됐다고 한다. * Xorg 사용시에 저 현상이 발생한다면 nvidia ''xorg.conf''에 ''Option "ForceFullCompositionPipeline" "true"'' 혹은 ''Option "ForceCompositionPipeline" "true"''가 필요하다. * 이는 ''nvidia-settings''에서 해당 옵션을 선택하고 ''xorg.conf''를 저장하는 것만으로도 해결 가능하다. {{:linux:nvidia-settings-xorgconf.png|nvidia-settings save xorg.conf}} * 단, 이 때 **Laptop 등에 PRIME Display 가 있을 경우 PRIME display 에 대해서는 ''nvidia-settings''가 저장을 안 해줘서 사용할 수 없는 문제가 발생**했다. * 가장 좋은 해결책은 화면 자체를 저장하는게 아니라 ''nvidia'' 드라이버에 대한 설정만 저장하는 것이었다. ==== 부팅/로그인 후 자동 명령 실행으로 해결 ==== * 아래 명령을 ''~/.config/autostart''로 등록한다. nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}" ==== X11 설정 파일 변경으로 해결 ==== * ''/etc/X11/xorg.conf.d/99-nvidia-myoptions.conf'' 파일을 생성하고서 아래 내용으로 저장하고 재부팅한다. * 이제 다시 Screen Tearing 테스트를 해본다. ''ForceFullCompositionPipeline'' 대신 ''ForceCompositionPipeline''로도 충분하면 이를 사용해도 된다. Section "OutputClass" Identifier "nvidia" MatchDriver "nvidia-drm" Driver "nvidia" Option "ForceCompositionPipeline" "true" #Option "ForceFullCompositionPipeline" "true" EndSection ==== 참조 ==== * [[https://www.cmscritic.com/how-to-fix-nvidia-screen-tearing-in-xfce-mate-kde-lxde-and-others/|How to Fix NVIDIA Screen Tearing in XFCE, MATE, KDE, LXDE and others]] 보편적 해결책 - 단, Laptop 모니터 인식 못했음. * [[https://www.youtube.com/watch?v=j8YDUveazWY|How To Eliminate All Screen Tearing On Linux - YouTube]] * ''TearFree'' option * https://wiki.archlinux.org/title/NVIDIA/Troubleshooting#Avoid_screen_tearing * [[https://forums.developer.nvidia.com/u/rockingcat|PRIME display is not detected after generating xorg.conf file - Graphics / Linux / Linux - NVIDIA Developer Forums]] : 가장 핵심 답변 ===== nvidia/intel dual 에서 intel 로만 강제하기 ===== * [[https://gist.github.com/wangruohui/bc7b9f424e3d5deb0c0b8bba990b1bc5|Intel for display, Nvidia for computing]] ===== GPU Monitoring ===== * [[https://unix.stackexchange.com/questions/38560/gpu-usage-monitoring-cuda|GPU usage monitoring (CUDA) - Unix & Linux Stack Exchange]] * [[https://www.youtube.com/channel/UCrinGwmzp-LNcfvDeoBLAYQ|Linux GPU Monitoring and Diagnostic Commands Line Tools - nixCraft]] * [[https://github.com/mountassir/gmonitor|mountassir/gmonitor: gmonitor is a GPU monitor (Nvidia only at the moment)]] * [[https://github.com/wookayin/gpustat/search?l=python|wookayin/gpustat: 📊 A simple command-line utility for querying and monitoring GPU status]] * [[https://github.com/Syllo/nvtop|Syllo/nvtop: NVIDIA GPUs htop like monitoring tool]] * [[https://github.com/XuehaiPan/nvitop|XuehaiPan/nvitop: An interactive NVIDIA-GPU process viewer, the one-stop solution for GPU process management.]] ==== ''nvidia-smi'' ==== # 잘 정리된 현 상황을 지속적으로 보여줌. nvidia-smi -q -g 0 -d UTILIZATION -l 1 nvidia-smi -l 1 ===== Multi/Dual Graphic Card ===== * 동일 nvidia 계열의 그래픽 카드를 여러개 설치했다면, 그래픽 카드 정보를 ''/etc/X11/xorg.conf''에 기록하고 # -a, --enable-all-gpus sudo nvidia-xconfig -a * 재부팅하고, * ''nvidia-settings'' 명령을 통해 그래픽 카드별 모니터 설정을 하고, * 재부팅한다. * 참조 * [[http://unix.stackexchange.com/questions/48266/dual-graphics-cards-in-mint-ubuntu|Dual graphics cards in Mint & Ubuntu - Unix & Linux Stack Exchange]] ===== nvidia/intel switch ===== * [[https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu|How To Switch Between Intel and Nvidia Graphics Card on Ubuntu]] # Ubuntu 22.10 에서는 별도 패키지 설치 필요. sudo apt install nvidia-prime # 현재 사용중인 그래픽 카드 프로필 확인 prime-select query # intel 로 전환 sudo prime-select on-demand # intel 로 전환 sudo prime-select intel # nvidia 로 전환 sudo prime-select nvidia # 재부팅 필요. sudo reboot * ''intel'' 모드 사용시 외부 모니터 연결에 대한 인식률이 떨어지는 현상이 발생했음.(nvidia 455 드라이버) * 또한 ''on-demand'', ''intel'' 일 경우 4k Dual Monitor 로 사용할 때 성능저하가 너무 심했음(60Hz로 해도). ''nvidia'' 모드로 했더니 4K Dual 도 잘작동했음. * [[https://github.com/hertg/egpu-switcher|GitHub - hertg/egpu-switcher: 🖥🐧 Setup script for eGPUs in Linux (Xorg)]] * ''on-demand'' 일 경우에 ''vaapi'' 가 작동했음. ==== Xinerama ==== * Nvidia 드라이버에 따라 Xinerama가 안될 수 있으므로 다양한 버전 시도. NVS 310, GeForce 8500 GT 그래픽 카드 사용시 304 버전에서 성공했음 * 2014 현재 최신 nvidia 드라이버는 버그 때문에 오히려 xinerama가 안된다고 한다. * 한 그래픽 카드에 여러 모니터가 달렸을 경우에 모니터 별로 Xscreen 번호를 다르게 가져가야 창 확대시 모니터를 넘나들지 않게 된다. * [[http://www.mysolutions.it/multiple-nvidia-video-cards-monitors-linux-mint-15-mate/|Multiple Nvidia Video Cards & Monitors on Linux Mint 15 MATE | My Solutions IT]] * 모든 모니터에 대해 Xinerama를 켜주고 * Resolusion을 모두 직접 지정해줄 것.(Auto로 두지 말 것) * Xinerama를 하지 않으면 그래픽 카드가 달라질 때 ''DISPLAY''도 달라져서 창을 모니터 단위로 옮겨 다닐 수 없다. * 주의 * Composition(합성)이 작동하지 않으므로 Composition 기능을 모두 끈다. * Google Chrome의 경우 ''--disable-cpu''명령으로 실행하거나, ''chrome://flags''에서 ''GPU composition on all pages''로 설정할 수 있다. * Flash Player에서도 하드웨어 가속을 꺼야 한다. [[linux:flash|Linux Flash]] 참조. ===== envycontrol ===== * https://bayas.dev/projects/envycontrol/ * EnvyControl is a program aimed to provide an easy way to switch GPU modes on Nvidia Optimus systems (i.e laptops with Intel + Nvidia or AMD + Nvidia configurations) under Linux. ===== 부팅 후 화면이 안나오거나 성능이 저하될 때 ===== 오래된 정보. 최근에 발생한적 없었음. * NVIDIA 그래픽 카드가 작동하지 않거나 성능이 안나오면 linux kernel 파라미터에 ''nomodeset'' 설정을 넣어야 한다. ==== Grub 설정에서 ==== * ''/etc/default/grub'' 파일 GRUB_CMDLINE_LINUX_DEFAULT="기타내용... nomodeset" * ''sudo update-grub'' ==== 부팅하면서 Grub 메뉴에서 ==== * 부팅할 커널에서 ''e''를 눌러 편집모드로 가서 ''linux /boot/vmlinuz-linux ....'' 로 시작하는 줄의 맨 끝에 추가 linux /boot/vmlinuz-linux ..... quiet splash nomodeset * 부팅 진행