[jira] [Commented] (ARROW-4861) [C++] Introduce MemoryPool::Memset method.

2020-02-03 Thread Antoine Pitrou (Jira)


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

Antoine Pitrou commented on ARROW-4861:
---

The PR for ARROW-2447 exposes a {{MemoryManager}} class, where we could add 
said {{Memset}} method.

> [C++] Introduce MemoryPool::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
>
>
> 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.



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


[jira] [Commented] (ARROW-4861) [C++] Introduce MemoryPool::Memset method.

2019-03-14 Thread Pearu Peterson (JIRA)


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

Pearu Peterson commented on ARROW-4861:
---

No. As discussed in ARROW-2447 , a Device would not be a good representative of 
a memory address origin. In certain cases (Managed Memory, Pinned/Host Memory), 
the memory address would be accessible from both CPU as well as from device.

A virtual address space should be considered as a notation where only one set 
of memory management operations (allocation, deallocation, copy, memset, fill, 
etc) can be applied.

MemoryPool would be a better representative (than Device) of a virtual address 
space that contains addresses pointing to memories of different devices. 
Although at hardware/driver level the addresses will be translated to the 
actual addresses of device memories, these translations are transparent to 
Arrow processes.

> [C++] Introduce MemoryPool::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++
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (ARROW-4861) [C++] Introduce MemoryPool::Memset method.

2019-03-14 Thread Wes McKinney (JIRA)


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

Wes McKinney commented on ARROW-4861:
-

It seems like this is a property of the device, not the MemoryPool. Should we 
implement a Device abstract interface with these methods?

> [C++] Introduce MemoryPool::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++
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (ARROW-4861) [C++] Introduce MemoryPool::Memset method.

2019-03-14 Thread Pearu Peterson (JIRA)


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

Pearu Peterson commented on ARROW-4861:
---

Yes, also places with fill and memcpy would need to be updated to use the 
corresponding functions provided by MemoryPool implementation.

Currently, memcpy, memset, std::copy, dereferencing are used in `Buffer` and 
`BufferBuilder` methods. These ought to be replaced with the respective methods 
from MemoryPool.

Of course, these host specific memory functions are also used elsewhere but 
these are not relevant for manipulating device memory buffers.

Btw, this issue is a part of ARROW-2447 story that aims at extending Arrow 
buffer usages to accelerator device applications.

> [C++] Introduce MemoryPool::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++
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (ARROW-4861) [C++] Introduce MemoryPool::Memset method.

2019-03-13 Thread Micah Kornfield (JIRA)


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

Micah Kornfield commented on ARROW-4861:


I'm not familiar with Cuda/GPUs but would this also need touch places that use 
std::fill and memcpy?  What about raw memory address access?

> [C++] Introduce MemoryPool::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++
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)