美文网首页
Kubernetes - 机器学习 - 问题锦集

Kubernetes - 机器学习 - 问题锦集

作者: Anoyi | 来源:发表于2019-08-07 12:11 被阅读0次

    ▶ Pytorch 共享内存不足的问题

    问题描述

    k8s 中运行 Pytorch 程序,出现以下错误

    ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm)
    

    问题分析

    PyTorch 官方文档:Please note that PyTorch uses shared memory to share data between processes, so if torch multiprocessing is used (e.g. for multithreaded data loaders) the default shared memory segment size that container runs with is not enough, and you should increase shared memory size either with --ipc=host or --shm-size command line options to nvidia-docker run.

    PyTorch 的 IPC 会利用共享内存,所以共享内存必须足够大。Docker 默认共享内存是 64M,并且可以通过 docker run --shm-size 进行修改。

    解决方法

    运行容器部署模板添加 shm 的挂载

          volumes:
          - name: dshm
            emptyDir:
              medium: Memory
          containers:
          - name: ***
            volumeMounts:
              - mountPath: /dev/shm
                name: dshm
    

    参考资料


    ▶ CentOS 7 容器无法启用 service

    问题描述

    在 CentOS 7 容器下开启 sshd 服务(service sshd start),出现如下错误:

    Failed to get D-Bus connection: Operation not permitted
    

    问题分析

    CentOS 官方镜像文档:Systemd is now included in both the centos:7 and centos:latest base containers, but it is not active by default.

    解决方法

    授予容器特权模式,默认启用 Systemd

          volumes:
          - name: cgroup
            hostPath:
              path: /sys/fs/cgroup
          containers:
          - name: ***
            command:
              - /usr/sbin/init
            volumeMounts:
              - mountPath: /sys/fs/cgroup
                name: cgroup
            securityContext:
                privileged: true
    

    参考资料

    相关文章

      网友评论

          本文标题:Kubernetes - 机器学习 - 问题锦集

          本文链接:https://www.haomeiwen.com/subject/cwhodctx.html