MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_set_device

Function af_set_device

src/api/c/device.cpp:228–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228af_err af_set_device(const int device) {
229 try {
230 ARG_ASSERT(0, device >= 0);
231 if (setDevice(device) < 0) {
232 int ndevices = getDeviceCount();
233 if (ndevices == 0) {
234 AF_ERROR(
235 "No devices were found on this system. Ensure "
236 "you have installed the device driver as well as the "
237 "necessary runtime libraries for your platform.",
238 AF_ERR_RUNTIME);
239 } else {
240 char buf[512];
241 char err_msg[] =
242 "The device index of %d is out of range. Use a value "
243 "between 0 and %d.";
244 snprintf(buf, 512, err_msg, device, ndevices - 1); // NOLINT
245 AF_ERROR(buf, AF_ERR_ARG);
246 }
247 }
248 }
249 CATCHALL;
250
251 return AF_SUCCESS;
252}
253
254af_err af_sync(const int device) {
255 try {

Callers 3

fftTestFunction · 0.50
TESTFunction · 0.50
setDeviceFunction · 0.50

Calls 2

setDeviceFunction · 0.50
getDeviceCountFunction · 0.50

Tested by

no test coverage detected