Skip to content

Commit b5bbbc2

Browse files
author
Kent Knox
committed
Converting int types to intptr_t types for pyopencl integration
1 parent a731a5c commit b5bbbc2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/wrappers/python/pyclBLAS.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# This pxd file defines all the enums and structs that we plan to use from
1818
# python. It is used from pyclBLAS.pyx
19+
from libc.stdint cimport intptr_t, uintptr_t
1920

2021
cdef extern from "clBLAS.h":
2122
# These are base OpenCL enumerations that clBLAS uses

src/wrappers/python/pyclBLAS.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ def Sgemm( clblasOrder order, clblasTranspose transA, clblasTranspose transB,
8181
# Simplify python wrapper to only handle 1 queue at this time
8282
if( numCommandQueues != 1 ):
8383
raise IndexError( "pyblasSgemm( ) requires the number of queues to be 1" )
84-
cdef int pIntQueue = commandQueues.int_ptr
84+
cdef intptr_t pIntQueue = commandQueues.int_ptr
8585
cdef cl_command_queue pcqQueue = <cl_command_queue>pIntQueue
8686

8787
# This logic does not yet work for numEventsInWaitList > (greater than) 1
8888
# Need to figure out how python & pyopencl pass lists of objects
89-
cdef int pIntWaitList = 0
89+
cdef intptr_t pIntWaitList = 0
9090
cdef cl_event* pWaitList = NULL
9191
if( numEventsInWaitList > 0 ):
9292
if( numEventsInWaitList < 2 ):
@@ -98,9 +98,9 @@ def Sgemm( clblasOrder order, clblasTranspose transA, clblasTranspose transB,
9898
# Pyopencl objects contain an int_ptr method to get access to the internally wrapped
9999
# OpenCL object pointers
100100
cdef cl_event outEvent = NULL
101-
cdef int matA = A.int_ptr
102-
cdef int matB = B.int_ptr
103-
cdef int matC = C.int_ptr
101+
cdef intptr_t matA = A.int_ptr
102+
cdef intptr_t matB = B.int_ptr
103+
cdef intptr_t matC = C.int_ptr
104104

105105
# Transition execution to clBLAS
106106
cdef clblasStatus result = clblasSgemm( order, transA, transB, M, N, K, alpha, <const cl_mem>matA, offA, lda,
@@ -113,5 +113,5 @@ def Sgemm( clblasOrder order, clblasTranspose transA, clblasTranspose transB,
113113

114114
# Create a pyopencl Event object from the event returned from clBLAS and return
115115
# it to the user
116-
sgemmEvent = pyopencl.Event.from_int_ptr( <int>outEvent )
116+
sgemmEvent = pyopencl.Event.from_int_ptr( <intptr_t>outEvent )
117117
return sgemmEvent

0 commit comments

Comments
 (0)