OpenCL
OpenCL is an actively used programming language created in 2009.
10Years Old | 16,601Users | 268Jobs |
- OpenCL ranks in the top 5% of languages
- the OpenCL website
- the OpenCL wikipedia page
- OpenCL first appeared in 2009
- See also: opengl, android, freebsd, linux, ia-32, cuda, c, python, java, llvmir, mathematica, javascript, arm, x86-isa, ptx, metal, sequencel
- I have 51 facts about OpenCL. just email me if you need more.
Example code from Linguist:
/* Old-style comment. */ // New-style comment. typedef float foo_t; #ifndef ZERO #define ZERO (0.0) #endif #define FOO(x) ((x) + \ ZERO) __kernel void foo(__global const foo_t * x, __local foo_t y, const uint n) { barrier(CLK_LOCAL_MEM_FENCE); if (n > 42) { *x += y; } }
Example code from Wikipedia:
// This kernel computes FFT of length 1024. The 1024 length FFT is decomposed into // calls to a radix 16 function, another radix 16 function and then a radix 4 function __kernel void fft1D_1024 (__global float2 *in, __global float2 *out, __local float *sMemx, __local float *sMemy) { int tid = get_local_id(0); int blockIdx = get_group_id(0) * 1024 + tid; float2 data[16]; // starting index of data to/from global memory in = in + blockIdx; out = out + blockIdx; globalLoads(data, in, 64); // coalesced global reads fftRadix16Pass(data); // in-place radix-16 pass twiddleFactorMul(data, tid, 1024, 0); // local shuffle using local memory localShuffle(data, sMemx, sMemy, tid, (((tid & 15) * 65) + (tid >> 4))); fftRadix16Pass(data); // in-place radix-16 pass twiddleFactorMul(data, tid, 64, 4); // twiddle factor multiplication localShuffle(data, sMemx, sMemy, tid, (((tid >> 4) * 64) + (tid & 15))); // four radix-4 function calls fftRadix4Pass(data); // radix-4 function number 1 fftRadix4Pass(data + 4); // radix-4 function number 2 fftRadix4Pass(data + 8); // radix-4 function number 3 fftRadix4Pass(data + 12); // radix-4 function number 4 // coalesced global writes globalStores(data, out, 64); }Edit
Last updated February 11th, 2019