NVIDIA / NVIDIA/cccl

[BUG]: `thrust::host_vector` with `universal_host_pinned_memory_resource` uses a kernel to initialize memory

Open
#1,192 2 comments 0 reactions 1 assignee Claimed by @bernhardmgruber View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Something else

### Component

Thrust

### Describe the bug

The profiler shows that the following code executes a kernel.

```
[5/7] Executing 'cuda_gpu_kern_sum' stats report

Time (%) Total Time (ns) Instances Avg (ns) Med (ns) Min (ns) Max (ns) StdDev (ns) Name
-------- --------------- --------- --------- --------- -------- -------- ----------- ----------------------------------------------------------------------------------------------------
100,0 320.130 1 320.130,0 320.130,0 320.130 320.130 0,0 void thrust::cuda_cub::core::_kernel_agent
#include
#include

int main(){
using Allocator = thrust::mr::stateless_resource_allocator<
int, thrust::universal_host_pinned_memory_resource>;

thrust::host_vector vec(1024*1024);
}
```

### Expected behavior

I expect the host to initialize the memory to avoid pcie transfer.

### Reproduction link

_No response_

### Operating System

_No response_

### nvidia-smi output

_No response_

### NVCC version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.