O'Reilly logo

OpenCL Parallel Programming Development Cookbook by Raymond Tay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the shuffle function in OpenCL

The shuffle and shuffle2 functions were introduced in OpenCL 1.1 to construct a permutation of elements from their inputs (which are either one vector or two vectors), and returns a vector of the same type as its input; the number of elements in the returned vector is determined by the argument, mask, that is passed to it. Let's take a look at its method signature:

gentypeN shuffle(gentypeM x, ugentypeN mask);
gentypeN shuffle(gentypeM x, gentypeM y, ugentypeN mask);

The N and M used in the signatures represents the length of the returned and input vectors and can take values from {2,3,4,8,16}. The ugentype represents an unsigned type, gentype represents the integral types in OpenCL, and floating-point types ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required