Skip to content

Conversation

@robertmaynard
Copy link
Contributor

Here is the results of looking at the cudaPointerGetAttributes of different allocation types on Grace + Hopper. Allocations of malloc are still usable on the GPU.

ccudaPointerGetAttributes attributes malloc ptr
  is_dev_ptr  -> 1
  is_host_ptr -> 1
  memory loc  -> unregistered

cudaPointerGetAttributes attributes cudaMalloc ptr
  is_dev_ptr  -> 1
  is_host_ptr -> 0
  memory loc  -> device

cudaPointerGetAttributes attributes cudaMallocManaged cudaMemAttachGlobal ptr
  is_dev_ptr  -> 1
  is_host_ptr -> 1
  memory loc  -> managed

Here is the results of looking at the cudaPointerGetAttributes
of different allocation types on Grace + Hopper. Allocations
of `malloc` are still usable on the GPU.
```
ccudaPointerGetAttributes attributes malloc ptr
  is_dev_ptr  -> 1
  is_host_ptr -> 1
  memory loc  -> unregistered

cudaPointerGetAttributes attributes cudaMalloc ptr
  is_dev_ptr  -> 1
  is_host_ptr -> 0
  memory loc  -> device

cudaPointerGetAttributes attributes cudaMallocManaged cudaMemAttachGlobal ptr
  is_dev_ptr  -> 1
  is_host_ptr -> 1
  memory loc  -> managed

```
@robertmaynard robertmaynard requested a review from a team as a code owner November 1, 2024 21:09
@github-actions github-actions bot added the cpp label Nov 1, 2024
@benfred benfred added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Nov 2, 2024
@cjnolet
Copy link
Member

cjnolet commented Nov 4, 2024

@robertmaynard I just wanted to point out that with our mdspan APIs, we classify pointers as to their accessability instead of a direct classification of host vs device. That is, a device_mdspan only means the pointer can be read accessed from device and a host_mdspan means only that the pointer can be accessed from host. This way, we really didn't much need a managed_msdpan (though we create a managed_mdarray since that needs to know to use cudaMallocManaged.

@cjnolet
Copy link
Member

cjnolet commented Nov 4, 2024

/merge

@rapids-bot rapids-bot bot merged commit 3ac2063 into rapidsai:branch-24.12 Nov 4, 2024
55 checks passed
@robertmaynard robertmaynard deleted the bug/device_ptrs_can_be_host_ptrs branch November 4, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cpp improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Development

Successfully merging this pull request may close these issues.

3 participants