Download E-books OpenCL in Action: How to Accelerate Graphics and Computation PDF

By Matthew Scarpino


OpenCL in Action is a radical, hands-on presentation of OpenCL, with a watch towards displaying builders how one can construct high-performance purposes in their personal. It starts by means of providing the center techniques in the back of OpenCL, together with vector computing, parallel programming, and multi-threaded operations, after which courses you step by step from uncomplicated facts constructions to complicated functions.

About the Technology

Whatever procedure you might have, it most likely has extra uncooked processing energy than you are utilizing. OpenCL is a high-performance programming language that maximizes computational energy through executing on CPUs, images processors, and different number-crunching units. it is ideal for speed-sensitive initiatives like vector computing, matrix operations, and portraits acceleration.

About this Book

OpenCL in Action blends the speculation of parallel computing with the sensible fact of creating high-performance purposes utilizing OpenCL. It first publications you thru the elemental information constructions in an intuitive demeanour. Then, it explains options for high-speed sorting, photo processing, matrix operations, and quickly Fourier remodel. The publication concludes with a deep examine the all-important topic of portraits acceleration. quite a few not easy examples provide you with other ways to test with operating code.

A heritage in C or C++ is beneficial, yet no earlier publicity to OpenCL is needed.

buy of the print ebook comes with a proposal of a unfastened PDF, ePub, and Kindle publication from Manning. additionally to be had is all code from the e-book.

What's Inside

  • Learn OpenCL step by means of step
  • Tons of annotated code
  • Tested algorithms for max performance


Table of Contents

  1. Introducing OpenCL
  2. Host programming: basic information structures
  3. Host programming: information move and partitioning
  4. Kernel programming: information kinds and equipment memory
  5. Kernel programming: operators and features
  6. Image processing
  7. Events, profiling, and synchronization
  8. Development with C++
  9. Development with Java and Python
  10. General coding principles
  12. Reduction and sorting
  13. Matrices and QR decomposition
  14. Sparse matrices
  15. Signal processing and the quick Fourier transform
  17. Combining OpenCL and OpenGL
  18. Textures and renderbuffers

Show description

Read or Download OpenCL in Action: How to Accelerate Graphics and Computation PDF

Best Algorithms books

AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and Java

AI Algorithms, info buildings, and Idioms in Prolog, Lisp, and Java

Rarely used booklet, in good shape.

A Handbook of Small Data Sets (Chapman & Hall Statistics Texts)

This e-book will be of curiosity to statistical data academics who wish ready-made info units whole with notes for instructing.

Algorithms for Minimization Without Derivatives (Dover Books on Mathematics)

This notable textual content for graduate scholars and researchers proposes advancements to current algorithms, extends their comparable mathematical theories, and gives info on new algorithms for approximating neighborhood and worldwide minima. not one of the algorithms calls for an review of derivatives; all count fullyyt on sequential functionality evaluate, a hugely functional situation within the widespread occasion of difficult-to-evaluate derivatives.

Squid: The Definitive Guide

Squid is the most well-liked internet caching software program in use this present day, and it really works on numerous structures together with Linux, FreeBSD, and home windows. Squid improves community functionality through decreasing the volume of bandwidth used while browsing the internet. It makes web content load swifter and will even lessen the weight in your internet server.

Extra resources for OpenCL in Action: How to Accelerate Graphics and Computation

Show sample text content

Zero 26. zero 28. zero 30. zero nine. zero eighty four. zero 228. zero = 372. zero 516. zero zero. zero × zero. zero + 2. zero × three. zero + four. zero × 6. zero + 6. zero × nine. zero = eighty four. zero eight. zero × zero. zero + 10. zero × three. zero + 12. zero × 6. zero + 14. zero × nine. zero = 228. zero sixteen. zero × zero. zero + 18. zero × three. zero + 20. zero × 6. zero + 22. zero × nine. zero = 372. zero 24. zero × zero. zero + 26. zero × three. zero + 28. zero × 6. zero + 30. zero × nine. zero = 516. zero determine 1. three Matrix-vector multiplication sends it to the 1st equipment it unearths. the next directory indicates what this host code seems like. observe that the resource code is written within the interval. observe Error-checking workouts were passed over from this directory, yet you’ll locate them within the matvec. c dossier during this book’s instance code. directory 1. 1 growing and dispensing a matrix-vector multiplication kernel: matvec. c #define PROGRAM_FILE "matvec. cl" #define KERNEL_FUNC "matvec_mult" #include #include #include #ifdef MAC #include #else #include #endif int main() { cl_platform_id platform; cl_device_id gadget; cl_context context; cl_command_queue queue; cl_int i, err; cl_program software; dossier *program_handle; char *program_buffer, *program_log; size_t program_size, log_size; cl_kernel kernel; size_t work_units_per_kernel; glide mat[16], vec[4], result[4]; go with the flow correct[4] = {0. 0f, zero. 0f, zero. 0f, zero. 0f}; cl_mem mat_buff, vec_buff, res_buff; for(i=0; i<16; i++) { mat[i] = i * 2. 0f; } Initialize facts www. it-ebooks. details 12 bankruptcy 1 for(i=0; i<4; vec[i] = i correct[0] correct[1] correct[2] correct[3] } i++) { * three. 0f; += mat[i] += mat[i+4] += mat[i+8] += mat[i+12] * * * * Introducing OpenCL vec[i]; vec[i]; vec[i]; vec[i]; clGetPlatformIDs(1, &platform, NULL); clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL); context = clCreateContext(NULL, 1, &device, NULL, NULL, &err); Initialize information Set platform/ device/context program_handle = fopen(PROGRAM_FILE, "r"); fseek(program_handle, zero, SEEK_END); program_size = ftell(program_handle); rewind(program_handle); program_buffer = (char*)malloc(program_size + 1); program_buffer[program_size] = '\0'; fread(program_buffer, sizeof(char), program_size, program_handle); fclose(program_handle); learn application dossier application = clCreateProgramWithSource(context, 1, (const char**)&program_buffer, &program_size, &err); free(program_buffer); clBuildProgram(program, zero, NULL, NULL, NULL, NULL); kernel = clCreateKernel(program, KERNEL_FUNC, &err); queue = clCreateCommandQueue(context, machine, zero, &err); collect application Create kernel/queue mat_buff = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(float)*16, mat, &err); vec_buff = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(float)*4, vec, &err); res_buff = clCreateBuffer(context, CL_MEM_WRITE_ONLY, sizeof(float)*4, NULL, &err); clSetKernelArg(kernel, zero, sizeof(cl_mem), &mat_buff); clSetKernelArg(kernel, 1, sizeof(cl_mem), &vec_buff); clSetKernelArg(kernel, 2, sizeof(cl_mem), &res_buff); work_units_per_kernel = four; clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &work_units_per_kernel, NULL, zero, NULL, NULL); clEnqueueReadBuffer(queue, res_buff, CL_TRUE, zero, sizeof(float)*4, consequence, zero, NULL, NULL); if((result[0] == correct[0]) && (result[1] == correct[1]) && (result[2] == correct[2]) && (result[3] == correct[3])) { printf("Matrix-vector multiplication winning.

Download E-books OpenCL in Action: How to Accelerate Graphics and Computation PDF
Rated 4.63 of 5 – based on 36 votes