Replies: 4 comments
-
array was dealed with "array=numpy.int32(array)" before the excetion. |
Beta Was this translation helpful? Give feedback.
0 replies
-
It is solved, a bug in my code. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wrote a Python script and encountered this exception:
File "C:\Users\yunwe\AppData\Local\Programs\Python\Python310\lib\site-packages\pyopencl\__init__.py", line 898, in kernel_call return self._enqueue(self, queue, global_size, local_size, *args, **kwargs) File "<pyopencl invoker for 'compute_abundance'>", line 7, in enqueue_knl_compute_abundance pyopencl._cl.LogicError: clSetKernelArg failed: INVALID_MEM_OBJECT - when processing arg#1 (1-based):
It says the memory objet input for kernel were invalid. I've searched in web and changed a lot in numpy data type.
Now all data types were int32 or float64 in numpy array. I can't figure out what should be done to solve it.
Here is the key code:
`import pyopencl as cl
import numpy
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
mf = cl.mem_flags
array = numpy.array(a 1d list here)
res = numpy.array(a same size 1d list here)
prg.function(
queue,
array.shape,
None,
cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=array),
res
)
print(res)
`
Beta Was this translation helpful? Give feedback.
All reactions