29.01.2013 Views

Tutorial CUDA

Tutorial CUDA

Tutorial CUDA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example: Avoiding Non-Coalesced<br />

float3 Memory Accesses<br />

© NVIDIA Corporation 2008<br />

__global__ void accessFloat3(float3 *d_in, float3 d_out)<br />

{<br />

int index = blockIdx.x * blockDim.x + threadIdx.x;<br />

float3 a = d_in[index];<br />

}<br />

a.x += 2;<br />

a.y += 2;<br />

a.z += 2;<br />

d_out[index] = a;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!