Can Kubeflow Pipelines run GPU components in parallel?

4/27/2020

I am trying to build a kubeflow pipeline where I run two components (with a GPU constraint) in parallel. It seemed like a non-issue, but every time I tried it, one component would get stuck at "pending" until the other component is done.

Example run

The two components I am testing are simple while loops with a GPU constraint:

while_op1 = while_loop_op(image_name='tensorflow/tensorflow:1.15.2-py3')
while_op1.name = 'while-1-gpu'
while_op1.set_security_context(V1SecurityContext(privileged=True))
while_op1.apply(gcp.use_gcp_secret('user-gcp-sa'))
while_op1.add_pvolumes({pv_base_path: _volume_op.volume})
while_op1.add_node_selector_constraint('cloud.google.com/gke-accelerator', 'nvidia-tesla-p100')
while_op1.set_gpu_limit(1)
while_op1.after(init_op)

Where while_loop_op:

import kfp.components as comp
def while_loop_op(image_name):
  def while_loop():
    import time
    max_count = 300
    count = 0
    while True:
      if count >= max_count:
        print('Done.')
        break
      time.sleep(10)
      count += 10
      print("{} seconds have passed...".format(count))
  op = comp.func_to_container_op(while_loop, base_image=image_name)
  return op()
-- RawChicken
kubeflow
kubeflow-pipelines
kubernetes
python

0 Answers