随笔分类 -  openCL

opencl(十八)----矩阵转置、矩阵乘法
摘要:矩阵转置 // kernel __kernel void transpose(__global float4 *g_mat, __local float4 *l_mat, uint size) { __global float4 *src, *dst; /* Determine row and co 阅读全文

posted @ 2020-01-05 22:34 feihu_h 阅读(1325) 评论(0) 推荐(0)

opencl(十七)----基数排序
摘要:基数排序原理: 分桶,遍历每一个有效位,根据该位中是0还是1进行分组。 设备代码: __kernel void radix_sort8(__global ushort8 *global_data) { typedef union { ushort8 vec; ushort array[8]; } v 阅读全文

posted @ 2020-01-05 21:38 feihu_h 阅读(640) 评论(0) 推荐(0)

opencl(二十五)----双调排序
摘要:参考:《opencl实战》 双调排序 一个序列:进行升序排列 6 1 4 5 7 2 3 8 a、左右两部分别 升序、降序 1 4 5 6 8 7 3 2 b 、左右度应位置比较,小的左移 1 4 3 2 8 7 5 6 c、左右都整成升序 1 2 3 4 5 6 7 8 注:四个元素如何排序 op 阅读全文

posted @ 2020-01-05 18:38 feihu_h 阅读(999) 评论(0) 推荐(0)

opencl(二十一)----直方图
摘要:计算RGB图像的直方图 // kernel __kernel void histogram(__global uchar* imgdata, __global uint *histogram, __local uint *local_histogram, uint data_size_item, u 阅读全文

posted @ 2020-01-04 22:05 feihu_h 阅读(678) 评论(0) 推荐(0)

opencl(十六)----MapReduce
摘要:MapReduce 两个部分: 映射:产生键值对 归并:处理这些键值对 demo: 统计模式串在文本中的频次 // kernel __kernel void string_search(char16 pattern, __global char* text, int chars_per_item, 阅读全文

posted @ 2019-12-30 12:55 feihu_h 阅读(400) 评论(0) 推荐(0)

opencl(十三)---图像处理内建函数
摘要:读取图像 read_imagef (2D) : https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/read_imagef2d.html read_imagef (3D) :https://www.khronos.org/re 阅读全文

posted @ 2019-12-27 11:29 feihu_h 阅读(1060) 评论(0) 推荐(0)

opencl(十二)----图像对象、采样器
摘要:图像对象、采样器在主机和设备上使用不同的数据结构。 图像对象 主机: cl_mem https://www.cnblogs.com/feihu-h/p/12081652.html 设备: image2d_t 、image3d_t 采样器 主机: cl_sampler 设备: sampler_t 主机 阅读全文

posted @ 2019-12-27 11:08 feihu_h 阅读(1153) 评论(0) 推荐(0)

opencl(十一)----混洗、选择
摘要:混洗函数 可以参考: https://www.khronos.org/registry/OpenCL/sdk/1.1/docs/man/xhtml/shuffle.html // 创建一个包含x中元素的向量,包含哪些元素有 mask 控制 gentypen shuffle ( gentypem x, 阅读全文

posted @ 2019-12-25 17:55 feihu_h 阅读(849) 评论(0) 推荐(0)

opencl(十)----标量、向量类型的相关运算
摘要:OpenCL operators 参考:https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/ int4 vec = (int4)(1, 2, 3, 4); vec += 4;//每一个元素加上4 vec &= (int4)(- 阅读全文

posted @ 2019-12-24 18:08 feihu_h 阅读(2819) 评论(0) 推荐(0)

opencl(九)----标量、向量数据类型
摘要:1、opencl 标量数据类型 bool char unsigned char/uchar short 16位有符号整数(补码) ushort int 32位有符号整数(补码) uint 32位无符号 long 64位有符号 ulong half 16位浮点数 float 32位浮点数 intptr 阅读全文

posted @ 2019-12-24 15:33 feihu_h 阅读(1815) 评论(0) 推荐(0)

opencl(八)----clEnqueueNDRangeKernel、clEnqueueTask、工作组和工作项
摘要:clEnqueueNDRangeKernel cl_int clEnqueueNDRangeKernel ( cl_command_queue command_queue, //命令队列 cl_kernel kernel, //核 cl_uint work_dim, //数据的维度 const si 阅读全文

posted @ 2019-12-23 17:05 feihu_h 阅读(3417) 评论(0) 推荐(0)

opencl(七)----读写传输命令、内存映射命令
摘要:Read读(从设备到主机) // 将缓存对象中的数据读到内存对象中 cl_int clEnqueueReadBuffer ( cl_command_queue command_queue, //命令队列 cl_mem buffer, // 缓存对象 cl_bool blocking_read, // 阅读全文

posted @ 2019-12-23 16:38 feihu_h 阅读(2452) 评论(0) 推荐(0)

opencl(六)----图像对象
摘要:图像对象同样使用cl_mem数据结构 创建图像对象 // 创建2D的图像对象cl_mem clCreateImage2D ( cl_context context, //上下文 cl_mem_flags flags, // 对象性质标签 const cl_image_format *image_fo 阅读全文

posted @ 2019-12-22 23:18 feihu_h 阅读(1038) 评论(0) 推荐(0)

opencl(五)----缓存对象
摘要:创建缓存对象 参考:https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clCreateBuffer.html // 创建缓存对象 cl_mem clCreateBuffer ( cl_context context, //上 阅读全文

posted @ 2019-12-22 23:01 feihu_h 阅读(566) 评论(0) 推荐(0)

opencl(四)----创建命令队列
摘要:创建命令队列 参考:https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clCreateCommandQueue.html //创建命令队列 cl_command_queue clCreateCommandQueue( cl_ 阅读全文

posted @ 2019-12-22 22:15 feihu_h 阅读(761) 评论(0) 推荐(0)

opencl(三)----创建、编译程序(cl_program)、创建内核
摘要:1、创建程序 // 从文本中创建程序 cl_program clCreateProgramWithSource ( cl_context context, // 上下文 cl_uint count, //文本个数 const char **strings, // 程序文本 const size_t 阅读全文

posted @ 2019-12-22 22:00 feihu_h 阅读(1890) 评论(0) 推荐(0)

opencl(二)----平台、设备、上下文的获取
摘要:1、获取平台 参考:https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clGetPlatformInfo.html cl_int clGetPlatformIDs( cl_uint num_entries, //想要获取的平 阅读全文

posted @ 2019-12-22 20:50 feihu_h 阅读(1350) 评论(0) 推荐(0)

导航