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

Pinning memory issue #11

Closed
qqaatw opened this issue Aug 4, 2021 · 1 comment
Closed

Pinning memory issue #11

qqaatw opened this issue Aug 4, 2021 · 1 comment
Assignees
Labels
Priority: High second priority Status: 3-Completed finished Type: Maintenance maintain existing codes
Milestone

Comments

@qqaatw
Copy link
Contributor

qqaatw commented Aug 4, 2021

Hi,

I'm currently using ckip-transformers-ws as a preprocessing tool in my project, and I noticed that the DataLoader's pin_memory flag was hard-coded True in util.py.

As pinning memory is incompatible with multiprocessing (or multiple workers) [1], when users leverage ckip-transformers in their collate_fn of DataLoader with multiple workers, a CUDA error will occur as shown in [1], even if only using CPU for inference.

Therefore, I think it would be better that:

  1. Pin memory only when the device is GPU.
  2. Add an option to decide whether or not to enable memory pinning.

Regards.

[1] https://discuss.pytorch.org/t/pin-memory-vs-sending-direct-to-gpu-from-dataset/33891/2

@emfomy emfomy self-assigned this Aug 8, 2021
@emfomy emfomy added Priority: High second priority Status: 1-Assigned assigned an assignee Type: Maintenance maintain existing codes labels Aug 8, 2021
@emfomy
Copy link
Member

emfomy commented Aug 8, 2021

Implemented in 0.2.7.

@emfomy emfomy closed this as completed Aug 8, 2021
@emfomy emfomy added Status: 3-Completed finished and removed Status: 1-Assigned assigned an assignee labels Aug 8, 2021
@emfomy emfomy added this to the 0.2.0 milestone Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High second priority Status: 3-Completed finished Type: Maintenance maintain existing codes
Projects
None yet
Development

No branches or pull requests

2 participants