之間的差異讓Pyopencl:to_device和緩衝區
import pyopencl as cl
import pyopencl.array as cl_array
import numpy
a = numpy.random.rand(50000).astype(numpy.float32)
mf = cl.mem_flags
是什麼
a_gpu = cl.Buffer(self.ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=a)
和
a_gpu = cl_array.to_device(self.ctx, self.queue, a)
之間的區別?
,是什麼
result = numpy.empty_like(a)
cl.enqueue_copy(self.queue, result, result_gpu)
和
result = result_gpu.get()
之間的區別?
我剛剛意識到你是PyOpenCL的作者。非常感謝PyOpenCL和您的答案! – petRUShka