tensorflow - tensorflow-gpu 2.0alpha0 错误

标签 tensorflow tensorflow2.0

我已经在 windows 10 中安装了 tensorflow-gpu 2.0alpha0、cudatoolkit 10.0.130 和 cudnn 7.5。

TensorFlow 2.0 在 CPU 上运行良好,但在 GPU 上运行时遇到错误。

错误信息如下:

2019-04-02 23:47:38.646661: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-04-02 23:47:38.666653: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2019-04-02 23:47:38.666842: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)

我认为主要问题是“Could not dlopen library 'nvcuda.dll'”。

不过,我已经安装了最新的NVIDIA驱动(419.67版),'nvcuda.dll'可以在C:\Windows\System32\nvcuda.dll中找到。

最佳答案

这是在 Tensorflow 中失败的方法:

    port::StatusOr<void*> GetDsoHandle(const string& name, const string& version) {
        auto filename = port::Env::Default()->FormatLibraryFileName(name, version);
        void* dso_handle;
        port::Status status =
          port::Env::Default()->LoadLibrary(filename.c_str(), &dso_handle);
        if (status.ok()) {
            LOG(INFO) << "Successfully opened dynamic library " << filename;
            return dso_handle;
    }

基本上,这意味着Tensorflow无法从你的windows环境中的PATH变量中找到nvcuda。要添加环境变量,请执行以下操作:

Windows 10 和 Windows 8

  1. 在搜索中,搜索并选择:系统(控制面板)
  2. 点击“高级系统设置”链接。
  3. 点击环境变量。在系统变量部分,找到 PATH 环境变量并选择它。点击编辑。
  4. 如果 PATH 环境变量不存在,请单击“新建”。
  5. 在“编辑系统变量”(或“新建系统变量”)窗口中,添加路径值 C:\Windows\System32\nvcuda.dll。单击确定。单击“确定”关闭所有剩余窗口。

PS:确保你已经安装了cuDNN

关于tensorflow - tensorflow-gpu 2.0alpha0 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55478968/

相关文章:

tensorflow - Ubuntu 16.04 上 TensorFlow 的 NVIDIA cuDNN 版本类型

python - 将 Estimator 转换为 TPUEstimator

tensorflow - 转换为张量后,参差不齐的张量没有 len()

python - 我可以在 Keras 中定义两个不同的调用函数,一个用于正向映射,另一个用于反向映射

python - 如何在 tf.keras 自定义损失函数中触发 python 函数?

tensorflow - 未找到张量板

python - 如何创建一个张量,其元素通过特定整数设置为 1 并填充 0 以适应宽度大小

tensorflow - 在 Tensorflow 中构建 LSTM RNN 时维度不匹配

python - TensorFlow 中基于 bool 掩码的部分更新张量

python - 导入错误 : cannot import name 'Deconvolution3D' from 'keras.layers' (/home/mona/venv/fall/lib/python3. 8/site-packages/keras/layers/__init__.py)