Overview


Initialization is the first critical step for an application to begin utilizing the GPU for computation. This phase involves several essential configurations and checks to ensure that subsequent operations, such as data transfers and kernel launches, can proceed smoothly.

The configuration of the HIP runtime is at the heart of the initialization process. This involves a series of intricate steps designed to establish a stable foundation for future GPU computations. Specifically, HIP runtime initialization handles the following tasks:

Once the HIP runtime is configured, the next step is typically to detect and query the GPUs available on the system. This allows the application to determine which accelerators are accessible and to retrieve relevant information about each device, such as its name and memory size.

Finally, for each GPU that will be used by the application, a corresponding context must be created. Contexts are essential for managing GPU resources and executing kernels. Each context represents an independent connection between the CPU (host) and a specific GPU (device). All subsequent operations, such as memory allocation, data transfer, and kernel execution on that GPU, must take place within its associated context.

HIP Runtime Initialization


When a HIP API is called for the first time, the HIP runtime is automatically initialized. This means that in most cases, developers do not need to perform explicit initialization.