EXAMS WITH CORRECT
QUESTIONS AND ANSWERS.
what does GPU stand for - ✔✔Graphics Processing Unit
GPU programming have - ✔✔hundreds or thousands of small, efficient cores that can process lots of
data at the same time,
GPUs are _____ - ✔✔parallel processors
Heterogeneous computing - ✔✔both the CPU (host) and GPU (device) work together to complete
tasks.
Host - ✔✔This is the CPU and its memory (often called "host memory") (RAM)
The CPU handles the - ✔✔main logic of the program, coordinating the overall flow and tasks.
Device - ✔✔GPU and its memory (known as "device memory")
The GPU excels at handling - ✔✔computations that can be done in parallel, so it's ideal for
performing repetitive, data-heavy tasks quickly.
How It Works: - ✔✔
Data Transfer: - ✔✔The CPU (host) first loads data into its own memory. To utilize the GPU, it needs
to transfer this data to the GPU's device memory.
,Data is sent from the CPU memory to the GPU memory through the - ✔✔PCI Bus that carry every
piece of data that needs to be processed, takes the bridge
Kernel Launch: - ✔✔The CPU sends a function (called a kernel) to the GPU. This kernel is a piece of
code that each GPU core will execute in parallel.
Computation on Device - ✔✔The GPU processes the data in parallel, performing the operations
specified in the kernel.
To optimize performance, GPUs utilize on-chip caches. - ✔✔These caches store frequently accessed
data close to the processing units to minimize data retrieval times from the main GPU memory
(VRAM).
Results Transfer: - ✔✔Once the computation is complete, the GPU transfers the results back to the
CPU.
serial code ran on and definition - ✔✔sequentially, meaning one instruction completes before the
next begins (CPUs excel in executing serial code due to their higher clock speeds optimized for a
broad range of tasks, including complex arithmetic and logic operations.
parallel code ran on - ✔✔GPU-allows multiple instructions to be executed simultaneously. This is
beneficial for tasks that can be divided into independent sub-tasks, which can be processed at the
same time
DRAM - ✔✔Dynamic random mamory is in the GPU
what does NVCC compiler stand for - ✔✔NVIDIA CUDA Compiler (used for GPU code)
While nvcc is optimized for CUDA, it integrates a - ✔✔host C/C++ compiler which can also compile
standard C or C++ programs. This makes nvcc a versatile tool in mixed development environments
where both GPU-accelerated and standard CPU processes are being developed.
what is NVIDIA CUDA Compiler used for - ✔✔compiling CUDA code to run on NVIDIA GPUs.
However, it can also compile standard C code to run on the CPU.
, Developers can maintain a single compiler setup for both their CPU and GPU code. This helps in
simplifying the build process and maintaining consistency across different parts of a project. - ✔✔
example of compiling code using nvcc - ✔✔nvcc hello_world.cu
what is the extension typically used for CUDA files - ✔✔.cu but can be used for C
Execution Command: - ✔✔./a.out
The C code runs on the CPU ("host"). This is standard for programs that - ✔✔don't utilize GPU-
specific code (like CUDA).
Compilation Process: - ✔✔
nvcc processes CUDA code by separating out the CUDA kernels and device functions from the host
code. It compiles the CUDA parts into - ✔✔PTX (Parallel Thread Execution) code or binary code,
which is executable on the GPU.
The non-CUDA code is compiled into machine code targeted at the CPU using the integrated or
external C/C++ compiler, - ✔✔
C code runs on the - ✔✔CPU (host) machine
how are kernel functions called inside the main - ✔✔<<< ... >>>();
what goes inside this syntax - ✔✔firs #: number of blocks in grid
second #: number of threads per block
__global__ indicates what - ✔✔•a function that:
-Runs on the device
-Is called from host code
nvcc separates source code into - ✔✔host and device components