pyopencl

How to pass a list of strings to an opencl kernel using pyopencl?

我只是一个虾纸丫 提交于 2019-12-01 11:59:12
How to pass list of strings to an opencl kernel the right way? I tried this way using buffers (see following code), but I failed. OpenCL (struct.cl): typedef struct{ uchar uc[40]; } my_struct9; inline void try_this7_now(__global const uchar * IN_DATA , const uint IN_len_DATA , __global uchar * OUT_DATA){ for (unsigned int i=0; i<IN_len_DATA ; i++) OUT_DATA[i] = IN_DATA[i]; } __kernel void try_this7(__global const my_struct9 * pS_IN_DATA , const uint IN_len , __global my_struct9 * pS_OUT){ uint idx = get_global_id(0); for (unsigned int i=0; i<idx; i++) try_this7_now(pS_IN_DATA[i].uc, IN_len, pS

How to pass a list of strings to an opencl kernel using pyopencl?

给你一囗甜甜゛ 提交于 2019-12-01 09:48:29
问题 How to pass list of strings to an opencl kernel the right way? I tried this way using buffers (see following code), but I failed. OpenCL (struct.cl): typedef struct{ uchar uc[40]; } my_struct9; inline void try_this7_now(__global const uchar * IN_DATA , const uint IN_len_DATA , __global uchar * OUT_DATA){ for (unsigned int i=0; i<IN_len_DATA ; i++) OUT_DATA[i] = IN_DATA[i]; } __kernel void try_this7(__global const my_struct9 * pS_IN_DATA , const uint IN_len , __global my_struct9 * pS_OUT){

Passing struct with pointer members to OpenCL kernel using PyOpenCL

拥有回忆 提交于 2019-11-30 23:38:57
Let's suppose I have a kernel to compute the element-wise sum of two arrays. Rather than passing a, b, and c as three parameters, I make them structure members as follows: typedef struct { __global uint *a; __global uint *b; __global uint *c; } SumParameters; __kernel void compute_sum(__global SumParameters *params) { uint id = get_global_id(0); params->c[id] = params->a[id] + params->b[id]; return; } There is information on structures if you RTFM of PyOpenCL [1], and others have addressed this question too [2] [3] [4]. But none of the OpenCL struct examples I've been able to find have

ERROR: pyopencl: creating context for specific device

人走茶凉 提交于 2019-11-30 16:20:05
问题 I want to create context for specific device on my platform. But I am getting an error. Code: import pyopencl as cl platform = cl.get_platforms() devices = platform[0].get_devices(cl.device_type.GPU) ctx = cl.Context(devices[0]) The error i am getting: Traceback (most recent call last): File "D:\Programming\Programs_OpenCL_Python\Matrix Multiplication\3\main3.py", line 16, in <module> ctx = cl.Context(devices[0]) AttributeError: 'Device' object has no attribute '__iter__' The program compiles