A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
setDevice
ArrayFire Functions | ArrayFire Functions by Category » Functions to create and modify Arrays » Managing devices in ArrayFire

Change current device to specified device More...

## Functions
AFAPI void | deviceset (const int device)
| Sets the current device.
AFAPI void | setDevice (const int device)
| Sets the current device.
AFAPI af_err | af_set_device (const int device)
AFAPI af_err | af_get_device (int *device)

## Detailed Description

Change current device to specified device

These functions change the current device. Operations after this called will be performed on the set device.

## Function Documentation

## ◆ af_get_device()

AFAPI af_err af_get_device | ( | int * | device | ) |

## ◆ af_set_device()

AFAPI af_err af_set_device | ( | const int | device | ) |

## ◆ deviceset()

AFAPI void deviceset | ( | const int | device | ) |

Sets the current device.

Parameters

  [in] | device | The ID of the target device

Deprecated
  Use setDevice() instead

## ◆ setDevice()

AFAPI void setDevice | ( | const int | device | ) |

Sets the current device.

Parameters

  [in] | device | The ID of the target device

Examples
  computer_vision/fast.cpp, computer_vision/harris.cpp, computer_vision/matching.cpp, computer_vision/susan.cpp, getting_started/convolve.cpp, getting_started/integer.cpp, getting_started/rainfall.cpp, graphics/fractal.cpp, helloworld/helloworld.cpp, image_processing/adaptive_thresholding.cpp, image_processing/binary_thresholding.cpp, image_processing/brain_segmentation.cpp, image_processing/deconvolution.cpp, image_processing/edge.cpp, image_processing/filters.cpp, image_processing/image_demo.cpp, image_processing/image_editing.cpp, image_processing/morphing.cpp, image_processing/optical_flow.cpp, image_processing/pyramids.cpp, lin_algebra/cholesky.cpp, lin_algebra/lu.cpp, lin_algebra/qr.cpp, lin_algebra/svd.cpp, machine_learning/deep_belief_net.cpp, machine_learning/kmeans.cpp, machine_learning/knn.cpp, machine_learning/logistic_regression.cpp, machine_learning/naive_bayes.cpp, machine_learning/neural_network.cpp, machine_learning/perceptron.cpp, machine_learning/rbm.cpp, machine_learning/softmax_regression.cpp, and pde/swe.cpp.