28.11.2014 Views

Lecture 2 – Threads - many-core.group

Lecture 2 – Threads - many-core.group

Lecture 2 – Threads - many-core.group

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GPU strategy 1 – kernel launch code<br />

// set thread blocks and grid<br />

grid_dim=dim3(DIVIDE_INTO(ni,NI_TILE),DIVIDE_INTO(nj,NJ_TILE),1);<br />

block_dim=dim3(NI_TILE, NJ_TILE, 1);<br />

// launch kernel <br />

step_kernel_gpu(ni, nj,tfac,temp1_d, <br />

temp2_d);<br />

// swap the temp pointers <br />

temp_tmp = temp1_d;<br />

temp1_d = temp2_d;<br />

temp2_d = temp_tmp;

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

Saved successfully!

Ooh no, something went wrong!