Are both the GPU and CUDNN required for Tensorflow

Question:

Tensorflow can work on CPU without any GPU installed.

Does the following installation improve the performance of Tensorflow when training the following keras model on Ubuntu system?

1). No Nvidia GPU installed.
2). Install the Nvidia CUDNN library on Ubuntu system.
3). Intel CPU with MKLDNN enabled.

For this keras model:

https://www.tensorflow.org/quantum/tutorials/mnist

def create_classical_model():
    # A simple model based off LeNet from https://keras.io/examples/mnist_cnn/
    model = tf.keras.Sequential()
    model.add(tf.keras.layers.Conv2D(32, [3, 3], activation='relu', input_shape=(28,28,1)))
    model.add(tf.keras.layers.Conv2D(64, [3, 3], activation='relu'))
    model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2)))
    model.add(tf.keras.layers.Dropout(0.25))
    model.add(tf.keras.layers.Flatten())
    model.add(tf.keras.layers.Dense(128, activation='relu'))
    model.add(tf.keras.layers.Dropout(0.5))
    model.add(tf.keras.layers.Dense(1))
    return model


model = create_classical_model()
model.compile(loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),
              optimizer=tf.keras.optimizers.Adam(),
              metrics=['accuracy'])

model.summary()

I just installed the CUDNN library on Ubuntu with Intel CPU with MKLDNN enabled, does this CUDNN library make the Tensorflow work better for the above model?

Asked By: stackbiz

||

Answers:

No, it would not have any effect.

CUDA is NVIDIA’s API which allows you to call specific functions in order to directly use your NVIDIA GPU into optimizing computational tasks.

cuDNN (CUDA Deep Neural Network) is a library aimed at accelerating Neural Network specific operations.

In its process of speeding Neural Network operations, cuDNN uses CUDA. Thus, CUDA being dependent on an NVIDIA GPU and cuDNN relying on CUDA, we can conclude that cuDNN cannot apply its optimizations without a NVIDIA GPU.

Answered By: Thirsty4K