You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu系统下如何将Nvidia GeForce 730设置为TensorFlow默认GPU设备

Fixing "No Default GPU Available" with Nvidia GeForce 730 on Ubuntu for TensorFlow

Hey there! Let's get your Nvidia GeForce 730 set up as TensorFlow's default GPU to shake off that frustrating warning. Here's a straightforward, step-by-step guide tailored to your setup:

1. Verify Your GPU is Detected by Ubuntu

First, confirm your system recognizes the GeForce 730. Open a terminal and run:

lspci | grep -i nvidia

If you see output mentioning your GeForce 730, great—your hardware is detected. If not, double-check the GPU is properly seated in your motherboard slot, or try rebooting your system.

2. Install the Correct Nvidia Driver

The GeForce 730 uses the Kepler architecture, which only supports up to Nvidia driver version 390. Here's how to install it:

  • Update your system packages first:
    sudo apt update && sudo apt upgrade -y
    
  • List available drivers to confirm the recommended version:
    ubuntu-drivers devices
    
  • Install the 390-series driver (it should show as recommended):
    sudo apt install nvidia-driver-390 -y
    
  • Reboot your system to apply the driver:
    sudo reboot
    
  • After rebooting, verify the driver works with:
    nvidia-smi
    
    You should see a status panel with your GeForce 730 listed if everything’s working.

3. Install CUDA Toolkit and cuDNN

TensorFlow requires CUDA (Nvidia’s parallel computing platform) and cuDNN (GPU-accelerated deep learning library) to use your GPU. Since we’re using driver 390, we need CUDA 10.2 (the latest version compatible with this driver):

Install CUDA 10.2

  • Download the CUDA 10.2 runfile from Nvidia’s official archive (look for the "Linux x86_64" runfile option).
  • Make the file executable and run it:
    chmod +x cuda_10.2.89_440.33.01_linux.run
    sudo sh cuda_10.2.89_440.33.01_linux.run
    
  • In the installation wizard, uncheck the "Driver" option (we already installed the correct driver earlier) and proceed with installing the CUDA Toolkit.
  • Add CUDA to your system path by editing ~/.bashrc:
    nano ~/.bashrc
    
    Add these lines at the end:
    export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    
  • Save and exit, then reload the bashrc:
    source ~/.bashrc
    
  • Verify CUDA is installed with:
    nvcc -V
    
    You should see output showing CUDA version 10.2.

Install cuDNN

  • Download cuDNN 7.6.5 (compatible with CUDA 10.2) from Nvidia’s archive (you’ll need a free Nvidia account to download).
  • Extract the downloaded .tar file, then copy the files to your CUDA directory:
    sudo cp include/cudnn*.h /usr/local/cuda/include
    sudo cp lib64/libcudnn* /usr/local/cuda/lib64
    sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
    

4. Install a GPU-Compatible TensorFlow Version

TensorFlow 2.10 and newer drop support for Kepler GPUs like the 730, so you’ll need to install an older, compatible version. Use pip to install TensorFlow 2.9.0 (the last version supporting Kepler):

pip install tensorflow==2.9.0

5. Verify TensorFlow Uses Your GPU by Default

Open a Python shell and run this code to check if TensorFlow recognizes your GPU:

import tensorflow as tf
print(tf.config.list_physical_devices('GPU'))

If you see output like [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')], your GPU is detected. TensorFlow will automatically use it as the default device for computations.

If you want to explicitly set it as the default (useful if you ever add another GPU later), you can run:

gpus = tf.config.list_physical_devices('GPU')
if gpus:
    try:
        tf.config.set_visible_devices(gpus[0], 'GPU')
        logical_gpus = tf.config.list_logical_devices('GPU')
        print(f"{len(gpus)} Physical GPUs, {len(logical_gpus)} Logical GPU")
    except RuntimeError as e:
        print(e)

One last note: The GeForce 730 is a low-end GPU, so it won’t deliver blazing-fast training speeds, but it’ll work perfectly for small projects and learning purposes.

内容的提问来源于stack exchange,提问作者Neuropathy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:07:35