分布式深度学习系统-容器化资源调度

作者: skywalker | 来源:发表于2016-10-15 14:41 被阅读1470次

    一. 为什么希望使用容器来作为深度学习系统的调度单元

    容器拉取/启动快速。隔离资源效果好。抽象来看,可以将容器的image作为job的一部分分发调度执行。但是容器化后会引入gpu,网络等性能的代价。nvidia gpu 对docker提供了支持,nvidia-docker代替docker执行create和run操作。cuda和cudnn镜像在这里

    nvidia-docker架构

    二. kubernetes(k8s)

    kubernetes作为google开源的容器编排工具,发展十分迅速。最近release的版本是v1.4.1,已经十分稳定。

    kubernetes架构

    说明

    1. 每个node下面
      docker engine:负责下载运行镜像
      kubelet:管理pod已经里面的container
      kube-proxy:服务发现的proxy,代理网络流量
    2. kubernetes控制中心
      etcd:持久化支持观察者模式的配置中心,etcd高可用十分重要
      API Server:操作的接口
      Scheduler:调度pods(container的小集合)到指定node运行,这个实际可以替换使用Mesos
      Kubernetes Controller Manager Server:管理如保持副本个数等功能
      Kubernetes与mesos的区别 @stackoverflow
    1. Kubernetes is a great place to start if you are new to the clustering world; it is the quickest, easiest and lightest way to kick the tires and start experimenting with cluster oriented development. It offers a very high level of portability since it is being supported by a lot of different providers (Microsoft, IBM, Red Hat, CoreOs, MesoSphere, VMWare, etc).
    1. If you have existing workloads (Hadoop, Spark, Kafka, etc), Mesos gives you a framework that let's you interleave those workloads with each other, and mix in a some of the new stuff including Kubernetes apps.
    2. Mesos gives you an escape valve if you need capabilities that are not yet implemented by the community in the Kubernetes framework.

    Kubernetes可以代替Marathon,在Mesos之上搭建cluster的工具

    三. openai的分布式深度学习系统

    openai科学家们的训练日常需求

    1. 小数据量,小模型的实验,快速尝试,一般需要几小时完成一次实验
    2. 大数据量,大模型。一般需要几天完成一次实验
    3. 日志对于分析定位十分重要,应该被持久化和更好的展示

    一般使用的工具箱

    1. python2.7,一般使用Anaconda
    2. 使用tensorflow或者之上更高级的api Keras

    分布式深度学习关键技术

    1. 使用物理gpu机器和aws 提供的cpu机器搭建混合集群
    2. 使用kubernetes编排容器
    3. 自定义组件来支持不同job动态扩容/缩容的需求,kubernetes-ec2-autoscaler
    4. 使用 Terraform 构建每个机器的基础环境,使用Chef统一服务器配置。

    四. tensorflow的分布式架构

    tensorflow从V0.8开始支持分布式训练,目前稳定的版本是r0.11详细的分布式训练的方案在这里

    几个主要的概念

    1. Cluster
      Cluser由一组Server组成,Server的功能可以是Worker也可以是PS。Worker中被client用session连接的作为master,提供协调,记录,checkpoint的功能
    2. Job
      Job包含多个Task,Job的典型角色是Worker或者PS
    3. Master service
      实现接口tensorflow::Session功能,协调worker工作。每个server都有实现
    4. TensorFlow server
      每个server都实现了"master service" 和 "worker service"

    个人理解

    1. 提供的分布式功能还不是很完善
      提交脚本需要多台机器上执行,不方便
    2. 粒度为整个机器
      一个task在一台机器上可能占不满,也可能与其他job中的task相互影响,比如:都使用gpu0

    update--
    将开源资源调度工具与tensorflow分布式训练结合起来的github, ecosystem

    docker - Docker configuration for running TensorFlow on cluster managers.
    kubernetes - Templates for running distributed TensorFlow on Kubernetes.
    marathon - Templates for running distributed TensorFlow using Marathon, deployed on top of Mesos.
    hadoop - TFRecord file InputFormat/OutputFormat for Hadoop MapReduce and Spark.

    相关文章

      网友评论

        本文标题:分布式深度学习系统-容器化资源调度

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