How to disable NVIDIA card in X server

I actively using CUDA capable cards from NVIDIA for machine learning applications.
When GPU is under heavy load by ml tasks it’s almost impossible to do anything in graphical interface because screen refreshes too slow.
So I switched to integrated video controller. It’s not solved the issue with low refresh rate right away because X server still using NVIDIA card.
After some trials and errors I found a quick and dirty solution: disable graphics card driver during boot to prevent X server to use a card.
To accomplish this you need to blacklist driver by adding a following line:

to /etc/modprobe.d/blacklist.conf
And don’t forget to update initramfs:

After system boot you can load driver manually by following command:

Facebooktwittergoogle_plusredditlinkedin
Yuriy Nazarov on GithubYuriy Nazarov on Twitter
Yuriy Nazarov
Software engineer
Love machine learning