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

Interaction Nvidia DALI and Squirrel #104

Merged
merged 2 commits into from
Feb 14, 2023
Merged

Interaction Nvidia DALI and Squirrel #104

merged 2 commits into from
Feb 14, 2023

Conversation

axkoenig
Copy link
Contributor

@axkoenig axkoenig commented Dec 19, 2022

Description

Describes in detail how Squirrel and DALI can work together. Also includes benchmarks on how to best utilize DALI and how it compares to transforms in Torchvision.

Attaching PDF rendered version of the Sphinx documentation here. Unfortunately, I couldn't get syntax highlighting to work.

Apparent next steps are figuring out how Squirrel and DALI can work together in multi-processing. It is not obvious how we could implement this, and if this provides a performance boost. Using a DALI parallel external source would probably be the way to go, but DALI expects a callable here that fetches individual images given a specific image index. This can be implemented easily if we set shard-size=1, but our initial experiments showed that larger shard sizes are more desirable.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring including code style reformatting
  • Other (please describe):

Checklist:

  • I have read the contributing guideline doc (external contributors only)
  • Lint and unit tests pass locally with my changes
  • I have kept the PR small so that it can be easily reviewed
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • All dependency changes have been reflected in the pip requirement files.

@axkoenig axkoenig requested a review from pzdkn December 19, 2022 15:41
@github-actions
Copy link

This is PR is marked as stale as it has been inactive for 30 days. It will be closed in 7 days.

Copy link
Contributor

@pzdkn pzdkn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM!

Its surprising that increasing threads doesn't have much impact. Do you have an intuition on this ?

@axkoenig
Copy link
Contributor Author

Hi @pzdkn,
thanks for taking a look at this. Squirrel already does multi-threading under the hood by default to fetch the shards from the disk, so I believe that's why adding even more threads with DALI doesn't help. What is very interesting, is the multi-processing case, where I would expect a significant boost in overall loading speed, but it is not trivial to implement, because DALI expects a source that fetches samples by data index (afaik you can think of it as a map-style dataset), which is not obvious to implement in squirrel (unless your shard size is 1, then you can simply fetch each key - but as we know having such small shard sizes will slow squirrel down, so unsure what the overall boost here would be).
Anyway, thanks again - merging now.
Cheers,
a

@axkoenig axkoenig merged commit 25e9b85 into main Feb 14, 2023
@axkoenig axkoenig deleted the ak-add-dali-docs branch February 14, 2023 07:32
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants