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

Function setBackend

src/api/unified/symbol_manager.cpp:233–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231int AFSymbolManager::getAvailableBackends() const { return backendsAvailable; }
232
233af_err setBackend(af::Backend bknd) {
234 auto& instance = AFSymbolManager::getInstance();
235 if (bknd == AF_BACKEND_DEFAULT) {
236 if (instance.getDefaultHandle()) {
237 getActiveHandle() = instance.getDefaultHandle();
238 getActiveBackend() = instance.getDefaultBackend();
239 return AF_SUCCESS;
240 } else {
241 UNIFIED_ERROR_LOAD_LIB();
242 }
243 }
244 int idx = backend_index(bknd);
245 if (instance.getHandle(idx)) {
246 getActiveHandle() = instance.getHandle(idx);
247 getActiveBackend() = bknd;
248 return AF_SUCCESS;
249 } else {
250 UNIFIED_ERROR_LOAD_LIB();
251 }
252}
253
254} // namespace unified
255} // namespace arrayfire

Callers 1

af_set_backendFunction · 0.70

Calls 5

getActiveBackendFunction · 0.85
backend_indexFunction · 0.85
getDefaultHandleMethod · 0.80
getDefaultBackendMethod · 0.80
getHandleMethod · 0.80

Tested by

no test coverage detected