ATI Stream Computing OpenCL Programming Guide - CiteSeerX
ATI Stream Computing OpenCL Programming Guide - CiteSeerX
ATI Stream Computing OpenCL Programming Guide - CiteSeerX
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>ATI</strong> STREAM COMPUTING// 3. Iterate over devices.for(dev=0; dev < NDEVS; dev++){cl_device_id device;cl_context context;cl_command_queue queue;cl_program program;cl_kernel minp;cl_kernel reduce;cl_memcl_memcl_memcl_uintsrc_buf;dst_buf;dbg_buf;*dst_ptr,*dbg_ptr;printf("\n%s: ", dev == 0 ? "CPU" : "GPU");// Find the device.clGetDeviceIDs( platform,devs[dev],1,&device,NULL);// 4. Compute work sizes.cl_uint compute_units;size_t global_work_size;size_t local_work_size;size_t num_groups;clGetDeviceInfo( device,CL_DEVICE_MAX_COMPUTE_UNITS,sizeof(cl_uint),&compute_units,NULL);if( devs[dev] == CL_DEVICE_TYPE_CPU ){global_work_size = compute_units * 1;local_work_size = 1;}else{cl_uint ws = 64;// 1 thread per coreglobal_work_size = compute_units * 7 * ws; // 7 wavefronts per SIMDwhile( (num_src_items / 4) % global_work_size != 0 )global_work_size += ws;}local_work_size = ws;num_groups = global_work_size / local_work_size;1.9 Example Programs 1-31Copyright © 2010 Advanced Micro Devices, Inc. All rights reserved.