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

Reader: enable shuffling inside every row group #767

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

chongxiaoc
Copy link
Collaborator

@chongxiaoc chongxiaoc commented Aug 9, 2022

  • Allow shuffle inside every single row group in reader.
  • Also use a shuffle seed to generate reproducible shuffle results across: single row shuffle, row groups shuffle in ventilator and sharding.

@codecov
Copy link

codecov bot commented Aug 10, 2022

Codecov Report

Merging #767 (5d18c4b) into master (3f24800) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #767      +/-   ##
==========================================
+ Coverage   86.26%   86.30%   +0.03%     
==========================================
  Files          85       85              
  Lines        5081     5095      +14     
  Branches      783      786       +3     
==========================================
+ Hits         4383     4397      +14     
  Misses        559      559              
  Partials      139      139              
Impacted Files Coverage Δ
petastorm/arrow_reader_worker.py 91.19% <100.00%> (+0.28%) ⬆️
petastorm/py_dict_reader_worker.py 95.58% <100.00%> (+0.13%) ⬆️
petastorm/reader.py 90.86% <100.00%> (+0.16%) ⬆️
petastorm/workers_pool/ventilator.py 93.33% <100.00%> (+0.09%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@chongxiaoc chongxiaoc marked this pull request as draft August 10, 2022 08:00
@chongxiaoc chongxiaoc force-pushed the reader_shuffle branch 3 times, most recently from 2a6792d to 213f4a3 Compare August 17, 2022 01:18
@chongxiaoc chongxiaoc marked this pull request as ready for review August 17, 2022 01:19
@chongxiaoc chongxiaoc changed the title Reader: shuffle row groups Reader: shuffle inside every row group Aug 18, 2022
@chongxiaoc
Copy link
Collaborator Author

Attach some benchmark result using synthetic dataset with PyTorch:

  • Experiment setup: BatchedDataLoader + make_batch_reader(), batch_size=50000, shuffle_buffer_size=1000000, thread_pool, 10 workers.
  • Datasets from 100M rows to 1.6B rows are tested.
  • Compare throughput of shuffle in dataloader and shuffle in reader .

Synthetic Dataset PyTorch Throughput

Using shuffle in reader is expected to generate higher throughput since multiple workers are shuffling in parallel.

fyi @selitvin

Copy link
Collaborator

@selitvin selitvin left a comment

Choose a reason for hiding this comment

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

Looks good! Just few minor comments. Also, please update release notes.

petastorm/arrow_reader_worker.py Outdated Show resolved Hide resolved
shuffle_row_groups=True, shuffle_row_drop_partitions=1,
predicate=None,
rowgroup_selector=None,
num_epochs=1,
cur_shard=None, shard_count=None, shard_seed=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we keep both seeds for now for the next couple of versions and add a deprecation warning? That way we don't break compatibility but give users a warning.

petastorm/reader.py Outdated Show resolved Hide resolved
petastorm/tests/test_parquet_reader.py Show resolved Hide resolved
@chongxiaoc chongxiaoc changed the title Reader: shuffle inside every row group Reader: enable shuffling inside every row group Aug 23, 2022
@chongxiaoc chongxiaoc force-pushed the reader_shuffle branch 3 times, most recently from c8240d5 to 030346b Compare August 23, 2022 01:18
docs/release-notes.rst Show resolved Hide resolved
Also use a shuffle seed to generate reproducible shuffle results across:
single row shuffle, row groups shuffle in ventilator and sharding.
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

Successfully merging this pull request may close these issues.

None yet

2 participants