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

[FEA] Add a pinned memory resource #136

Closed
jrhemstad opened this issue Sep 26, 2019 · 12 comments
Closed

[FEA] Add a pinned memory resource #136

jrhemstad opened this issue Sep 26, 2019 · 12 comments
Labels

Comments

@jrhemstad
Copy link
Contributor

Is your feature request related to a problem? Please describe.

There's currently no memory resource for allocating pinned memory (e.g., cudaHostAlloc).

Describe the solution you'd like

There should be a pinned_memory_resource.

Additional context
Inspired by rapidsai/cudf#2872 (comment)

@jrhemstad jrhemstad added doc Documentation feature request New feature or request good first issue Good for newcomers and removed doc Documentation labels Sep 26, 2019
@UmashankarTriforce
Copy link

I would like to work on this issue. May I know more details on this issue?

@jrhemstad
Copy link
Contributor Author

You can look at the cuda_device_resource as an example.

The pinned_memory_resource should be similar to this, but use cudaHostAlloc and cudaFreeHost instead of cudaMalloc/cudaFree.

Then update the tests to test the new resource: https://github.com/rapidsai/rmm/blob/branch-0.10/tests/mr/mr_tests.cpp#L88

@UmashankarTriforce
Copy link

Alright thanks for the information! I'll work on it and send a PR 😄

@jakirkham
Copy link
Member

This was done in PR ( #272 ), right?

@jrhemstad
Copy link
Contributor Author

This was done in PR ( #272 ), right?

The difference is in a host_memory_resource vs. a device_memory_resource. Pinned memory (like managed) is kind of an oddball in that it can be host or device memory.

@jakirkham
Copy link
Member

Oh, I didn't realize pinned memory could be treated like device memory. Had assumed it was just page locked host memory. Is that not right? What am I missing here?

@harrism
Copy link
Member

harrism commented Jul 21, 2020

It is just that, but CUDA devices are able to access it directly as if it were device memory.
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#page-locked-host-memory

@jakirkham
Copy link
Member

Would it make sense to use pool_memory_resource with a pinned_memory_resource then? Or am I getting carried away? 😅

@harrism
Copy link
Member

harrism commented Jul 21, 2020

Conceptually yes. However as Jake pointed out in another issue/PR, the problem is we have specific device_memory_resource tests which check that the returned pointer is a device pointer. I think we could actually expand that to instead just check that the memory is device accessible. To do that we would just check that the type is NOT cudaMemoryTypeUnregistered, and then device MRs could be used with device memory, managed memory, or registered (pinned) host memory.

@github-actions
Copy link

This issue has been marked rotten due to no recent activity in the past 90d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

@github-actions
Copy link

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.

@harrism
Copy link
Member

harrism commented Feb 16, 2021

Superseded by #618

@harrism harrism closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants