




































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





































Figure Credits: NVIDIA CUDA Compute Unified Device Architecture Programming Guide 3.1 2 (FERMI) (FERMI)
CUDA = Compute Unified Device Architecture
Slide credit: Patrick LeGresley, NVidia 7
Figure Credit: http://www.nvidia.com/content/PDF/fermi_white_papers/NVIDIA_Fermi_Compute_Architecture_Whitepaper.pdf Note: Fermi specification here is pre-release. Actual cores = 480
CUDA Software Stack for Heterogeneous Computing Figure Credit: NVIDIA CUDA Compute Unified Device Architecture Programming Guide 1.1 14
**void saxpy_serial(int n, float alpha, float x, float y) { for (int i = 0; i< n; i++) y[i] = alpha * x[i] + y[i]; } // invoke serial saxpy kernel saxpy_serial(n, 2.0, x, y) Computing y = ax + y with a serial loop **Host code global void saxpy_parallel(int n, float alpha, float x, float y) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < n) y[i] = alpha * x[i] + y[i]; } Computing y = ax + y in parallel using CUDA // invoke parallel saxpy kernel (256 threads per block) int nblocks = (n + 255)/ saxpy_parallel<<nblocks, 256>>(n, 2.0, x, y) Device code Host code
Comparing the abstract models 19
Figure Credit: http://www.nvidia.com/docs/IO/55972/220401_Reprint.pdf
Figure credits: Patrick LeGresley, NVidia 20