docker - 无法加载动态库 'libcuda.so.1'; dlerror : libcuda

我正在 mt 计算机上构建 Docker,其中 NVDIA GPU 不可用。我使用 tensorflow/tensorflow Docker 镜像作为带 CPU 的基础镜像。

docker 文件

FROM tensorflow/tensorflow 
WORKDIR /project
COPY /app .
RUN python3 main.py

但是显示错误

2020-06-12 20:06:56.822576: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-06-12 20:06:56.825090: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
2020-06-12 20:06:56.827746: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (735abddf4141): /proc/driver/nvidia/version does not exist
2020-06-12 20:06:56.837312: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-06-12 20:06:57.040593: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2400000000 Hz
2020-06-12 20:06:57.045853: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f377c000b20 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-12 20:06:57.045913: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-06-12 20:07:07.017642: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 614400000 exceeds 10% of free system memory.
Killed

在运行这段代码时

model = tf.keras.models.Sequential([
                        tf.keras.layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32, 3)),
                        tf.keras.layers.MaxPooling2D(2, 2),
                        tf.keras.layers.Conv2D(64, (3, 3), activation='relu'),
                        tf.keras.layers.MaxPooling2D(2, 2),
                        tf.keras.layers.Conv2D(64, (3, 3), activation='relu'),
                        tf.keras.layers.Flatten(),
                        tf.keras.layers.Dense(128, activation='relu'),
                        tf.keras.layers.Dense(10, activation='softmax')])

我不想使用 GPU 版本。我需要用 CPU 运行它。

最佳答案

我正在使用 tensorflow 服务并遇到这个问题,我发现 TFS dockerfile.gpu 基于 docker image nvidia/cuda,所以,在安装 nvidia-docker 后,解决了这个问题。希望这对您有所帮助。

关于docker - 无法加载动态库 'libcuda.so.1'; dlerror : libcuda. so.1:无法打开共享对象文件:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62351943/

相关文章:

python - tqdm.notebook 在 jupyter notebook 中显示带有 "H

c# - 如何评估包含局部变量名称的字符串作为 C# 中的代码

matlab - 使用鼠标右键删除选择表中的行 - Matlab 2020a

c# - 尽管已添加到我的项目中但无法使用 Bootstrap

azure-functions - Azure Functions、Servicebus 和 Cor

react-native - 在通过深度链接导航到特定路线导航时 React Native。goBa

javascript - 为什么字符串中的等号会抛出意外的标记错误?

c# - Json 列 SQL

python - 查找列表中的值是否大于其下方的项目

visual-studio-code - VScode 中的 vim 仿真扩展导致问题