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?
Answers: 3
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
Answers: 1
Computers and Technology, 23.06.2019 07:00
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in a. advanced mode. b. automatic mode. c. basic mode. d. typeover mode
Answers: 1
The following scalar product code tests your understanding of the basic CUDA model. The code compute...
Mathematics, 23.11.2020 08:50
Mathematics, 23.11.2020 08:50
Chemistry, 23.11.2020 08:50
Mathematics, 23.11.2020 08:50
Arts, 23.11.2020 08:50
History, 23.11.2020 08:50
Chemistry, 23.11.2020 08:50
Chemistry, 23.11.2020 08:50
History, 23.11.2020 08:50
Mathematics, 23.11.2020 08:50
Social Studies, 23.11.2020 08:50
Mathematics, 23.11.2020 08:50
English, 23.11.2020 08:50
History, 23.11.2020 08:50