Mapping std:: to hip::#
hipThreads mirrors the C++ Concurrency Support Library.
In most cases, porting CPU code means replacing the std:: qualifier with hip:: and adding __device__ or __host__ __device__ to the callables that run on the GPU.
The tables below list the supported primitives and how they correspond to the standard library.
For behavioral differences that have no standard-library analogue, see Limitations.
Threads#
C++ standard |
hipThreads |
Header |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(no equivalent) |
|
|
Mutexes and locks#
C++ standard |
hipThreads |
Header |
|---|---|---|
|
|
|
|
|
|
|
|
|
Condition variables#
C++ standard |
hipThreads |
Header |
|---|---|---|
|
|
|
Note
The spin_ variants busy-wait.
The pseudo_ variants busy-wait but periodically call pseudo_yield to let other GPU work progress.
Choose a pseudo_ primitive only when you can guarantee no yield-loops occur; see Limitations.