15-GPU-Threads-and-Kernels Flashcards

(23 cards)

1
Q

What are OpenCL devices?

A

Belong to platforms, represent GPUs or other accelerators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are OpenCL contexts?

A

Coordinate interaction between host and device, one per device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are command queues?

A

Request work execution on device, usually one per device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is simpleOpenContext_GPU()?

A

Helper function that finds first GPU and creates context/queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is device memory allocation?

A

Use clCreateBuffer() to allocate GPU memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are memory flags?

A

CL_MEM_READ_ONLY, CL_MEM_WRITE_ONLY, CL_MEM_READ_WRITE, CL_MEM_COPY_HOST_PTR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a kernel?

A

Function executed on GPU, preceded by __kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is get_global_id(0)?

A

Returns global thread index for current work item

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is kernel compilation?

A

OpenCL kernels compiled at runtime using clCreateProgramWithSource()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is compileKernelFromFile()?

A

Helper function that reads, compiles, and creates kernel from file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are kernel arguments?

A

Set with clSetKernelArg() before enqueueing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is clEnqueueNDRangeKernel()?

A

Launches kernel with specified work dimensions and sizes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are work items?

A

Basic unit of GPU execution, maps to hardware thread

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is work group size?

A

Number of work items per work group, affects performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is NDRange?

A

N-dimensional range of all work items in kernel launch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the hierarchy: work items and work groups?

A

Work items in work groups, communication only within groups

17
Q

What are local indices?

A

get_local_id() gives position within work group

18
Q

What are global indices?

A

get_global_id() gives position in entire NDRange

19
Q

What is the advantage of local memory?

A

Faster than global, shared within work group

20
Q

What is memory coalescing?

A

GPU optimization where adjacent threads access adjacent memory

21
Q

What is the copy pattern: host to device?

A

clEnqueueWriteBuffer() or CL_MEM_COPY_HOST_PTR

22
Q

What is the copy pattern: device to host?

A

clEnqueueReadBuffer() with CL_TRUE for blocking

23
Q

What is the typical GPU program flow?

A

Allocate memory → copy to GPU → launch kernel → copy results back