- How to Install Nvidia Driver on Ubuntu 20.04
- Check hardware Information of GPU
- Install Nvidia drivers using from GUI
- Install Nvidia driver from the command line (CLI)
- Verify using nvidia-smi
- Configure the Nvidia Graphics driver
- How to uninstall the proprietary Nvidia driver
- Uninstall Nvidia Driver through GUI
- Conclusion
- Электрический блогнот
- мои заметки на полях
- контроль и разгон графических карт NVIDIA в Linux
- nvidia-smi
- Полезные команды
- Журнал
- Driver Persistence
- Разгон
- Заключение
How to Install Nvidia Driver on Ubuntu 20.04
As Linux getting more user friendly, game developers are adding more support thanks to Steam. The performance of graphics processing units (GPUs) mainly depends on drivers. Ubuntu by default use open source video driver Nouveau which has limited support and features when compared with proprietary Nvidia drivers.
The proprietary Nvidia driver is essential to Ubuntu users looking to play games. However, if you are a basic user, there is no need to have this driver installed, as the open-source one works just fine.
In this tutorial, we are going to learn different ways to install Nvidia drivers on Ubuntu 20.04 LTS.
Check hardware Information of GPU
Before installing Nvidia drivers on Ubuntu, ensure that you have Nvidia GPU in your system. There are lots of commands available to get Linux hardware details.
To confirm this, simply run the following hwinfo command.
You can check which card is being used by the prime-select command:
The lshw command can display hardware and driver details of the currently used Nvidia card.
The lspci command is another option to get the GPU hardware details.
If you have installed inxi tool, run the following command.
Install Nvidia drivers using from GUI
Lets first check how to install Nvidia driver from the graphical user interface. On the main menu, type «software update manager» and click on it to open.
On the software updater pop-up, click on the ‘Settings & Livepatch‘ button as shown.
This will launch the ‘Software and Updates‘ window as shown below:
At the top-most section of the ‘Software and updates’ windows, be sure to find a couple of options displayed which include Ubuntu software, other software, updates e.t.c. In this case, click on Additional Drivers, you can see there, the ‘Nvidia — driver -435’ (proprietary, tested) is set up as default driver used for Nvidia card, along with some proprietary divers listed.
Both, ‘Nvidia — drivers 430’ (proprietary) and ‘Nvidia — drivers 390’ (proprietary) are available for GeForce GTX 1080 Ti card. Select the first option to install Nvidia driver 430. When you are done, click on the Apply changes button to install the driver.
Then wait for the download to complete from the internet and click on the close button.
Reboot your computer for the changes to take effect. Run the following to reboot your PC.
Install Nvidia driver from the command line (CLI)
Then, run the following commands to check the list of driver devices available for the Nvidia card from the default Ubuntu repository.
There are four Nvidia drivers available for the GeForce MX130 model. They include the Nvidia driver -440 non-free (which is recommended for Ubuntu system), Nvidia driver -435, and -390 distro non-free and the nouveau distro free builtin opensource video driver (default). Now you can run the following commands to install the specific driver you want.
After the Nvidia diver has been installed, we have to reboot the computer in order to allow Nvidia prime (which is the technology) to switch in between the Intel Graphics and the Nvidia Graphics card.
Verify using nvidia-smi
The nvidia-smi command line is a utility that is used for providing monitor and management capabilities for each and every devices i.e Nvidia Tesla, GRID, Quadro, and GeForce from Fermi and other higher architect families. Open the Terminal application and run the following command to see the Graphics Processing Unit and the process that is using the Nvidia GPU.
Configure the Nvidia Graphics driver
The Nvidia settings command starts a Graphics User Interface(GUI) tool for configuration of Nvidia Graphics driver. This enables you to have a glance at all the GPU information and configure external monitors that are connected to your system.
Run the command below to launch the ‘Nvidia and Server Settings‘ window.
How to uninstall the proprietary Nvidia driver
From open forums, I have noticed many users end up issues with removing Nvidia drivers and reinstalling. Let me share the steps I have followed to successfully uninstall the Nvidia driver and switch to the nouveau driver.
Step 1: Run the following command to confirm Nvidia drivers are installed in your system.
Step 2: Run the following commands to uninstall the proprietary Nvidia driver.
Note that, the use of purge command will remove Nvidia diver together with all configurations that will be made. Run the flowing command to reinstall the Ubuntu desktop package.
Step 3: Run these commands to switch back to the nouveau driver.
Step 3: Remove the Xorg configuration file
Run the rm command to remove the Xorg configuration file
Step 4: After that, reboot your system.
Uninstall Nvidia Driver through GUI
Uninstalling the Nvidia driver using a GUI is quite easy. First, locate the ‘software & Updates’ app then click on it to open. Once it has opened, select on the Additional Drivers tab.
This will display all the Nvidia drivers that are available on Ubuntu. On the list under the ‘Nvidia Corporation,’ select » using X.Org X server — Nouveau display.» This option will pass up the Nvidia graphics diver and it will install Nouveau display driver. For changes to take effect, click on the Apply changes button, and wait for some minutes.
Once Nvidia driver is uninstalled, a message will display saying, «No proprietary drivers are in use» Now close the Software & Updates application and then reboot your computer.
Conclusion
In this tutorial, we have covered two ways that you can use to install Nvidia drivers on Ubuntu 20.04 LTS.
With that said, Nvidia is bringing Vulkan which is intended to offer higher performance and more balanced CPU/GPU usage driver to Linux, a replacement for OpenGL.
In recent years Redhat developers are adding extra code to Nouveau improve opensource code to make it much better, let’s hope the near future we could use it for the modern game.
From Ubuntu 19.10, proprietary Nvidia drivers are available on install media (ie in ISO), which will bring a better fresh install experience for ubuntu users.
If you have any questions or feedback, feel free to leave a comment.
Источник
Электрический блогнот
мои заметки на полях
контроль и разгон графических карт NVIDIA в Linux
Многие геймеры, майнеры и просто любители повозиться с multimedia давно используют видеокарты NVIDIA для своих целей. Используют на «всю катушку». Разработчики видеокарт позволили простым людям создавать программы для запуска на видеокартах, используя мощь всех CUDA ядер. Попутно видеокарты стали комплектоваться оперативной памятью в несколько гигабайт. После этого простая видеокарта превратилась в компьютер-в-компьютере. Поэтому контроль графических карт NVIDIA является первостепенной задачей для тех, кто хочет выжать по максимуму и одновременно добиться того, чтобы карта работала, как можно дольше.
nvidia-smi
Для контроля состояния видеокарты мы будем использовать утилиту nvidia-smi (NVIDIA System Management Interface), которая входит в комплект драйверов производимых компанией NVIDIA для своих карт.
Если у вас Linux, то после установки NVIDIA драйверов nvidia-smi можно найти в папке:
Nvidia-smi является консольной программой (у нее нет графического интерфейса) и для ее запуска необходимо воспользоваться командной строкой.
Полезные команды
С моей точки зрения самой полезным способом запуска nvidia-smi, является запуск без параметров:
вы получите много полезной информации структурированной в виде простенькой таблички. Давайте запусти несколько приложений нагружающих видеокарты и посмотрим, что выдаст nvidia-smi. Для этого воспользуемся примерами, которые поставляются вместе с NVIDIA Cuda Toolkit (установка этого Toolkit описана здесь). Эти примеры точно нагрузят нашу видеокарту 🙂 А так же запустим конвертирование видео из одного формата в другой с помощью утилиты FFmpeg, которая проводит кодирование/раскодирование видео на графическом ускорителе видеокарты.
Глядя на скриншот мы видим, что у нас запущены 4 приложения использующих ресурсы видеокарты:
- Xorg — графическая подсистема Linux. Использует драйвер NVIDIA, поэтому она здесь в списке;
- SimpleGL — пример из Cuda Toolkit;
- marchinCubes — еще пример из Cuda Toolkit;
- FFmpeg — в нашем тесте он занимается конвертированием видео с помощью NVIDIA GPU.
Шапка таблицы дает информацию о названии видеокарты, версии драйвера, текущем режиме работы и температуру. Все дается в понятном виде и дополнительных объяснений не требует. Рассмотрим подробнее раздел Processes, здесь каждый процесс имеет 5 параметров:
- GPU — номер видеокарты на котором приложение запущено (если видеокарта одна, то там будет 0);
- PID — ID процесса, по этому ID вы можете kill’ьнуть процесс обычной командой kill;
- Type — тип приложения:
- «G» — графическое (обычная графика, которая отрисовывается видеокартой);
- «C» — вычислительное, например можно очень эффективно перемножать матрицы на видеокарте (CUDA ядра), но чаще всего подбирают пароли или майнят битки;
- «G+C» — рисует и вычисляет и все это делает с помощью видеокарты.
- Process name — название приложения;
- GPU Memory Usage — сколько видеопамяти занимает приложение.
Чтобы получить максимум информации о состоянии видеокарты наберите:
вывалится огромная «простыня», где вы найдете всю информацию про вашу карточку.
Если установлено несколько видеокарт в системе и нужно получить информацию о какой-то карте конкретно, то нужно указать ID этой карты:
Для того, чтобы получить весь список видеокарт в системе воспользуйтесь командой:
Журнал
Для контроля состояния видеокарты в течение некоторого промежутка времени поможет журнал или log. Nvidia-smi позволяет выводить информацию о требуемых параметрах на экран или в файл для последующего анализа.
Следующая команда будет непрерывно с интервалом в 5 секунд выводить на экран информация о потреблении видеопамяти и температуре GPU:
С помощью опции «-f» можно перенаправить вывод в файл:
Еще один способ смотреть за видеокартой — это запустить nvidia-smi с ключами dmon или pmon.
С помощью dmon можно следить за общими параметрами видеокарты. Я чаще всего использую dmon для контроля загруженности чипов NVDEC/NVENC расположенных в карте NVIDIA и которые отвечают за кодирование и раскодирование видео на аппаратном уровне.
Если хотите журналировать потребление ресурсов видеокарты каждым прорцессом, то можно воспользоваться опцией pmon.
Driver Persistence
Peristence — постоянство. Если приложению нужна видеокарта, то обращение происходит сначала к драйверу, а от драйвера к видеокарте. Современные системы могут выгружать драйверы из памяти (например, понизить энергопотребление). Если приложение требует драйвер, а драйвер в это время выгружен, то система загружает драйвер. На это уходит время. Возникает лаг (lag). Чтобы лагов не было, есть возможность сделать драйвер невыгружаемым:
проверяем статус драйвера»
для того, чтобы вернуть все как было (разрешить выгружать драйвер) делаем:
и сразу же проверяем:
Следует помнить, что если вы меняли настройки видеокарты (частоту, энергопотребление), то перевод/вывод ее в Persistence сбросит все предыдущие настройки.
Разгон
По умолчанию разгон выключен. Вы не можете контролировать частоту графического процессора:
ни скорость вентилятора на видеокарте:
Для того, чтобы в nvidia-settings появилась возможность разгона, нужно добавить в файл
в секцию Section «Device» строку:
и перезагрузить компьютер. После перезагрузки в nvidia-settings станут доступны следующие опции для регулировки разгона:
настройка частоты графического процессора
настройка скорости вращения вентилятора
Следует помнить, что разгон переводит видеокарту в нестандартный режим работы и поэтому контроль ее состояния нужно осуществлять еще тщательнее.
Заключение
В данной заметке мы рассмотрели, как осуществлять контроль и разгон графических карт NVIDIA в Linux. Затронули только самые базовые принципы и лишь слегка погрузились в эту интересную тему. На простых примерах посмотрели, как следить за состоянием видеокарты, как вести логи. Слегка коснулись темы разгона. Правда зачастую уже и этого достаточно, чтобы грамотно задействовать мощь видеокарты.
Источник