Skip to content

Commit

Permalink
try with #define
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Mar 19, 2024
1 parent 143f511 commit 42e883c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions python/pyarrow/array.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import warnings
from cython import sizeof

# from pyarrow.includes.libarrow_cuda cimport DefaultMemoryMapper
from pyarrow.includes.libarrow cimport DefaultDeviceMapper as DefaultMemoryMapper
# from pyarrow.includes.libarrow cimport DefaultDeviceMapper as DefaultDeviceMemoryMapper
from pyarrow.includes.libarrow_memory cimport CDefaultDeviceMemoryMapper


cdef _sequence_to_array(object sequence, object mask, object size,
Expand Down Expand Up @@ -1838,13 +1839,13 @@ cdef class Array(_PandasConvertible):
c_array = GetResultValue(
ImportDeviceArray(<ArrowDeviceArray*> c_ptr,
<ArrowSchema*> c_type_ptr,
DefaultMemoryMapper)
CDefaultDeviceMemoryMapper)
)
else:
with nogil:
c_array = GetResultValue(
ImportDeviceArray(<ArrowDeviceArray*> c_ptr, c_type,
DefaultMemoryMapper)
CDefaultDeviceMemoryMapper)
)
return pyarrow_wrap_array(c_array)

Expand Down
8 changes: 4 additions & 4 deletions python/pyarrow/includes/libarrow_memory.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ cdef extern from *:
"""
#ifdef ARROW_CUDA
#include "arrow/gpu/cuda_api.h"
using DeviceMapper = arrow::cuda::DefaultMemoryMapper;
#define CDefaultDeviceMemoryMapper(device_type, device_id) arrow::cuda::DefaultMemoryMapper(device_typem device_id)
#else
#include "arrow/c/bridge.h"
using DeviceMapper = arrow::DefaultDeviceMapper;
#define CDefaultDeviceMemoryMapper(device_type, device_id) arrow::DefaultDeviceMapper(device_type, device_id)
#endif
"""
CResult[shared_ptr[CMemoryManager]] DeviceMapper(
ArrowDeviceType device_type, int64_t device_id)
CResult[shared_ptr[CMemoryManager]] CDefaultDeviceMemoryMapper" CDefaultDeviceMemoryMapper"(
ArrowDeviceType device_type, int64_t device_id) nogil
7 changes: 4 additions & 3 deletions python/pyarrow/table.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import warnings
from cython import sizeof

# from pyarrow.includes.libarrow_cuda cimport DefaultMemoryMapper
from pyarrow.includes.libarrow cimport DefaultDeviceMapper as DefaultMemoryMapper
# from pyarrow.includes.libarrow cimport DefaultDeviceMapper as DefaultDeviceMemoryMapper
from pyarrow.includes.libarrow_memory cimport CDefaultDeviceMemoryMapper


cdef class ChunkedArray(_PandasConvertible):
Expand Down Expand Up @@ -3601,11 +3602,11 @@ cdef class RecordBatch(_Tabular):
with nogil:
c_batch = GetResultValue(ImportDeviceRecordBatch(
<ArrowDeviceArray*> c_ptr, <ArrowSchema*> c_schema_ptr,
DefaultMemoryMapper))
CDefaultDeviceMemoryMapper))
else:
with nogil:
c_batch = GetResultValue(ImportDeviceRecordBatch(
<ArrowDeviceArray*> c_ptr, c_schema, DefaultMemoryMapper))
<ArrowDeviceArray*> c_ptr, c_schema, CDefaultDeviceMemoryMapper))
return pyarrow_wrap_batch(c_batch)


Expand Down

0 comments on commit 42e883c

Please sign in to comment.