Warning: no default GPU device available - gpu

How do I set my GPU as the default device in Tensor Flow?
It’s an Nvidia GeForce 730 - I’m running Ubuntu.

you can use tf.device('/gpu:id') to specify a device other than the default.
However, if you are running multiple TensorFlow programs on the same machine, it is recommended that you set the CUDA_VISIBLE_DEVICES environment variable to expose different GPUs before starting the processes.

Related

How to get to know which GPU the machine uses?

I have an unknown Linux machine, I need to check which GPU it uses (more specifically if it uses an AMD GPU). To know more about CPUs I have used cat /proc/cpuinfo. Is there something similar for GPUs?
If clinfo is available, it'll give you a list of OpenCL-capable compute devices, including GPUs. You're out of luck if GPUs are not supporting OpenCL or drivers are not installed. There is no generic way of getting a list of all kinds of GPU devices. On some platforms you can at least get a list of discrete GPUs from lspci output, but you'll miss the integrated and non-PCI GPUs this way.
If you already have an X11 server running on that box, you can always do glxinfo on it. It cannot be done in a headless way though.

External GPU with Vulkan

According to this Vulkan tutorial, I can use vkEnumeratePhysicalDevices to get a list of available GPUs. However, I don't see my external NVIDIA GPU in there, only my Intel iGPU.
This eGPU is connected via Thunderbolt and is running CUDA code just fine. Is there anything I might have missed? Is it supposed to work out of the box?
My machine is running Arch Linux with up-to-date proprietary NVIDIA drivers.
The eGPU is a NVIDIA GTX 1050 (Lenovo Graphics Dock). Is it possible that it just does not support Vulkan somehow?
Vulkan support should work just as well with external GPUs (eGPUs). Seeing the eGPU enumerated as a Vulkan device may require the eGPU to be recoznized by Xorg (or Wayland in the future).
See recently created https://wiki.archlinux.org/title/External_GPU#Xorg for changes probably required in Xorg config.

GCP GPU is not detected in Keras

I'm running the UNet Keras model on a GCP instance with one NVIDIA Tesla P4GPU. But it does not detect the GPU. Instead it runs on the CPU. p.s. I installed drivers & tensorflow-gpu buy it wont work. How to fix this issue?
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (instance-1): /proc/driver/nvidia/version does not exist
Num GPUs Available: 0
You need to first install the driver. Follow this instruction

Theano setting in .theanorc file different beetween gpu and cuda

To configure theano we create a .theanorc file in your home folder and add the following to set up theano to run on GPU.
[global]
device = gpu
floatx = float32
but sometime i save in configure that smbd put device = cuda, what's the difference?
As i understans, if you use cuda, it should work faster because cuda drivers will manage gpu more better,not getting other jobs for gpu at calculation time
Setting device=gpu in your .theanorc file instructs Theano to use the cuda backend. On the other hand, setting device=cuda instructs theano to use the libgpuarray backend. Both lead to the use of the GPU (in contrast to setting device=cpu in your .theanorc file which would lead to the use of the CPU), and the difference is the low-level API they use to communicate with it. The libgpuarray backend is the newer one of the two that is a wrapper that allows Theano to communicate with both cuda (for NVIDIA GPUs) and opencl (for non-NVIDIA GPUs).
Note that the cuda backend will be deprecated in the next release of Theano and it is recommended that you always use the libgpuarray backend henceforth.

theano - use external GPU only for ML and integrated GPU for display

I have a CPU with integrated GPU. I also have an external GPU that i have been using for ML. What i want is to use the integrated GPU only for display and dedicate the external GPU to NN training (in order to free some memory).
I have set at the BIOS the external GPU to be the primary GPU, but also to both be active. So they are both working. After i boot the system i can plug the monitor to any one of them and they both work.
The problem is that when i plug the monitor to the motherboard (integrated GPU) theano stops using the external GPU:
ERROR (theano.sandbox.cuda): ERROR: Not using GPU. Initialisation of device gpu failed:
Is there a way to explicitly point theano to the external GPU? here is my the relevant part of my .theanorc:
[global]
floatX = float32
device = gpu
I have a similar system to yours. For linux, installing bumblebee worked.
sudo apt-get install bumblebee-nvidia
(adapt to your distro's package manager)
Then launch python via:
optirun python