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, 22.06.2019 12:00
Which of the following “invisible” marks represents an inserted tab?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut-off on an hev are both colored orange.
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
Which explains extrinsic motivation? a)motivation in which there is a reward b)motivation that is personally satisfying c)motivation that is personally meaningful d)motivation in which the subject is interesting
Answers: 1
You know the right answer?
The following scalar product code tests your understanding of the basic CUDA model. The code compute...
Questions
question
Mathematics, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
question
English, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
question
Mathematics, 22.02.2021 22:30
Questions on the website: 13722360