0% found this document useful (0 votes)
4 views3 pages

Week 9 Assignment

The document contains a series of questions and answers related to CUDA and OpenACC commands and directives. It covers topics such as checking CUDA compiler versions, compiling CUDA programs, managing GPU resources with SLURM, and various OpenACC clauses for data management and parallel execution. Each question is followed by the correct answer, providing a concise reference for users working with CUDA and OpenACC.

Uploaded by

ANJALI PATEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Week 9 Assignment

The document contains a series of questions and answers related to CUDA and OpenACC commands and directives. It covers topics such as checking CUDA compiler versions, compiling CUDA programs, managing GPU resources with SLURM, and various OpenACC clauses for data management and parallel execution. Each question is followed by the correct answer, providing a concise reference for users working with CUDA and OpenACC.

Uploaded by

ANJALI PATEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Week 9 Assignment

1. What is the purpose of the nvcc --version command in CUDA?


A. It compiles the CUDA program
B. It checks the version of the NVIDIA GPU driver
C. It displays the version of the CUDA compiler (nvcc)
D. It checks the GPU hardware status
Answer: It displays the version of the CUDA compiler (nvcc)

2. Which of the following commands is used to compile a CUDA program using the
NVIDIA compiler?
A. gcc
B. nvcc
C. cl
D. Make
Answer: nvcc

3. In a SLURM script, how do you specify that your job requires access to a GPU for
running a CUDA program?
A. SBATCH --gres=gpu:1;
B. SBATCH --host=2;
C. SBATCH --nvidia=1;
D. SBATCH --devices=gpu:1
Answer: SBATCH --gres=gpu:1

4. Which command would you use to check if the NVIDIA driver and GPU are correctly
installed and functioning on a Linux system?
A. nvidia-smi
B. gpu-status
C. check-gpu
D. Nvidia-driver-status
Answer: nvidia-smi

5. Which command is used to compile CUDA code using the NVIDIA CUDA Compiler
(nvcc)?
A. gcc -o myprogram [Link];
B. nvcc -o myprogram [Link];
C. cl -o myprogram [Link];
D. make -o myprogram [Link]
Answer: nvcc -o myprogram [Link]
6. Which directive in OpenACC is used to specify parallel regions?
A. #pragma acc data
B. #pragma acc kernels
C. #pragma acc loop
D. #pragma acc cache
Answer: #pragma acc kernels

7. Which of the following is not a valid OpenACC directive?


A. #pragma acc data
B. #pragma acc parallel
C. #pragma acc device
D. #pragma acc routines
Answer: #pragma acc device

8. Which clause in OpenACC is used to manage data transfer between the host and
device?
A. parallel
B. data
C. kernels
D. host_data
Answer: data

9. What is the role of the `copyin` clause in OpenACC?


A. To copy data from the device to the host
B. To copy data from the host to the device
C. To initialize data on the device
D. To delete data from the device
Answer: To copy data from the host to the device

10. What does the `copyout` clause do in OpenACC?


A. Copies data from the device to the host
B. Copies data from the host to the device
C. Synchronizes data between host and device
D. Deletes data from the host
Answer: Copies data from the device to the host

11. What is the purpose of the `wait` clause in OpenACC?


A. To synchronize data transfer
B. To wait for a parallel region to complete
C. To initialize data on the device
D. To delete data from the host
Answer: To wait for a parallel region to complete

12. What does the `update` directive do in OpenACC?


A. Transfers data from host to device or device to host
B. Synchronizes device memory with host memory
C. Initializes device memory
D. Finalizes data transfer
Answer: Transfers data from host to device or device to host

13. Which clause in OpenACC is used to allocate memory on the device?


A. copy
B. malloc
C. allocate
D. create
Answer: create

14. Which directive in OpenACC is used to deallocate memory on the device?


A. #pragma acc exit data
B. #pragma acc delete
C. #pragma acc deallocate
D. #pragma acc free
Answer: #pragma acc delete

15. What does the `independent` clause do in OpenACC?


A. Ensures parallel execution of a loop
B. Indicates that iterations of a loop are independent
C. Synchronizes memory between host and device
D. Allocates memory on the device
Answer: Indicates that iterations of a loop are independent

You might also like