I want to use 2 graphic cards in my Ubuntu 14.04.
1) An external graphic card for computations with Cuda.
2) The onboard graphic card to run my x-server on.
However when I connect my display to the onboard graphics card before bootup, Ubuntu still uses the external graphics card for the x-server.
How can I change that?
As you have mentioned Cuda in your question, you obviously must use a NVIDIA graphics card.
To achieve what you want, you will have to install the proprietary NVIDIA drivers and Optimus.
After that you can switch between the graphics from NVIDIA X Server Settings PRIME Profiles.
For GEFORCE 400 - 700 I recommend to install the NVIDIA drivers version 352 and nvidia-prime.
For GEFORCE 800 - 900 I recommend to install the NVIDIA drivers version 358 and nvidia-prime.
To identify the exact graphics adapter model of the external card open a terminal and execute :
Installation instructions - the latest stable NVIDIA drivers version 352
Highlight the Ubuntu entry in the GRUB boot menu and press the E key.
Add
nouveau.modeset=0
to the end of the linux line - press F10 to boot.On the login screen press Ctrl+Alt+F1 - enter your user name and your password - execute :
Installation instructions - the latest official NVIDIA drivers version 358
Highlight the Ubuntu entry in the GRUB boot menu and press the E key.
Add
nouveau.modeset=0
to the end of the linux line - press F10 to boot.On the login screen press Ctrl+Alt+F1 - enter your user name and your password - execute :
Note :
Generally you should use the drivers from the official Ubuntu repositories. Sometimes there are problems with these drivers - you can install the more current drivers from the GPU Drivers PPA. This often leads to properly working graphics, especially on very new NVIDIA GEFORCE adapters.
I believe this topic was already been discussed and solved on many other forums. beside the forums, I know by myself it is possible as I did similar setup at my college time in the lab for HPCC purposes.
It is possible and easily feasible since Xorg supports set-up and configuration of multiple cards.
However, below links will provide you all the steps to to the configuration you are looking for:
The discussion on nVidia (2) official forum will give you clear steps.
You will need grub-customizer if you don't know how to handle grub manually.
here is another link which is a bit oldish but the steps are universal and pretty can be adapted to current ubuntu systems:
http://ubuntuforums.org/showthread.php?t=53966
I've got Ubuntu 20.04 and the following worked for me:
nvidia-settings