subject
Computers and Technology, 25.02.2020 21:45 wreckem

The following scalar product code tests your understanding of the basic CUDA model. The code computes 1024 dot products, each of which is calculated from a pair of 256-element vectors. Assume that the code is executed on G80. Use the code to answer the following questions.1 #define VECTOR_N 10242 #define ELEMENT_N 2563 const int DATA_N ¼ VECTOR_N * ELEMENT_N;4 const int DATA_SZ ¼ DATA_N * sizeof(float);5 const int RESULT_SZ ¼ VECTOR_N * sizeof(float);. . .6 float *d_A, *d_B, *d_C;. . .7 cudaMalloc((void **)&d_A, DATA_SZ);8 cudaMalloc((void **)&d_B, DATA_SZ);9 cudaMalloc((void **)&d_C, RESULT_SZ);. . .10 scalarProd<<>>(d_C, d_A, d_B, ELEMENT_N);1112 __global__ void13 scalarProd(float *d_C, float *d_A, float *d_B, int ElementN)14 {15 __shared__ float accumResult[ELEMENT_N];16 //Current vectors bases17 float *A ¼ d_A þ ElementN * blockIdx. x;18 float *B ¼ d_B þ ElementN * blockIdx. x;19 int tx ¼ threadIdx. x;2021 accumResult[tx] ¼ A[tx] * B[tx];2223 for(int stride ¼ ElementN /2; stride > 0; stride >>¼ 1)24 {25 __syncthreads();26 if(tx < stride)27 accumResult[tx] þ¼ accumResult[stride þ tx];28 }30 d_C[blockIdx. x] ¼ accumResult[0];31 }The following scalar product code tests your understanding of the basic CUDA model. The following code computes 1024 dot products, each of which is calculated from a pair of 256-element vectors. Assume that the code is executed on the G80. Use the code to answer the questions that follow. How many threads are there in total?How many threads are there in a warp?How many threads are there in a block?How many global memory loads and stores are done for each thread?How many accesses to shared memory are done for each block? (4pts.)List the source code lines, if any, that cause shared memory bank conflicts. (2 pts.)How many iterations of the for loop (Line 23) will have branch divergence? Show your derivation. Identify an opportunity to significantly reduce the bandwidth requirement on the global memory. How would you achieve this?How many accesses can you eliminate?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:30
Three out of five seniors remain undecided about a college major at the end of their senior year.
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
Which of these is an example of an integrated presentation? a. a table created in powerpoint b. an image pasted into powerpoint c. a caption created in powerpoint d. an excel chart pasted into powerpoint
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
question
Computers and Technology, 24.06.2019 07:40
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
You know the right answer?
The following scalar product code tests your understanding of the basic CUDA model. The code compute...
Questions
question
Biology, 23.11.2021 20:50
question
English, 23.11.2021 20:50
question
Mathematics, 23.11.2021 20:50
Questions on the website: 13722363