Execution Context Management#
-
hipError_t hipDeviceGetDevResource(hipDevice_t device, hipDevResource *resource, hipDevResourceType type)#
Gets device resource of a given type for a device.
- Parameters:
resource – [out] - Output device resource pointer
device – [in] - Device to get resource for
type – [in] - Type of resource to retrieve
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidResourceType, hipErrorInvalidDevice
-
hipError_t hipDevSmResourceSplitByCount(hipDevResource *result, unsigned int *nbGroups, const hipDevResource *input, hipDevResource *remainder, unsigned int flags, unsigned int minCount)#
Splits SM resources into groups containing the specified number of SMs.
- Parameters:
result – [out] - Output device resource pointer
nbGroups – [in] - The poiter specifying the number of groups
input – [in] - Valid input SM resource to be split
remainder – [in] - If the input resource cannot be evenly split among nbGroups, the remaining resourced are returned through this parameter.
flags – [in] - Flags specifying partition usage and constraints to apply when splitting the inout resource.
minCount – [in] - Specifies the minimum number of SMs required
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidResourceType, hipErrorInvalidDevice, hipErrorNotSupported
-
hipError_t hipDevSmResourceSplit(hipDevResource *result, unsigned int nbGroups, const hipDevResource *input, hipDevResource *remainder, unsigned int flags, hipDevSmResourceGroupParams *groupParams)#
Splits SM resources into structured groups.
- Parameters:
result – [out] - Output device resource pointer
nbGroups – [in] - The poiter specifying the number of groups
input – [in] - Valid input SM resource to be split
remainder – [in] - If the input resource cannot be evenly split among nbGroups, the remaining resourced are returned through this parameter.
flags – [in] - Flags specifying partition usage and constraints to apply when splitting the inout resource.
groupParams – [in] - Describes how the SM resources should be partitioned and assigned to the corresponding result entries.
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidResourceType, hipErrorInvalidResourceConfiguration, hipErrorInvalidDevice
-
hipError_t hipDevResourceGenerateDesc(hipDevResourceDesc_t *phDesc, hipDevResource *resources, unsigned int nbResources)#
Generates a resource descriptor from one or more device resources.
- Parameters:
phDesc – [out] - Output parameter that receives the generated resource descriptor
resources – [in] - Pointer of device resources to be included in the descriptor
nbResources – [in] - Number of resources specified
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidResourceType, hipErrorInvalidDevice
-
hipError_t hipGreenCtxCreate(hipExecutionCtx_t *ctx, hipDevResourceDesc_t desc, int device, unsigned int flags)#
Creates a green context from a resource descriptor.
- Parameters:
ctx – [out] - Output parameter that receives the handle to the created green context
desc – [in] - Resource descriptor generated via hipDevResourceGenerateDesc that specifies the set of resources to be used
device – [in] - Device on which the green context is created
flags – [in] - Flags controlling green context creation
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidDevice
-
hipError_t hipExecutionCtxDestroy(hipExecutionCtx_t ctx)#
Destroys an execution context.
- Parameters:
ctx – [in] - Execution context to destroy
- Returns:
hipSuccess, hipErrorInvalidValue
-
hipError_t hipDeviceGetExecutionCtx(hipExecutionCtx_t *ctx, int device)#
Returns the default execution context for a device.
- Parameters:
ctx – [out] - Output pointer for execution context
device – [in] - The device on which to receive the execution context
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidDevice, hipErrorOutOfMemory
-
hipError_t hipExecutionCtxStreamCreate(hipStream_t *stream, hipExecutionCtx_t greenctx, unsigned int flags, int priority)#
Creates a stream on an execution context with specified flags and priority.
- Parameters:
stream – [out] - Output pointer of the created stream
greenctx – [in] - Execution context used to create and initialize the stream
flags – [in] - Flags for stream creation
priority – [in] - Stream priority
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorOutOfMemory
-
hipError_t hipExecutionCtxGetDevResource(hipExecutionCtx_t ctx, hipDevResource *resource, hipDevResourceType type)#
Returns the device resource of a given type for an execution context.
- Parameters:
resource – [out] - Output pointer that receives the structured device resource
ctx – [in] - Execution context to get resource for
type – [in] - Type of device resource
- Returns:
hipSuccess, hipErrorInvalidValue
-
hipError_t hipExecutionCtxGetDevice(int *device, hipExecutionCtx_t ctx)#
Returns the device associated with an execution context.
- Parameters:
device – [out] - Returns device handle for the specified execution context
ctx – [in] - Execution context to obtain the device
- Returns:
hipSuccess, hipErrorInvalidValue
-
hipError_t hipExecutionCtxGetId(hipExecutionCtx_t ctx, unsigned long long *ctxId)#
Returns a unique identifier for an execution context.
- Parameters:
ctxId – [out] - Pointer to the context ID
ctx – [in] - Execution context to obtain the ID
- Returns:
hipSuccess, hipErrorInvalidValue
-
hipError_t hipStreamGetDevResource(hipStream_t hStream, hipDevResource *resource, hipDevResourceType type)#
Returns the device resource of a given type for a stream.
- Parameters:
resource – [out] - Pointer to the structured device resource
hStream – [in] - Stream to get resource for
type – [in] - Type of resource
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidResourceType, hipErrorInvalidHandle
-
hipError_t hipExecutionCtxRecordEvent(hipExecutionCtx_t ctx, hipEvent_t event)#
Records an event on an execution context.
- Parameters:
event – [out] - Event to record
ctx – [in] - Execution context to record event for
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidHandle
-
hipError_t hipExecutionCtxSynchronize(hipExecutionCtx_t ctx)#
Blocks until all work on an execution context has completed.
- Parameters:
ctx – [in] - Execution context to synchronize
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidHandle
-
hipError_t hipExecutionCtxWaitEvent(hipExecutionCtx_t ctx, hipEvent_t event)#
Makes an execution context wait on an event.
- Parameters:
event – [in] - Event to wait on
ctx – [in] - Execution context to wait for
- Returns:
hipSuccess, hipErrorInvalidValue, hipErrorInvalidHandle