Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法获取Python3.8+;使用Tensorflow GPU和open_spiel构建_Tensorflow_Dockerfile - Fatal编程技术网

无法获取Python3.8+;使用Tensorflow GPU和open_spiel构建

无法获取Python3.8+;使用Tensorflow GPU和open_spiel构建,tensorflow,dockerfile,Tensorflow,Dockerfile,我想建立一个测试机器学习算法的环境。为此,我需要Python3.8或更新版本,Tensorflow与nvidia GPU支持和一个名为的开源游戏库一起构建。下面您可以看到我最接近它的工作方式:它是他们的公共Dockerfile的组合,我没有将构建移到python slim映像,而是将它移到archlinux,因为安装cuda+cudnn可以通过那里的packetmanager合理地工作 FROM ubuntu:20.04 as base RUN apt-get update RUN dpkg -

我想建立一个测试机器学习算法的环境。为此,我需要Python3.8或更新版本,Tensorflow与nvidia GPU支持和一个名为的开源游戏库一起构建。下面您可以看到我最接近它的工作方式:它是他们的公共Dockerfile的组合,我没有将构建移到python slim映像,而是将它移到archlinux,因为安装cuda+cudnn可以通过那里的packetmanager合理地工作

FROM ubuntu:20.04 as base
RUN apt-get update
RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get -y install \
    clang \
    curl \
    git \
    python3 \
    python3-dev \
    python3-pip \
    python3-setuptools \
    python3-wheel \
    sudo \
    git
RUN git clone https://github.com/deepmind/open_spiel.git /repo
WORKDIR /repo

RUN sudo pip3 install --upgrade pip
RUN sudo pip3 install matplotlib

# install
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
RUN ./install.sh
RUN pip3 install --upgrade setuptools testresources
RUN pip3 install --upgrade -r requirements.txt
RUN pip3 install --upgrade cmake

# build and test
RUN mkdir -p build
WORKDIR /repo/build
RUN cmake -DPython3_EXECUTABLE=`which python3` -DCMAKE_CXX_COMPILER=`which clang++` ../open_spiel
RUN make -j12
ENV PYTHONPATH=${PYTHONPATH}:/repo
ENV PYTHONPATH=${PYTHONPATH}:/repo/build/python
RUN ctest -j12
WORKDIR /repo/open_spiel

# minimal image for development in Python
# FROM python:3.6-slim-buster as python-slim
FROM archlinux:20200908
RUN mkdir repo
WORKDIR /repo
COPY --from=base /repo .
# install python and cuda
RUN pacman -Syy && pacman -S python cudnn --noconfirm
# install pip
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py; rm get-pip.py

# RUN sed -i '/tensorflow/d' requirements.txt
RUN pip3 install --upgrade -r requirements.txt
RUN pip3 install matplotlib
# RUN pip3 install tensorflow tensorboard mako
ENV PYTHONPATH=${PYTHONPATH}:/repo
ENV PYTHONPATH=${PYTHONPATH}:/repo/build/python
WORKDIR /repo/open_spiel
这一切看起来都没有错误,但是运行测试函数来确定GPU是否正常工作都返回false。是的,使用
tensorflow/tensorflow:latest gpu
图像非常有魅力

我不知道哪里出了问题,它只是给了我一个未知的cuda错误:

>>> tensorflow.test.is_gpu_available()
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-11-09 20:01:28.852872: 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-11-09 20:01:28.862122: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 3801820000 Hz
2020-11-09 20:01:28.863230: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fa45c000b60 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-11-09 20:01:28.863258: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-11-09 20:01:28.865981: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-11-09 20:01:28.869558: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: CUDA_ERROR_UNKNOWN: unknown error
2020-11-09 20:01:28.869584: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: 17fb6eb7d936
2020-11-09 20:01:28.869592: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: 17fb6eb7d936
2020-11-09 20:01:28.869672: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:200] libcuda reported version is: 455.38.0
2020-11-09 20:01:28.869699: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:204] kernel reported version is: 455.38.0
2020-11-09 20:01:28.869711: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:310] kernel version seems to match DSO: 455.38.0
False
>>tensorflow.test.gpu可用吗()
警告:tensorflow:From:1:U gpu是否可用(来自tensorflow.python.framework.test\u util)已被弃用,并将在将来的版本中删除。
更新说明:
改用'tf.config.list_物理_设备('GPU')`。
2020-11-09 20:01:28.852872:I tensorflow/core/platform/cpu\u feature\u guard.cc:143]您的cpu支持该tensorflow二进制文件未编译为使用的指令:AVX2 FMA
2020-11-09 20:01:28.862122:I tensorflow/core/platform/profile_-utils/cpu_-utils.cc:102]cpu频率:3801820000 Hz
202011-09 20:01: 28.863230:I TysFuns/Cyp/XLa/Service / Service .CC:168)XLA服务0x7FA35C000 0B60为平台主机初始化(这不能保证XLA将被使用)。设备:
2020-11-09 20:01:28.863258:I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor设备(0):主机,默认版本
2020-11-09 20:01:28.865981:I tensorflow/stream_executor/platform/default/dso_loader.cc:44]已成功打开动态库libcuda.so.1
2020-11-09 20:01:28.869558:E tensorflow/stream_executor/cuda/cuda_driver.cc:313]调用cuInit失败:cuda_错误未知:未知错误
2020-11-09 20:01:28.869584:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169]检索主机的cuda诊断信息:17fb6eb7d936
2020-11-09 20:01:28.869592:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176]主机名:17fb6eb7d936
2020-11-09 20:01:28.869672:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:200]libcuda报告版本为:455.38.0
2020-11-09 20:01:28.869699:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:204]内核报告版本为:455.38.0
2020-11-09 20:01:28.869711:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:310]内核版本似乎与DSO:455.38.0匹配
假的