Context management [deprecated]#

hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device)#

Create a context and set it as current/default context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:
  • ctx[out] Context to create

  • flags[in] Context creation flags

  • device[in] device handle

Returns:

hipSuccess

hipError_t hipCtxDestroy(hipCtx_t ctx)#

Destroy a HIP context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

ctx[in] Context to destroy

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipCtxPopCurrent(hipCtx_t *ctx)#

Pop the current/default context and return the popped context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

ctx[out] The current context to pop

Returns:

hipSuccess, hipErrorInvalidContext

hipError_t hipCtxPushCurrent(hipCtx_t ctx)#

Push the context to be set as current/ default context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

ctx[in] The current context to push

Returns:

hipSuccess, hipErrorInvalidContext

hipError_t hipCtxSetCurrent(hipCtx_t ctx)#

Set the passed context as current/default.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

ctx[in] The context to set as current

Returns:

hipSuccess, hipErrorInvalidContext

hipError_t hipCtxGetCurrent(hipCtx_t *ctx)#

Get the handle of the current/ default context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

ctx[out] The context to get as current

Returns:

hipSuccess, hipErrorInvalidContext

hipError_t hipCtxGetDevice(hipDevice_t *device)#

Get the handle of the device associated with current/default context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

device[out] The device from the current context

Returns:

hipSuccess, hipErrorInvalidContext

hipError_t hipCtxGetApiVersion(hipCtx_t ctx, int *apiVersion)#

Returns the approximate HIP api version.

Warning

The HIP feature set does not correspond to an exact CUDA SDK api revision. This function always set *apiVersion to 4 as an approximation though HIP supports some features which were introduced in later CUDA SDK revisions. HIP apps code should not rely on the api revision number here and should use arch feature flags to test device capabilities or conditional compilation.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:
  • ctx[in] Context to check

  • apiVersion[out] API version to get

Returns:

hipSuccess

hipError_t hipCtxGetCacheConfig(hipFuncCache_t *cacheConfig)#

Get Cache configuration for a specific function.

Warning

AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored on those architectures.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

cacheConfig[out] Cache configuration

Returns:

hipSuccess

hipError_t hipCtxSetCacheConfig(hipFuncCache_t cacheConfig)#

Set L1/Shared cache partition.

Warning

AMD devices and some Nvidia GPUS do not support reconfigurable cache. This hint is ignored on those architectures.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

cacheConfig[in] Cache configuration to set

Returns:

hipSuccess

hipError_t hipCtxSetSharedMemConfig(hipSharedMemConfig config)#

Set Shared memory bank configuration.

Warning

AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is ignored on those architectures.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

config[in] Shared memory configuration to set

Returns:

hipSuccess

hipError_t hipCtxGetSharedMemConfig(hipSharedMemConfig *pConfig)#

Get Shared memory bank configuration.

Warning

AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is ignored on those architectures.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

pConfig[out] Pointer of shared memory configuration

Returns:

hipSuccess

hipError_t hipCtxSynchronize(void)#

Blocks until the default context has completed all preceding requested tasks.

Warning

This function waits for all streams on the default context to complete execution, and then returns.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Returns:

hipSuccess

hipError_t hipCtxGetFlags(unsigned int *flags)#

Return flags used for creating default context.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

flags[out] Pointer of flags

Returns:

hipSuccess

hipError_t hipCtxEnablePeerAccess(hipCtx_t peerCtx, unsigned int flags)#

Enables direct access to memory allocations in a peer context.

Memory which already allocated on peer device will be mapped into the address space of the current device. In addition, all future memory allocations on peerDeviceId will be mapped into the address space of the current device when the memory is allocated. The peer memory remains accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset.

Warning

PeerToPeer support is experimental.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:
  • peerCtx[in] Peer context

  • flags[in] flags, need to set as 0

Returns:

hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue, hipErrorPeerAccessAlreadyEnabled

hipError_t hipCtxDisablePeerAccess(hipCtx_t peerCtx)#

Disable direct access from current context’s virtual address space to memory allocations physically located on a peer context.Disables direct access to memory allocations in a peer context and unregisters any registered allocations.

Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been enabled from the current device.

Warning

PeerToPeer support is experimental.

Warning

This API is deprecated on the AMD platform, only for equivalent cuCtx driver API on the NVIDIA platform.

Parameters:

peerCtx[in] Peer context to be disabled

Returns:

hipSuccess, hipErrorPeerAccessNotEnabled

hipError_t hipDevicePrimaryCtxGetState(hipDevice_t dev, unsigned int *flags, int *active)#

Get the state of the primary context.

Warning

This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA platform.

Parameters:
  • dev[in] Device to get primary context flags for

  • flags[out] Pointer to store flags

  • active[out] Pointer to store context state; 0 = inactive, 1 = active

Returns:

hipSuccess

hipError_t hipDevicePrimaryCtxRelease(hipDevice_t dev)#

Release the primary context on the GPU.

Warning

This function return hipSuccess though doesn’t release the primaryCtx by design on HIP/HCC path.

Warning

This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA platform.

Parameters:

dev[in] Device which primary context is released

Returns:

hipSuccess

hipError_t hipDevicePrimaryCtxRetain(hipCtx_t *pctx, hipDevice_t dev)#

Retain the primary context on the GPU.

Warning

This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA platform.

Parameters:
  • pctx[out] Returned context handle of the new context

  • dev[in] Device which primary context is released

Returns:

hipSuccess

hipError_t hipDevicePrimaryCtxReset(hipDevice_t dev)#

Resets the primary context on the GPU.

Warning

This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA platform.

Parameters:

dev[in] Device which primary context is reset

Returns:

hipSuccess

hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags)#

Set flags for the primary context.

Warning

This API is deprecated on the AMD platform, only for equivalent driver API on the NVIDIA platform.

Parameters:
  • dev[in] Device for which the primary context flags are set

  • flags[in] New flags for the device

Returns:

hipSuccess, hipErrorContextAlreadyInUse