tensorflow-gpu 无法与 Blas GEMM 一起使用 启动失败

2024-02-06

我安装了tensorflow-gpu 以在GPU 上运行我的tensorflow 代码。但我无法让它运行。它不断给出上述错误。以下是我的示例代码,后面是错误堆栈跟踪:

import tensorflow as tf
import numpy as np

def check(W,X):
    return tf.matmul(W,X)


def main():
    W = tf.Variable(tf.truncated_normal([2,3], stddev=0.01))
    X = tf.placeholder(tf.float32, [3,2])
    check_handle = check(W,X)
    with tf.Session() as sess:
        tf.initialize_all_variables().run()
        num = sess.run(check_handle, feed_dict = 
            {X:np.reshape(np.arange(6), (3,2))})
        print(num)
if __name__ == '__main__':
    main()

我的 GPU 是非常好的 GeForce GTX 1080 Ti,带有 11 GB vram,并且没有其他重要的东西在上面运行(只有 chrome),正如您在 nvidia-smi 中看到的那样:

Fri Aug  4 16:34:49 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 381.22                 Driver Version: 381.22                    |
|-------------------------------+----------------------+----------------------+
| 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 GTX 108...  Off  | 0000:07:00.0      On |                  N/A |
| 30%   55C    P0    79W / 250W |    711MiB / 11169MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0      7650    G   /usr/lib/xorg/Xorg                             380MiB |
|    0      8233    G   compiz                                         192MiB |
|    0     24226    G   ...el-token=963C169BB38ADFD67B444D57A299CE0A   136MiB |
+-----------------------------------------------------------------------------+

以下是错误堆栈跟踪:

2017-08-04 15:44:21.585091: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-04 15:44:21.585110: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-04 15:44:21.585114: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-08-04 15:44:21.585118: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-04 15:44:21.585122: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2017-08-04 15:44:21.853700: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties: 
name: GeForce GTX 1080 Ti
major: 6 minor: 1 memoryClockRate (GHz) 1.582
pciBusID 0000:07:00.0
Total memory: 10.91GiB
Free memory: 9.89GiB
2017-08-04 15:44:21.853724: I tensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0 
2017-08-04 15:44:21.853728: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   Y 
2017-08-04 15:44:21.853734: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:07:00.0)
2017-08-04 15:44:24.948616: E tensorflow/stream_executor/cuda/cuda_blas.cc:365] failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED
2017-08-04 15:44:24.948640: W tensorflow/stream_executor/stream.cc:1601] attempting to perform BLAS operation using StreamExecutor without BLAS support
2017-08-04 15:44:24.948805: W tensorflow/core/framework/op_kernel.cc:1158] Internal: Blas GEMM launch failed : a.shape=(1, 5), b.shape=(5, 10), m=1, n=10, k=5
     [[Node: layer1/MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_arg_Placeholder_0_0/_11, layer1/weights/read)]]
