setDevice

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

Functions
setDevice
Complete List of 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. More...
AFAPI void | setDevice (const int device)
| Sets the current device. More...
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

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

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

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

Sets the current device.

Parameters

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

Deprecated:
  Use setDevice() instead

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

Sets the current device.

Parameters

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

Examples:
  benchmarks/blas.cpp, benchmarks/fft.cpp, benchmarks/pi.cpp, computer_vision/fast.cpp, computer_vision/harris.cpp, computer_vision/matching.cpp, computer_vision/susan.cpp, financial/black_scholes_options.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/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/bagging.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.