24.07.2013 Views

Utilização de técnicas de análise estática e dinâmica para ... - UFMG

Utilização de técnicas de análise estática e dinâmica para ... - UFMG

Utilização de técnicas de análise estática e dinâmica para ... - UFMG

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Introdução As GPUs Tese Profiling Análise <strong>estática</strong> Otimização<br />

Exemplo: GPU Quicksort<br />

__global__ static void bitonicSort(int * values) {<br />

extern __shared__ int shared[];<br />

const unsigned int tid = threadIdx.x;<br />

shared[tid] = values[tid];<br />

__syncthreads();<br />

for (unsigned int k = 2; k 0; j /= 2) {<br />

unsigned int ixj = tid ^ j;<br />

if (ixj > tid) {<br />

if ((tid & k) == 0) { 7,329,816 / 28,574,321<br />

if (shared[tid] > shared[ixj]) {<br />

15,403,445 / 20,490,780<br />

swap(shared[tid], shared[ixj]);<br />

}<br />

} else {<br />

if (shared[tid] < shared[ixj]) {<br />

4,651,153 / 8,083,541<br />

swap(shared[tid], shared[ixj]);<br />

}<br />

}<br />

}<br />

__syncthreads();<br />

}<br />

}<br />

values[tid] = shared[tid];<br />

}

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

Saved successfully!

Ooh no, something went wrong!