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

Fix race condition in the CPU numpy reader #4848

Merged
merged 1 commit into from
May 12, 2023

Conversation

JanuszL
Copy link
Contributor

@JanuszL JanuszL commented May 11, 2023

  • when the last sample in the numpy reader is duplicated
    due to padding, the reader tries to read the same
    sample to the same memory, but from different clones of it
    concurrently. This PR removed this
    redundant and dangerous work, making sure that each sample is read
    only once.

Category:

Other (e.g. Documentation, Tests, Configuration)

Description:

  • when the last sample in the numpy reader is duplicated
    due to padding, the reader tries to read the same
    sample to the same memory, but from different clones of it
    concurrently. This PR removed this
    redundant and dangerous work, making sure that each sample is read
    only once.

Additional information:

Affected modules and functionalities:

  • CPU numpy reader

Key points relevant for the review:

  • NA

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
    • test_numpy.test_pad_last_sample
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

- when the last sample in the numpy reader is duplicated
  due to padding, the reader tries to read the same
  sample to the same memory, but from different clones of it
  concurrently. What is more the memory that is read can be
  allocated and deallocated concurrently. This PR removed this
  redundant and dangerous work, making sure that each sample is read
  only once.

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@JanuszL
Copy link
Contributor Author

JanuszL commented May 11, 2023

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [8256693]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [8256693]: BUILD PASSED

@JanuszL JanuszL merged commit 39d1660 into NVIDIA:main May 12, 2023
@JanuszL JanuszL deleted the fix_race_condition branch May 12, 2023 14:30
stiepan pushed a commit that referenced this pull request May 12, 2023
- when the last sample in the numpy reader is duplicated
  due to padding, the reader tries to read the same
  sample to the same memory, but from different clones of it
  concurrently. What is more the memory that is read can be
  allocated and deallocated concurrently. This PR removed this
  redundant and dangerous work, making sure that each sample is read
  only once.

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@JanuszL JanuszL mentioned this pull request Sep 6, 2023
JanuszL added a commit to JanuszL/DALI that referenced this pull request Oct 13, 2023
- when the last sample in the numpy reader is duplicated
  due to padding, the reader tries to read the same
  sample to the same memory, but from different clones of it
  concurrently. What is more the memory that is read can be
  allocated and deallocated concurrently. This PR removed this
  redundant and dangerous work, making sure that each sample is read
  only once.

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
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.

4 participants