- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

Functions
CUDA specific functions
ArrayFire Functions by Category » Interface Functions

Accessing ArrayFire's stream, and native device id with other CUDA code. More...

## Functions
AFAPI af_err | afcu_get_stream (cudaStream_t *stream, int id)
| Get the stream for the CUDA device with `id` in ArrayFire context. More...
AFAPI af_err | afcu_get_native_id (int *nativeid, int id)
| Get the native device id of the CUDA device with `id` in ArrayFire context. More...
static cudaStream_t | getStream (int id)
| Get the stream for the CUDA device with `id` in ArrayFire context. More...
static int | getNativeId (int id)
| Get the native device id of the CUDA device with `id` in ArrayFire context. More...

## Detailed Description

Accessing ArrayFire's stream, and native device id with other CUDA code.

If your software is using ArrayFire's CUDA backend, you can also write custom kernels and do custom memory operations using native CUDA commands. The functions contained in the `afcu` namespace provide methods to get the stream and native device id that ArrayFire is using.

## Function Documentation

AFAPI af_err afcu_get_native_id | ( | int * | nativeid,
|  | int | id
| ) |  |

Get the native device id of the CUDA device with `id` in ArrayFire context.

Parameters

  [out] | nativeid | native device id of the CUDA device with `id` in ArrayFire context
  [in] | id | ArrayFire device id

Returns
  af_err error code

AFAPI af_err afcu_get_stream | ( | cudaStream_t * | stream,
|  | int | id
| ) |  |

Get the stream for the CUDA device with `id` in ArrayFire context.

Parameters

  [out] | stream | CUDA Stream of device with `id` in ArrayFire context
  [in] | id | ArrayFire device id

Returns
  af_err error code

static int afcu::getNativeId | ( | int | id | ) |
| inline static

Get the native device id of the CUDA device with `id` in ArrayFire context.

Parameters

  [in] | id | ArrayFire device id

Returns
  cuda native id of device

static cudaStream_t afcu::getStream | ( | int | id | ) |
| inline static

Get the stream for the CUDA device with `id` in ArrayFire context.

Parameters

  [in] | id | ArrayFire device id

Returns
  cuda stream used by CUDA device