1/56
Looks like no tags are added yet.
What CUDA function allocates memory on the GPU?
cudaMalloc()
What CUDA function copies data between CPU and GPU memory?
cudaMemcpy()
What CUDA function frees GPU memory?
cudaFree()
What keyword identifies a CUDA kernel?
global
What CUDA variable identifies the thread within a block?
threadIdx.x
What CUDA variable identifies the block?
blockIdx.x
What CUDA variable gives the number of threads per block?
blockDim.x
What does __syncthreads() do?
Synchronizes threads within a block.
What does vector addition primarily depend on: memory bandwidth or computation?
Memory bandwidth
What CUDA function waits for previously launched GPU work to finish?
cudaDeviceSynchronize()
How many threads are in each CUDA block in the vadd program?
512
What is the name of the GPU kernel for vector addition?
vadd
What keyword indicates that vadd is a GPU kernel?
global
How is the global thread index calculated in the vadd kernel?
threadIdx.x+blockIdx.x×blockDim.x
What does each GPU thread compute in vadd?
One element: c[i]=a[i]+b[i]
Why does the vadd kernel check if (i < elems)?
To prevent out-of-bounds access.
How many GPU arrays are allocated in the vadd program?
3: d_a, d_b, d_c
What function checks for CUDA errors?
CheckCuda
What is the expected value of c[i] in the vector addition test?
2 * i +1
Does the reported compute time for vadd include copying results back to the CPU?
No, only the kernel launch and wait.
Why is cudaMemcpy(d_c, c, …) optional before launching the vadd kernel?
Every valid output element is overwritten by the kernel.
What is the name of the CUDA kernel that computes the fractal image?
fractal
How many threads per block are used in the fractal program?
512
What type of loop performs the fractal iterations?
do-while
What is the maximum number of iterations per pixel in the fractal program?
256
How many pixels does each GPU thread calculate in the fractal program?
1
How many pixels are in an image of width w?
w×w
What data type is used in fractal_cuda.cu?
double
What data type is used in fractal_float.cu?
float
Which variable identifies the pixel's column in the fractal program?
col=imodwidth
Which variable identifies the pixel's row in the fractal program?
row=i/width
What is the minimum allowed image width in the fractal program?
10
What condition stops the iteration in the fractal program?
count≤0 or z_re2+z_im2≥5.0
What is the output array's data type in the fractal program?
unsigned char
Which function saves the BMP image in the fractal program?
bmp.save()
When does the fractal program generate a BMP file?
When width<1000
Which CUDA function allocates GPU image memory in the fractal program?
cudaMalloc()
Which function copies the image from GPU to CPU in the fractal program?
cudaMemcpy()
Does the measured compute time include saving the BMP image in the fractal program?
No
What is the name of the CUDA kernel for matrix multiplication?
multiply
How many threads per block are used in the matrix multiplication program?
512
How many matrix elements does each GPU thread calculate in matrix multiplication?
1
What is the data type of the matrices in the matrix multiplication program?
float
What is the minimum allowed matrix size in the matrix multiplication program?
10
What function initializes the matrices in the matrix multiplication program?
init
What type of matrix is mat1 initialized as?
Identity matrix
What does multiplying mat1 by mat2 produce?
mat2
How is the global thread index calculated in the matrix multiplication kernel?
blockIdx.x×blockDim.x+threadIdx.x
How is the row index calculated in the matrix multiplication kernel?
i=idx/size
How is the column index calculated in the matrix multiplication kernel?
j=idxmodsize
What type of loop is inside the matrix multiplication CUDA kernel?
for loop
How many iterations does the matrix multiplication kernel's loop perform per output element?
size
How many GPU arrays are allocated in the matrix multiplication program?
3
Does the matrix multiplication kernel use shared memory?
No
Which function copies the matrix multiplication result back to the CPU?
cudaMemcpy
How does the program verify the matrix multiplication result?
Checks whether mat2[i]==mat3[i]
What function frees GPU memory in the matrix multiplication program?
cudaFree