Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

进行 tensorflow on k8s 多机多卡的验证试验 #42

Open
xuerq opened this issue Dec 15, 2016 · 3 comments
Open

进行 tensorflow on k8s 多机多卡的验证试验 #42

xuerq opened this issue Dec 15, 2016 · 3 comments

Comments

@xuerq
Copy link
Contributor

xuerq commented Dec 15, 2016

在 titanx01、titanx02 上验证 tensorflow on k8s 多机多卡试验
试验环境:

  1. 物理节点:titanx01、titanx02
  2. 启动、运行方式 :Replication Controllers,暂未验证Job方式
  3. 备注:未使用 ceph 、未使用 skydns
  4. 由于没有skydns,实验中先 create service 得到节点 ip 后再 create rc

试验记录:

  1. 在 titanx01 单机进行多卡试验(通过)
    a. 启动 1 个ps pod、2 个 worker pod ,GPU 可以正确分配,training 过程可以正常启动
    b. delete rc 后上一步创建的3个 pod 会一直处于Terminating ,k8s 上的 GPU 配额也无法释放,新建训练任务无法分配到该 GPU 。
    c. 通过 kubectl delete pod ${POD_NAME} --grace-period=0 强制删除 pod 后 Terminating 的 pod 消失、 GPU 配额也正确回收了。开始认为强制删除命令不生效,其实是处理时间比较长,需要等待物理机释放掉 pod 对应的容器。此过程需要3min ~5min
    d. 删除 rc 并强制删除 pod 后,重复启动训练,发现GPU已经可以重新分配使用了

  2. 在 titanx01 titanx02 进行多机多卡试验(未通过)
    a. 使用与1相同的 yaml ,只是将 worker1 指定到 titanx02 上创建。这样,ps 和 worker0 在 titanx01 上创建、worker1 在 titanx02 上创建
    b. titanx01 上的 ps 和 worker0 节点可以正常启动,但 titanx02 上的 worker1 无法连通在 titanx01 上创建的 ps 和 worker0 节点
    ...
    E1215 06:29:31.365695191 162 tcp_client_posix.c:191] failed to connect to 'ipv4:10.100.0.38:2222': timeout occurred
    E1215 06:30:22.765198575 161 tcp_client_posix.c:191] failed to connect to 'ipv4:10.100.0.205:2222': timeout occurred
    ...

@pineking
Copy link
Collaborator

pineking commented Dec 15, 2016

赞锐青!

  • 做实验用的 yaml 文件也可以放进来,方便别人实验
  • 多机多卡等我把 skydns 搞起来,你可以再实验,不过我这两天要先写分享会的 ppt
  • 你可以试试单机通过创建 Job 任务看如何,这样不需要自己 delete rc 了 http://kubernetes.io/docs/user-guide/jobs/

@xuerq
Copy link
Contributor Author

xuerq commented Dec 19, 2016

已将试验过程merge到了这个pr上
https://github.com/k8sp/k8s-tensorflow/tree/k8s_gpu_tensorflow/examples/k8s_gpu_tensorflow

  1. 单 node + 多gpu ,可以正常分配 gpu 并启动训练
  2. job 方式验证通过,但删除 job 后还需要手工删除 pod
  3. 启动 pod 时候使用了裸替 ip 而没有使用 dns
  4. 暂时还无法验证多卡跨多 node 训练

@xuerq
Copy link
Contributor Author

xuerq commented Dec 19, 2016

  1. 多机多卡运行训练测试通过
    titanx01:ps、worker0
    titanx02:worker1、worker2

  2. 调研 kind: Job

调研目的:是否可以单个 Job 定义多个 tensorflow worker 节点

a. 一个 Job 可以通过 parallelism,completions 字段设置并发 pod 数量和 计算完成并成功退出的 pod 数量(标志着这个 Job 成功与否)。但每个 pod 的行为是一致的

b. paddle 使用 Job 的例子,似乎 paddle 每个节点的运行脚本和参数都是一样的,所以可以直接套用 Job
https://github.com/PaddlePaddle/Paddle/blob/b530a72244c2dbd8b36d3411eb4d4bbb98faff01/doc/howto/usage/cluster/k8s/k8s_distributed_cn.md

c. tensorflow 每个worker 节点的运行脚本的部分参数不一样,主要是需要显式设置 worker 节点的 id (e.g. 0 1 2 3....)。处不太容易处理。但每个 job 对应一个单独的 worker 节点是没问题的

d. kubernetes 官方文档对 kind: Job的说明如下:
The Job object is not designed to support closely-communicating parallel processes, as commonly found in scientific computing. It does support parallel processing of a set of independent but related work items. These might be emails to be sent, frames to be rendered, files to be transcoded, ranges of keys in a NoSQL database to scan, and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants