GPU - Mid - Gradescope
GPU - Mid - Gradescope
Q1
4 Points
Q2
2 Points
Q3
2 Points
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 1/11
9/19/23, 11:14 PM View Submission | Gradescope
2 Points
Q5
2 Points
Q6
4 Points
80,000
Q7
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 2/11
9/19/23, 11:14 PM View Submission | Gradescope
32
Q8
3 Points
Q9
12 Points
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 3/11
9/19/23, 11:14 PM View Submission | Gradescope
{
int index = threadIdx.x + 1; //PC = A
if(netID % index == 0) //PC = B
{
// Do something here
}
else // PC = C
{
// Do something else here
}
// PC = D
// Do more stuff here
}
Q9.1
2 Points
sgang011
Q9.2
5 Points
Assume a warp size of 4 threads and the left-most bit of the active
mask is assigned to thread 0 and the right-most bit is thread 3.
1000
Q9.3
5 Points
What is the active mask when the warp is executing the else
statement basic block?
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 4/11
9/19/23, 11:14 PM View Submission | Gradescope
mask is assigned to thread 0 and the right-most bit is thread 3.
0111
Q10
2 Points
Host memory
Shared memory
Device memory
Virtual memory
Q11
2 Points
Q12
2 Points
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 5/11
9/19/23, 11:14 PM View Submission | Gradescope
2 Points
{
int Row = blockIdx.y*blockDim.y+threadIdx.y;
int Col = blockIdx.x*blockDim.x+threadIdx.x;
float Pvalue = 0;
for (int k = 0; k < Width; ++k) {
Pvalue += M[Row*Width+k] * N[k*Width+Col];
}
P[Row*Width+Col] = Pvalue;
Q14
4 Points
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 6/11
9/19/23, 11:14 PM View Submission | Gradescope
4 Points
100
Q16
5 Points
Code block 1:
Code block 2:
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 7/11
9/19/23, 11:14 PM View Submission | Gradescope
answer concise and no longer than 5 sentences.
Q17
4 Points
10
Q18
4 Points
80,000
Q19
2 Points
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 8/11
9/19/23, 11:14 PM View Submission | Gradescope
if(threadIdx.x > 5)
if(gridDim.x > 5)
if(blockDim.x > 5)
Q20
2 Points
If we want to copy 1000 bytes of data from host array h_A ( h_A is
a pointer to element 0 of the source array) to device array d_A
( d_A ) is a pointer to element 0 of the destination array), what
would be an appropriate API call for this in CUDA?
cudaMemcpy(1000, d_A, h_A, cudaMemcpyHostToDevice);
cudaMemcpy(1000, h_A, d_A, cudaMemcpyHostToDevice);
cudaMemcpy(d_A, h_A, 1000, cudaMemcpyHostToDevice);
cudaMemcpy(h_A, d_A, 1000, cudaMemcpyDeviceToHost);
Q21
2 Points
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 9/11
9/19/23, 11:14 PM View Submission | Gradescope
Student
Sree Charan Reddy Gangireddy
Total Points
66 / 70 pts
Question 1
(no title) 4 / 4 pts
Question 2
(no title) 2 / 2 pts
Question 3
(no title) 2 / 2 pts
Question 4
(no title) 2 / 2 pts
Question 5
(no title) 2 / 2 pts
Question 6
(no title) 0 / 4 pts
Question 7
(no title) 4 / 4 pts
Question 8
(no title) 3 / 3 pts
Question 9
(no title) 12 / 12 pts
Question 10
(no title) 2 / 2 pts
Question 11
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 10/11
9/19/23, 11:14 PM View Submission | Gradescope
Question 12
(no title) 2 / 2 pts
Question 13
(no title) 2 / 2 pts
Question 14
(no title) 4 / 4 pts
Question 15
(no title) 4 / 4 pts
Question 16
(no title) 5 / 5 pts
Question 17
(no title) 4 / 4 pts
Question 18
(no title) 4 / 4 pts
Question 19
(no title) 2 / 2 pts
Question 20
(no title) 2 / 2 pts
Question 21
(no title) 2 / 2 pts
https://www.gradescope.com/courses/461455/assignments/2397020/submissions/145232557 11/11