OpenCL 1.0 Specification阅读笔记(3)
2010-11-02 22:39
309 查看
5. The OpenCL Runtime
5.2 Memory Objects
(1) buffer objects: 1-dim: scalar, vector, user-defined structure
(2) image objects: 2-dims or 3-dims texture, frame buffer and image: image format
memory object的元素至少为1
buffer的结构是显式的,指针访问,类型一致;image的结构是隐式的,不能用指针访问,类型可以隐式转换
cl_mem_flag:
read_write/read_only/write_only buffer,
(1) use_host_ptr: mapping device memory ptr or pcie memory ptr to host ptr
(2) copy_host_ptr: allocate memory on device or pcie and then copy host_ptr's content to
(3) alloc_host_ptr: allocate memory on host memory
read/write buffer command should be enqueued into command queue
(1) clEnqueueReadBuffer
(2) clEnqueueWriteBuffer
(3) clEnqueueCopyBuffer
概念:
(1) blocking or non-blocking: 同步读写或异步读写的问题,当异步时,使用event来query是否完成
(2) event_wait_list and num_event_in_wait_list: 当列表中的事件都完成时,才可执行读(写)操作
clRetainMemObject
clReleaseMemObject
注意:image中每个元素的字节数是2的平方数
clCreateImage3D与clCreateImage2D差不多
而Image Format Descriptor结构分成两部分:
(1) image_channel_order: channel数和Layout,即memory layout
(2) image_channel_data_type: channel数据类型的大小
to be continued .....
5.2 Memory Objects
(1) buffer objects: 1-dim: scalar, vector, user-defined structure
(2) image objects: 2-dims or 3-dims texture, frame buffer and image: image format
memory object的元素至少为1
buffer的结构是显式的,指针访问,类型一致;image的结构是隐式的,不能用指针访问,类型可以隐式转换
cl_mem clCreateBuffer( cl_context context, cl_mem_flag flags, size_t size, void *host_ptr, cl_int *errcode_ret);
cl_mem_flag:
read_write/read_only/write_only buffer,
(1) use_host_ptr: mapping device memory ptr or pcie memory ptr to host ptr
(2) copy_host_ptr: allocate memory on device or pcie and then copy host_ptr's content to
(3) alloc_host_ptr: allocate memory on host memory
read/write buffer command should be enqueued into command queue
(1) clEnqueueReadBuffer
(2) clEnqueueWriteBuffer
(3) clEnqueueCopyBuffer
概念:
(1) blocking or non-blocking: 同步读写或异步读写的问题,当异步时,使用event来query是否完成
(2) event_wait_list and num_event_in_wait_list: 当列表中的事件都完成时,才可执行读(写)操作
clRetainMemObject
clReleaseMemObject
cl_mem clCreateImage2D( cl_context context, cl_mem_flag flags, const cl_image_format *image_format, size_t image_width, size_t image_height, size_t image_row_pitch, void *host_ptr, cl_int *errcode_ret );
注意:image中每个元素的字节数是2的平方数
clCreateImage3D与clCreateImage2D差不多
而Image Format Descriptor结构分成两部分:
(1) image_channel_order: channel数和Layout,即memory layout
(2) image_channel_data_type: channel数据类型的大小
to be continued .....
相关文章推荐
- OpenCL 1.0 Specification阅读笔记(4)
- OpenCL 1.0 Specification阅读笔记(2)
- OpenCL 1.0 Specification阅读笔记(8)
- OpenCL 1.0 Specification阅读笔记(7)
- OpenCL 1.0 Specification阅读笔记(5)
- OpenCL 1.0 Specification阅读笔记(6)
- OpenCL 1.0 Specification阅读笔记(1)
- OpenCL 1.0 Specification阅读笔记(9)
- JAIN SLEE 1.0 Specification 阅读笔记(二)
- JAIN SLEE 1.0 Specification 阅读笔记(一)
- 阅读笔记-OpenCL:Parallel Computing on the GPU and CPU(Aaftab Munshi)
- AMD OpenCL例子阅读笔记系列之Radix_Sort(四)
- AMD OpenCL例子阅读笔记系列之AtomicCounters
- AMD OpenCL例子阅读笔记系列之Radix_Sort(二)
- AMD OpenCL例子阅读笔记系列之Radix_Sort(五)
- AMD OpenCL例子阅读笔记系列之Radix_Sort(一)
- <@乌龟:>C++/CLI语言Specification阅读笔记(1)
- <@乌龟:>C++/CLI语言Specification阅读笔记(2)
- AMD OpenCL例子阅读笔记系列之BinarySearch
- AMD OpenCL例子阅读笔记系列之DeviceFission