WorksheetsCUDA C/C++ Basics Quiz
Total questions: 25
Worksheet time: 53mins
What is CUDA?
What will you learn in this session?
You (probably) need experience with C or C++
What is the purpose of the __syncthreads() function?
What does the CUDA C/C++ keyword __global__ indicate?
A function that runs on the host
A function that runs on the device
A function that is called from device code
A function that is called from host code
What is the first step in the Simple Processing Flow?
Load GPU code and execute it
Copy input data from CPU memory to GPU memory
Copy results from GPU memory to CPU memory
Manage GPU memory
What is the output of the following code: printf("Hello World!\n");?
Hello World!
Hello World
Hello
World!
What is the purpose of the cudaMalloc() function?
What is the result of the add() kernel when executed?
What is the significance of the triple angle brackets in mykernel<<<1,1>>>();?
What is referred to as a block in parallel invocation of add()?
Each parallel invocation of add()
The set of blocks
The grid
The block index
What does blockIdx.x refer to in the context of the add() function?
The index of the block
The index of the thread
The size of the array
The number of blocks
What is the purpose of cudaMalloc() in the main() function?
To allocate space for device copies
To copy data from host to device
To free allocated memory
To launch the kernel
What is the significance of using threadIdx.x instead of blockIdx.x?
To handle different elements of the array
To execute in parallel
To index into the array
To declare a function as device code
How do you calculate the unique index for each thread when using both blocks and threads?
int index = threadIdx.x + blockIdx.x * M
int index = blockIdx.x + threadIdx.x * M
int index = blockIdx.x * M + threadIdx.x
int index = threadIdx.x * M + blockIdx.x
What is the purpose of the if condition in the add() function when handling arbitrary vector sizes?
To avoid accessing beyond the end of the arrays
To ensure all threads execute
To synchronize threads
To allocate memory
What mechanisms do threads have to efficiently communicate and synchronize?
What is the output element in a 1D stencil applied to a 1D array of elements?
How many input elements are read from global memory to shared memory when caching data?
What is the purpose of __syncthreads() in CUDA programming?
What happens if thread 15 reads the halo before thread 0 has fetched it?
What is the role of cudaMemcpy() in managing device memory?
What does the compute capability of a device describe?
What are the built-in variables used in CUDA for thread and block identification?
What are the characteristics of textures in CUDA?
