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:
  adaptive_thresholding.cpp, bagging.cpp, binary_thresholding.cpp, black_scholes_options.cpp, brain_segmentation.cpp, cholesky.cpp, deep_belief_net.cpp, edge.cpp, filters.cpp, fractal.cpp, helloworld.cpp, image_demo.cpp, image_editing.cpp, integer.cpp, kmeans.cpp, knn.cpp, logistic_regression.cpp, lu.cpp, matching.cpp, morphing.cpp, naive_bayes.cpp, neural_network.cpp, optical_flow.cpp, perceptron.cpp, pi.cpp, pyramids.cpp, qr.cpp, rainfall.cpp, rbm.cpp, softmax_regression.cpp, svd.cpp, and swe.cpp.