简体   繁体   English

Tensorflow 找不到 GPU

[英]Tensorflow can't find the GPU

pip install tensorflow==1.14.0
pip install tensorflow-gpu==1.14

import tensorflow as tf

tf.test.is_gpu_available(
    cuda_only=False,
    min_cuda_compute_capability=None
)

False错误的

GPUs = GPU.getGPUs()
gpu = GPUs[0]
def printm():
 process = psutil.Process(os.getpid())
 print("Gen RAM Free: " + humanize.naturalsize( psutil.virtual_memory().available ), " | Proc size: " + humanize.naturalsize( process.memory_info().rss))
 print("# of CPU: {0}".format(psutil.cpu_count()))
 print("CPU type: {0}".format(platform.uname()))
 print("GPU Type: {0}".format(gpu.name))
 print("GPU RAM Free: {0:.0f}MB | Used: {1:.0f}MB | Util {2:3.0f}% | Total {3:.0f}MB".format(gpu.memoryFree, gpu.memoryUsed, gpu.memoryUtil*100, gpu.memoryTotal))
printm()

Gen RAM Free: 65.8 GB  | Proc size: 294.4 MB
# of CPU: 8
CPU type: uname_result(system='Linux', node='lian-2', release='5.3.0-53-generic', version='#47~18.04.1-Ubuntu SMP Thu May 7 13:10:50 UTC 2020', machine='x86_64', processor='x86_64')
GPU Type: GeForce RTX 2080 Ti
GPU RAM Free: 10992MB | Used: 26MB | Util   0% | Total 11018MB

I reinstalled cuda 10我重新安装了 cuda 10

Mon Jun  8 15:48:44 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:01:00.0 Off |                  N/A |
| 24%   28C    P8     2W / 260W |     26MiB / 11018MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1805      G   /usr/lib/xorg/Xorg                             9MiB |
|    0      2192      G   /usr/bin/gnome-shell                          14MiB |
    +-----------------------------------------------------------------------------+
define CUDNN_MAJOR 7
#define CUDNN_MINOR 4
#define CUDNN_PATCHLEVEL 2
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

I'm trying to train this from a jupyter notebook (ubuntu 18 ssh):我正在尝试从 jupyter 笔记本(ubuntu 18 ssh)训练这个:

model = Sequential()
model.add(layers.Conv1D(16, 9, activation='relu', input_shape=(800, X_train.shape[-1])))
model.add(layers.MaxPooling1D(2))
model.add(layers.Bidirectional(layers.CuDNNGRU(8, return_sequences=True)))
model.add(layers.Bidirectional(layers.CuDNNGRU(8)))
model.add(layers.Dense(8, activation='relu'))
model.add(layers.Dense(1, activation='sigmoid'))
model.compile(optimizer= 'Adam', loss='binary_crossentropy', metrics=['acc'])
model.summary()

train_to_epoch = 150
start_epoch = 3
t1 = datetime.datetime.now()
print('Training start time = %s' %  t1)
history = model.fit(X_train, y_train,
                    batch_size=128,  epochs=train_to_epoch, verbose=0,
                    validation_data=(X_val, y_val))
print('\nTraining Duration = %s' % (datetime.datetime.now()-t1))

InvalidArgumentError: No OpKernel was registered to support Op 'CudnnRNN' used by {{node bidirectional_1/CudnnRNN}}with these attrs: [input_mode="linear_input", T=DT_FLOAT, direction="unidirectional", rnn_mode="gru", seed2=0, is_training=true, seed=87654321, dropout=0] Registered devices: [CPU, XLA_CPU] Registered kernels: InvalidArgumentError:没有注册 OpKernel 以支持 {{node bidirectional_1/CudnnRNN}} 使用的 Op 'CudnnRNN' 具有以下属性:[input_mode="linear_input", T=DT_FLOAT, direction="unidirectional", rnn_mode="gru", seed2 =0, is_training=true, seed=87654321, dropout=0] 注册设备:[CPU, XLA_CPU] 注册内核:

 [[bidirectional_1/CudnnRNN]]

Maybe is another version of CUDA needed?也许需要另一个版本的 CUDA?

Yes, it is the CUDA 10.1 version.是的,它是 CUDA 10.1 版本。

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

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