zeroshade commented on code in PR #42010:
URL: https://github.com/apache/arrow/pull/42010#discussion_r1643489222


##########
cpp/src/arrow/pretty_print.cc:
##########
@@ -413,18 +414,36 @@ Status ArrayPrinter::WriteValidityBitmap(const Array& 
array) {
   }
 }
 
+Result<std::shared_ptr<Array>> CopyStartEndToCPU(const Array& arr, int window) 
{
+  std::shared_ptr<Array> arr_sliced;
+  if (arr.length() > (2 * window + 1)) {
+    ARROW_ASSIGN_OR_RAISE(auto arr_start,
+                          arr.Slice(0, window + 
1)->CopyTo(default_cpu_memory_manager()));
+    ARROW_ASSIGN_OR_RAISE(
+        auto arr_end,
+        arr.Slice(arr.length() - window - 
1)->CopyTo(default_cpu_memory_manager()));
+    ARROW_ASSIGN_OR_RAISE(arr_sliced, Concatenate({arr_start, arr_end}));
+  } else {
+    ARROW_ASSIGN_OR_RAISE(arr_sliced, 
arr.CopyTo(default_cpu_memory_manager()));

Review Comment:
   @felipecrv why does it fallback to a full buffer copy if the source 
`MemoryManager` isn't a CPU memory manager? Couldn't it just use `cuMemCpy` 
with the appropriate offset into the buffer?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to