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

Function setDevice

src/backend/oneapi/platform.cpp:399–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399int setDevice(int device) {
400 DeviceManager& devMngr = DeviceManager::getInstance();
401
402 common::lock_guard_t lock(devMngr.deviceMutex);
403
404 if (device >= static_cast<int>(devMngr.mQueues.size()) ||
405 device >= static_cast<int>(DeviceManager::MAX_DEVICES)) {
406 return -1;
407 } else {
408 int old = getActiveDeviceId();
409 setActiveContext(device);
410 return old;
411 }
412}
413
414void sync(int device) {
415 int currDevice = getActiveDeviceId();

Callers 1

syncFunction · 0.70

Calls 2

getActiveDeviceIdFunction · 0.70
setActiveContextFunction · 0.70

Tested by

no test coverage detected