Computer Science > QUESTIONS & ANSWERS > University of Illinois, Urbana ChampaignECE 408Solutions 2021 (All)
MP1 1 . (Fall 2020) How many floating operations are being performed in the vector add kernel? Give your answer in terms of N and explain. Answer: N 2. How many global memory bytes are read and wr... itten by the vector add kernel? Give your answer in terms of N. Please give separate answers for the bytes read and written. Answer: Reads = 2 * N * 4, Writes = N * 4 3 . Assume that we want to use each thread to calculate 2 (adjacent) elements of a vector addition. What would be the expression for mapping the thread/block indices to i, the data index of the second element to be processed by a thread? (A) i=blockIdx.x*blockDim.x + threadIdx.x +1 (B) i=blockIdx.x*blockDim.x*2 + threadIdx.x - 1 (C) i=(blockIdx.x*blockDim.x + threadIdx.x)*2 +1 (D) i=blockIdx.x*threadIdx.x*2 + 1 Answer: C 4. We want to use each thread to calculate sixteen (16) output elements of a vector addition. Each block processes 16*blockDim.x consecutive elements that form 16 sections. All threads in each block will first process a section with each thread processing one element. They will then all move to the next section with each thread processing one element. For each section, consecutive threads should process consecutive elements. What would be the kernel code expression for forming the value of i, the data index of the first element to be processed by each thread? (A) i=blockIdx.x*blockDim.x *16 (B) i=blockIdx.x*threadIdx.x + threadIdx.x (C) i=blockIdx.x*blockDim.x*16 + threadIdx.x (D) i=blockIdx.x*blockDim.x + threadIdx.x*16 Answer: C [Show More]
Last updated: 1 year ago
Preview 1 out of 8 pages
Connected school, study & course
About the document
Uploaded On
Sep 10, 2021
Number of pages
8
Written in
This document has been written for:
Uploaded
Sep 10, 2021
Downloads
0
Views
100
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·