简体   繁体   English

Tensorflow 是否都需要 GPU 和 CUDNN

[英]Are both the GPU and CUDNN required for Tensorflow

Tensorflow can work on CPU without any GPU installed. Tensorflow 可以在没有安装任何GPUCPU上工作。

Does the following installation improve the performance of Tensorflow when training the following keras model on Ubuntu system?Ubuntu系统上训练以下keras model 时,以下安装是否improve了 Tensorflow 的性能?

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

For this keras model:对于此keras model:

https://www.tensorflow.org/quantum/tutorials/mnist 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?我刚刚在启用了 MKLDNN 的Intel CPUMKLDNN上安装了CUDNN library ,这个CUDNN library是否使 Tensorflow 更适用于上述 Z20F35E630DAF44DBFA4C3F68F5399DC8

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. CUDA是 NVIDIA 的 API,它允许您调用特定函数,以便直接使用您的 NVIDIA GPU 来优化计算任务。

cuDNN (CUDA Deep Neural Network) is a library aimed at accelerating Neural Network specific operations. cuDNN (CUDA Deep Neural Network)是一个旨在加速神经网络特定操作的库。

In its process of speeding Neural Network operations, cuDNN uses CUDA .在加速神经网络操作的过程中, cuDNN 使用 CUDA Thus, CUDA being dependent on an NVIDIA GPU and cuDNN relying on CUDA, we can conclude that cuDNN cannot apply its optimizations without an NVIDIA GPU. Thus, CUDA being dependent on an NVIDIA GPU and cuDNN relying on CUDA, we can conclude that cuDNN cannot apply its optimizations without an NVIDIA GPU.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM