[Python] Tensorflow not picking up gpu when compatible drivers are installed

Discussão em 'Python' iniciado por Stack, Fevereiro 12, 2025.

  1. Stack

    Stack Membro Participativo

    nvidia-smi

    Thu Feb 13 03:13:38 2025
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 555.42.06 Driver Version: 555.42.06 CUDA Version: 12.5 |
    |-----------------------------------------+------------------------+----------------------+
    | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
    | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
    | | | MIG M. |
    |=========================================+========================+======================|
    | 0 NVIDIA GeForce GTX 1650 ... Off | 00000000:02:00.0 Off | N/A |
    | N/A 51C P8 5W / 35W | 227MiB / 4096MiB | 11% Default |
    | | | N/A |
    +-----------------------------------------+------------------------+----------------------+

    +-----------------------------------------------------------------------------------------+
    | Processes: |
    | GPU GI CI PID Type Process name GPU Memory |
    | ID ID Usage |
    |=========================================================================================|
    | 0 N/A N/A 2370 G /usr/lib/xorg/Xorg 79MiB |
    | 0 N/A N/A 2745 G /usr/bin/gnome-shell 122MiB |
    | 0 N/A N/A 3442 G /usr/bin/nautilus 22MiB |
    +-----------------------------------------------------------------------------------------+

    nvcc --version
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2023 NVIDIA Corporation
    Built on Fri_Jan__6_16:45:21_PST_2023
    Cuda compilation tools, release 12.0, V12.0.140
    Build cuda_12.0.r12.0/compiler.32267302_0


    Tensorflow Compatibility charts say that my cuda version and tensorflow version should work I have a hybrid laptop and I am using prime-select nvidia.

    prime-select query
    nvidia


    I have use pip install tensorflow and pip install tensorflow[and-cuda] I still keep getting the error

    2025-02-13 03:53:06.182402: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
    WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
    E0000 00:00:1739400787.353207 4649 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
    E0000 00:00:1739400787.818182 4649 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
    2025-02-13 03:53:10.417428: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
    To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.


    When i run my code i get the above error first

    then when it reaches the line where model.fit() starts i get this prompt

    I0000 00:00:1739400828.892632 4649 gpu_device.cc:2022] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 2155 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1650 with Max-Q Design, pci bus id: 0000:02:00.0, compute capability: 7.5
    Epoch 1/10
    WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
    I0000 00:00:1739400835.989249 6210 service.cc:148] XLA service 0x7304a000a1c0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
    I0000 00:00:1739400835.994557 6210 service.cc:156] StreamExecutor device (0): NVIDIA GeForce GTX 1650 with Max-Q Design, Compute Capability 7.5
    2025-02-13 03:53:56.269087: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:268] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
    I0000 00:00:1739400836.728435 6210 cuda_dnn.cc:529] Loaded cuDNN version 90300
    I0000 00:00:1739400839.057300 6210 device_compiler.h:188] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.

    Continue reading...

Compartilhe esta Página