| 386 | } |
| 387 | |
| 388 | OIDN_API OIDNDevice oidnNewDeviceByPCIAddress(int pciDomain, int pciBus, int pciDevice, int pciFunction) |
| 389 | { |
| 390 | Ref<Device> device = nullptr; |
| 391 | |
| 392 | OIDN_TRY |
| 393 | OIDN_INIT_CONTEXT(ctx, DeviceType::Default); |
| 394 | |
| 395 | // Find the physical device with the specified PCI address |
| 396 | const int numDevices = ctx.getNumPhysicalDevices(); |
| 397 | int foundID = -1; |
| 398 | |
| 399 | for (int i = 0; i < numDevices; ++i) |
| 400 | { |
| 401 | const auto& physicalDevice = ctx.getPhysicalDevice(i); |
| 402 | if (physicalDevice->pciAddressSupported && |
| 403 | physicalDevice->pciDomain == pciDomain && |
| 404 | physicalDevice->pciBus == pciBus && |
| 405 | physicalDevice->pciDevice == pciDevice && |
| 406 | physicalDevice->pciFunction == pciFunction) |
| 407 | { |
| 408 | foundID = i; |
| 409 | break; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | if (foundID < 0) |
| 414 | throw Exception(Error::InvalidArgument, "no physical device found with specified PCI address"); |
| 415 | |
| 416 | device = ctx.newDevice(foundID); |
| 417 | OIDN_CATCH |
| 418 | |
| 419 | return reinterpret_cast<OIDNDevice>(device.detach()); |
| 420 | } |
| 421 | |
| 422 | OIDN_API OIDNDevice oidnNewSYCLDevice(const sycl::queue* queues, int numQueues) |
| 423 | { |
nothing calls this directly
no test coverage detected