NVIDIA / NVIDIA/DALI

How to copy the images from GPU to CPU more efficiently?

Open
#1,291 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement external contribution welcome
Dominant language
C++
Stars
5.8k
Forks
678
Avg merge
3d 1h
Merged PRs (30d)
27

Description

I want to feed the images to keras with dali's preprocessing pipeline. So I have to transform the gpu tensor to array at first. The code is:

x, y = pipe.run()
x = x.as_cpu().as_array()
y = y.as_cpu().as_array()

But it is very slow and about 200-300 images per second. Is there a faster way?
Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's pipe.run(), as_cpu(), and as_array() calls, then investigate where the GPU-to-CPU transfer and array conversion spend time. Compare the current path with any documented DALI integration for Keras and define done as a faster, benchmarked way to provide the images to the training pipeline.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.