Traceback (most recent call last):
  File "test.py", line 51, in <module>
    _, loss_out, res_out = sess.run([train_op, loss, res], feed_dict)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 789, in run
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 997, in _run
    feed_dict_string, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1132, in _do_run
    target_list, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1152, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: Blas GEMM launch failed : a.shape=(1, 5), b.shape=(5, 10), m=1, n=10, k=5
     [[Node: layer1/MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_arg_Placeholder_0_0/_11, layer1/weights/read)]]
     [[Node: layer2/MatMul/_17 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_158_layer2/MatMul", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

Caused by op u'layer1/MatMul', defined at:
  File "test.py", line 18, in <module>
    pre_activation = tf.matmul(input_ph, weights)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/math_ops.py", line 1816, in matmul
    a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 1217, in _mat_mul
    transpose_b=transpose_b, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1269, in __init__
    self._traceback = _extract_stack()

InternalError (see above for traceback): Blas GEMM launch failed : a.shape=(1, 5), b.shape=(5, 10), m=1, n=10, k=5
     [[Node: layer1/MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_arg_Placeholder_0_0/_11, layer1/weights/read)]]
     [[Node: layer2/MatMul/_17 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_158_layer2/MatMul", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

除此之外,我之前安装的tensorflow cpu运行得很好。任何帮助表示赞赏。谢谢!

注意-我安装了 cuda-8.0 和 cudnn-5.1,并将它们的路径添加到我的 bashrc 配置文件中。


我有一个非常相似的问题。对我来说,它与 nvidia 驱动程序更新同时发生。所以我认为这是驱动程序的问题。但更换驱动程序并没有效果。最终对我有用的是清理 nvidia 缓存:

sudo rm -rf ~/.nv/

在 NVIDIA 开发者论坛中发现了这个建议:https://devtalk.nvidia.com/default/topic/1007071/cuda-setup-and-installation/cuda-error-when-running-matrixmulcublas-sample-ubuntu-16-04/post/5169223/ https://devtalk.nvidia.com/default/topic/1007071/cuda-setup-and-installation/cuda-error-when-running-matrixmulcublas-sample-ubuntu-16-04/post/5169223/

我怀疑在驱动程序更新期间,仍然有一些旧版本的编译文件不兼容,甚至在过程中损坏。抛开假设不谈,这为我解决了问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

tensorflow-gpu 无法与 Blas GEMM 一起使用 启动失败 的相关文章

随机推荐

  • 在 Perl 中解析时间戳与毫秒

    假设我有一堆时间戳 如 11 05 2010 16 27 26 003 如何在 Perl 中用毫秒解析它们 本质上 我想比较时间戳以查看它们是在特定时间之前还是之后 我尝试使用 Time Local 但似乎 Time Local 只能解析第
  • 使用与 Trait 函数相同名称的 PHP 类

    我有以下代码作为示例 trait sampletrait function hello echo hello from trait class client use sampletrait function hello echo hello
  • YouTube-Player-iOS-Helper 无法使用 YTPlayerView 类

    我正在尝试实现 youtube ios player helper 在这里找到 https github com youtube youtube ios player helper https github com youtube yout
  • 在android上进行双向数据绑定的正确方法是什么?

    我为 2 路数据绑定做了一个简单的 hello world 并且接缝工作完美 当在 editext 上写入时 textview 自动更新 但是像官方文档一样在网上找到的所有代码都有更多的代码和复杂性 例如https developer an
  • 如何在 Windows 7 64 位上调试 VB6 IIS 应用程序

    我需要能够在 Windows 7 64 位上调试 Visual Basic 6 IIS 应用程序 不仅仅是为了解决一个问题 而是为了持续发展 尝试调试会导致 WebClass 运行时出现错误 发生了未指定的错误 如果我不进行调试而只是访问编
  • 对 Azure Cosmos DB 中的嵌套字段建立索引

    我想在 Azure Cosmos DB 文档中的嵌套字段上创建索引 例如 如果我有以下架构 id 1 nested mode mode1 text nice text 我想在该字段上创建索引nested mode 如何才能做到这一点 Ans
  • 如何在Eclipse控制台打印[简体]汉字?

    我有以下代码 import java io PrintStream import java io UnsupportedEncodingException import java util Locale public final class
  • 点击刷新时,IIS 上出现路由 404 错误

    我没有找到这个问题的解决方案 但我已经尝试了各种解决方案 但没有任何效果 我有一个 React JS 应用程序 当部署在测试服务器上并且您在页面上点击刷新时 我收到 404 错误消息 我尝试过 URL 重写 这有助于导航回主页 但这并不能解
  • 如何使 DateTime 独立于当前文化?

    我尝试将日期时间转换为字符串并返回 但使其适用于所有文化 我基本上有一个文本框 tbDateTime 和一个标签 lbDateTime 该标签告诉用户 软件期望以哪种格式输入 tbDateTime 文本框的输入将用于 MySQL 命令 目前
  • Angular ng 使用不同的“配置文件”构建

    在 Maven Java 中 可以构建具有不同 配置文件 的 Web 应用程序战争 配置文件 指示例如要放入配置文件中的 Web 服务的 URL 因此 测试配置文件 将指示与 生产配置文件 不同的 URL 有没有类似于 ng build 的
  • Swift - 如何在单击时使图像全屏显示,然后在再次单击时使图像变为原始大小? [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 对于我正在制作的应用程序 我希望用户能够单击图像以使其在应用程序上全屏显示 然后用户可以单击现在的全屏图像以使其恢复原始大小 这可能吗
  • 我不明白 format() 和 ... (python) 之间有什么区别

    这里是困惑的新手 使用有什么区别 print So you are 0 years old format age AND print So you are age years old 两者都有效 其实差别很大 前者使用字符串format h
  • 汇编中的纯高位乘法?

    为了实现 0 到 1 之间的实数 通常使用 ANSI 浮点数或双精度数 但是 0 到 1 之间的固定精度数字 小数模 1 可以有效地实现为 32 位整数或 16 位字 它们像普通整数 字一样相加 但乘以 错误的方式 这意味着当您乘以 X 倍
  • gem 服务器:如何更新缺少 rdoc 的 gem?

    我很喜欢gem server使用本地 RubyGems 文档索引引导 Web 服务器的命令 我唯一的问题是 有些 gems 没有 rdoc 文件 如何添加缺失的rdoc 所有gem都是主流gem 不是我自己的 通过Bundler安装 导轨2
  • 电子生成器应用程序大小太大

    我发现使用 Electron builder 生成的 MyApp exe 文件有将近 500M 左右 我不确定我做了什么 因为以前 仅对于 ia32 或 x64 它大约是 196M 我也看了这个link https stackoverflo
  • 矢量上的段错误

    我创建了一个结构来保存一些数据 然后声明一个向量来保存该结构 但是当我执行 Push back 时 我遇到了该死的段错误 我不知道为什么 我的结构定义为 typedef struct Group int codigo string name
  • 查找最大值并显示 SQL Server 中不同字段的相应值

    我有一个表 其中包含有关城市的数据 其中包括城市名称 人口和与我的问题无关的其他字段 ID Name Population 1 A 45667 2 B 123456 3 C 3005 4 D 13769 找到最大人口是基本的 但我需要一个结
  • python 在 x 轴上旋转值以不重叠

    I m having some problems with the xticks of the graph here 有人可以帮忙吗 我尝试了他们在这里所做的事情 matplotlib 中的日期刻度和旋转 https stackoverfl
  • 如何设置 Facebook 分享图片(仅作为后备)?

    我们当然可以使用以下命令来设置默认共享图像 但是 有没有办法将其设置为仅后备 而不是默认值 这意味着 只有当 Facebook 无法从博客文章中找到更大 更合适的图像时才可以使用 注意 Facebook 已经自动自行抓取 无需网站所有者的任
  • tensorflow-gpu 无法与 Blas GEMM 一起使用 启动失败

    我安装了tensorflow gpu 以在GPU 上运行我的tensorflow 代码 但我无法让它运行 它不断给出上述错误 以下是我的示例代码 后面是错误堆栈跟踪 import tensorflow as tf import numpy