[ 
https://issues.apache.org/jira/browse/ARROW-4861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Antoine Pitrou updated ARROW-4861:
----------------------------------
    Description: 
Exposing such a method could be useful to initialize a buffer without going 
through a CPU-to-device memory copy.

For example CUDA expose several memset-like APIs to initialize GPU memory with 
different initializer widths:
https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__MEM.html#group__CUDA__MEM_1g6e582bf866e9e2fb014297bfaf354d7b


  was:
One can define a device MemoryPool subclass (say, CudaMemoryPool) that can be 
used for creating a Buffer representing a device memory. The prerequisite for 
this to work is that all Buffer memory operations (allocation, deallocation, 
reallocation, etc) can be redefined to use the corresponding device specific 
operations. No host specific operation would be allowed as the device memory 
would be inaccesible from host.

Currently, this is almost possible. Namely, `Buffer::ZeroPadding` uses host 
specific `memset` function for zero-padding the allocated Buffer memory.

Suggestion: introduce a new method `MemoryPool::Memset` that 
`Buffer::ZeroPadding` can use.

The Memset method would use `memset` by default but device specific MemoryPool 
subclasses can override the method to use device driver version of the memset 
function.


> [C++] Introduce MemoryManager::Memset method.
> ---------------------------------------------
>
>                 Key: ARROW-4861
>                 URL: https://issues.apache.org/jira/browse/ARROW-4861
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Pearu Peterson
>            Assignee: Pearu Peterson
>            Priority: Major
>              Labels: C++
>             Fix For: 2.0.0
>
>
> Exposing such a method could be useful to initialize a buffer without going 
> through a CPU-to-device memory copy.
> For example CUDA expose several memset-like APIs to initialize GPU memory 
> with different initializer widths:
> https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__MEM.html#group__CUDA__MEM_1g6e582bf866e9e2fb014297bfaf354d7b



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to