-1

was getting started with tensor flow. I dont have any external gpu expect the built in intel 5000. so when I ran this I got 0 . Should that be the desired output? Should I not get 1? If that's the case, should I limit CPU space to ensure it doesn't take much of memory? In that case what should be the approach?

gpus = tf.config.experimental.list_physical_devices('GPU')
len(gpus)

The output is 0

for more context, when I tried the following code the output was []

gpus = tf.config.experimental.list_physical_devices('GPU')
for gpu in gpus: 
    tf.config.experimental.set_memory_growth(gpu, True)

tf.config.list_physical_devices('GPU')

Output:

[]

So here is my code:

!pip install tensorflow tensorflow-gpu opencv-python matplotlib
!pip list
import cv2
import numpy as np
import tensorflow as tf
import os
gpus = tf.config.experimental.list_physical_devices('GPU')
for gpu in gpus: 
    tf.config.experimental.set_memory_growth(gpu, True)
tf.config.list_physical_devices('GPU')

So, incase this is correct how do I Limit CPU memory, and is that necessary

1 Answers1

-2

You need to use position [0] GPU, meaning your integrated Intel GPU:

    # Check if an integrated Intel GPU is available
    gpus = tf.config.experimental.list_physical_devices('GPU')
    if gpus:
        # Use the integrated Intel GPU if it is available
        tf.config.experimental.set_memory_growth(gpus[0], True)

Limiting TensorFlow to be single-threaded would be your best option with an integrated Intel GPU:

# Limit TensorFlow to using a single thread for inter-op and intra-op parallelism
tf.config.threading.set_inter_op_parallelism_threads(1)
tf.config.threading.set_intra_op_parallelism_threads(1)
Masquerading
  • 209
  • 7
  • 1
    Is this generated by ChatGPT? Because the answer makes no sense. – Dr. Snoopy Dec 13 '22 at 16:25
  • TensorFlow does not support Intel integrated GPUs, so there is no position zero to use. – Dr. Snoopy Dec 13 '22 at 16:50
  • 1
    I wish you would at least research this a bit before commenting... https://www.educba.com/tensorflow-opencl/ and https://www.intel.com/content/www/us/en/developer/articles/tool/opencl-drivers.html Intel integrated GPUs are supported with TensorFlow via OpenCL. – Masquerading Dec 13 '22 at 16:55
  • That is not part of the standard Tensorflow, its not an official thing. – Dr. Snoopy Dec 13 '22 at 16:57
  • I'm not certain where they mentioned they wanted the "official thing" or standard TensorFlow code. They wanted a solution to their problem, and I provided that. When you find this officiality requirement in their post, let me know. – Masquerading Dec 13 '22 at 17:09
  • Look at the tag, it says tensorflow, not something else. And you did not mention this OpenCL thing until I asked, it was clearly not the intention of your answer. And this unofficial Tensorflow has not been updated in more than 2 years, so not even the latest version of Tensorflow is available. – Dr. Snoopy Dec 13 '22 at 20:26