| 231 | int AFSymbolManager::getAvailableBackends() const { return backendsAvailable; } |
| 232 | |
| 233 | af_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 |
no test coverage detected