【问题标题】:no kernel image is available for execution on the device Fatal Python error: Aborted没有可在设备上执行的内核映像 致命 Python 错误:已中止
【发布时间】:2020-12-22 05:31:50
【问题描述】:

我想在这个 repo 中运行 yolov4 代码:https://github.com/hunglc007/tensorflow-yolov4-tflite 我安装了 python 3.7 和所有要求以及 cuda 和 cudnn。 从日志看,cudnn和cuda都安装好了,但是出现“没有可以在设备上执行的内核映像”的错误,这是什么错误?是否与 cuda 或 cudnn 版本错误有关?

Python:3.7.9,CUDA:10.1,Tensorflow:2.3.0rc0,Tensorflow-GPU:未安装,CUDNN:7.5.0,操作系统:Windows10(x64)

py -3.7 save_model.py --weights ./data/yolov4.weights --output ./checkpoints/yolov4-416-tflite --input_size 416 --model yolov4 --framework tflite
2020-09-03 11:02:05.897607: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-09-03 11:02:09.504648: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2020-09-03 11:02:09.997508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce 940MX computeCapability: 5.0
coreClock: 1.2415GHz coreCount: 3 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 13.41GiB/s
2020-09-03 11:02:10.017273: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-09-03 11:02:10.036505: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2020-09-03 11:02:10.059534: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2020-09-03 11:02:10.074749: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2020-09-03 11:02:10.094710: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2020-09-03 11:02:10.115167: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2020-09-03 11:02:10.140633: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2020-09-03 11:02:10.148636: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-09-03 11:02:10.155846: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-09-03 11:02:10.188413: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x295adc030a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-09-03 11:02:10.199421: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-09-03 11:02:10.207675: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce 940MX computeCapability: 5.0
coreClock: 1.2415GHz coreCount: 3 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 13.41GiB/s
2020-09-03 11:02:10.222939: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-09-03 11:02:10.231890: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2020-09-03 11:02:10.241896: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2020-09-03 11:02:10.250393: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2020-09-03 11:02:10.260177: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2020-09-03 11:02:10.268644: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2020-09-03 11:02:10.278132: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2020-09-03 11:02:10.286635: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-09-03 11:02:10.380510: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-09-03 11:02:10.388703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      0
2020-09-03 11:02:10.394562: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:   N
2020-09-03 11:02:10.402323: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1464 MB memory) -> physical GPU (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0, compute capability: 5.0)
2020-09-03 11:02:10.429701: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x295ae120140 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-09-03 11:02:10.441631: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): GeForce 940MX, Compute Capability 5.0
2020-09-03 11:02:10.619742: F .\tensorflow/core/kernels/random_op_gpu.h:232] Non-OK-status: GpuLaunchKernel(FillPhiloxRandomKernelLaunch<Distribution>, num_blocks, block_size, 0, d.stream(), gen, data, size, dist) status: Internal: no kernel image is available for execution on the device
Fatal Python error: Aborted

【问题讨论】:

  • 好像是cuda或者cudnn版本错误:github.com/tensorflow/tensorflow/issues/30665
  • 您能添加 Cuda 和 CuDNN 版本并更新您的问题吗?
  • @Aniket Bote,我刚刚添加了.. thx。我检查了如果我安装 tensorflow 2.1.0,则此错误已解决,但如果我安装 tensorflow > 2.3.0,此错误又出现了。而我想要的 git repo 需要 tensorflow >2.3.0。我认为这是相关的 Cuda 和 CuDNN 版本,我会尝试其他版本(更低或更高...)

标签: tensorflow


【解决方案1】:

该错误表示tensorflow中使用的预编译二进制不支持你的实际硬件支持的SM版本(计算能力)。

您可以参考以下链接了解支持的组合:

https://www.tensorflow.org/install/source_windows#gpu

基于此,2.1.0 和 2.3.0 都需要 CUDNN 7.4 和 CUDA 10.1。您应该尝试使用这些受支持的组合。

[2.3.0 版本/rc2/rc0 特定] 来自https://github.com/tensorflow/tensorflow/releases/tag/v2.3.0 - TF 2.3 includes PTX kernels only for compute capability 7.0 to reduce the TF pip binary size. Earlier releases included PTX for a variety of older compute capabilities.

【讨论】:

  • 谢谢,我将 CUDNN 重新安装到 7.4 和 CUDA 10.1,但仍然有同样的错误。听说是针对某些 GPU 的 TF 2.3.0 的新问题。 github.com/tensorflow/tensorflow/issues/41990 只是希望有一天它会解决......我应该降级到 TF 2.2,因为 TF 2.2 与 CUDNN 7.4 和 CUDA 10.1 配合得很好......
  • 它说...github.com/tensorflow/tensorflow/issues/42467,TF 2.3 包含仅用于计算能力 7.0 的 PTX 内核,以减少 TF pip 二进制大小。早期版本包括用于各种较旧计算功能的 PTX。所以今天有些显卡不能用于 TF 2.3...谢谢。
猜你喜欢
  • 2021-08-21
  • 2018-09-21
  • 1970-01-01
  • 2021-09-17
  • 2021-04-20
  • 2019-08-27
  • 2020-11-25
  • 2020-07-04
  • 2021-11-20
相关资源
最近更新 更多