@@ -294,6 +294,8 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings {
294
294
295
295
const nvrPlugin = sdk . systemManager . getDeviceById ( '@scrypted/nvr' ) ;
296
296
const cloudPlugin = sdk . systemManager . getDeviceById ( '@scrypted/cloud' ) ;
297
+ const hasCUDA = process . env . NVIDIA_VISIBLE_DEVICES && process . env . NVIDIA_DRIVER_CAPABILITIES ;
298
+ const onnxPlugin = sdk . systemManager . getDeviceById < Settings & ObjectDetection > ( '@scrypted/onnx' ) ;
297
299
const openvinoPlugin = sdk . systemManager . getDeviceById < Settings & ObjectDetection > ( '@scrypted/openvino' ) ;
298
300
299
301
await this . validate ( this . console , 'Scrypted Installation' , async ( ) => {
@@ -367,10 +369,14 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings {
367
369
} ) ;
368
370
369
371
if ( process . platform === 'linux' && nvrPlugin ) {
370
- // ensure /dev/dri/renderD128 is available
372
+ // ensure /dev/dri/renderD128 or /dev/dri/renderD129 is available
371
373
await this . validate ( this . console , 'GPU Passthrough' , async ( ) => {
372
- if ( ! fs . existsSync ( '/dev/dri/renderD128' ) )
373
- throw new Error ( 'GPU device unvailable or not passed through to container.' ) ;
374
+ if ( ! fs . existsSync ( '/dev/dri/renderD128' ) && ! fs . existsSync ( '/dev/dri/renderD129' ) )
375
+ throw new Error ( 'GPU device unvailable or not passed through to container. (/dev/dri/renderD128, /dev/dri/renderD129)' ) ;
376
+ // also check /dev/kfd for AMD CPU
377
+ const amdCPU = os . cpus ( ) . find ( c => c . model . includes ( 'AMD' ) ) ;
378
+ if ( amdCPU && ! fs . existsSync ( '/dev/kfd' ) )
379
+ throw new Error ( 'GPU device unvailable or not passed through to container. (/dev/kfd)' ) ;
374
380
} ) ;
375
381
}
376
382
@@ -406,7 +412,22 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings {
406
412
throw new Error ( 'Invalid response received from short lived URL.' ) ;
407
413
} ) ;
408
414
409
- if ( openvinoPlugin ) {
415
+ if ( ( hasCUDA || process . platform === 'win32' ) && onnxPlugin ) {
416
+ await this . validate ( this . console , 'ONNX Plugin' , async ( ) => {
417
+ const settings = await onnxPlugin . getSettings ( ) ;
418
+ const executionDevice = settings . find ( s => s . key === 'execution_device' ) ;
419
+ if ( executionDevice ?. value ?. toString ( ) . includes ( 'CPU' ) )
420
+ this . warnStep ( this . console , 'GPU device unvailable or not passed through to container.' ) ;
421
+
422
+ const zidane = await sdk . mediaManager . createMediaObjectFromUrl ( 'https://docs.scrypted.app/img/scrypted-nvr/troubleshooting/zidane.jpg' ) ;
423
+ const detected = await onnxPlugin . detectObjects ( zidane ) ;
424
+ const personFound = detected . detections ! . find ( d => d . className === 'person' && d . score > .9 ) ;
425
+ if ( ! personFound )
426
+ throw new Error ( 'Person not detected in test image.' ) ;
427
+ } ) ;
428
+ }
429
+
430
+ if ( ! hasCUDA && openvinoPlugin && ( process . platform !== 'win32' || ! onnxPlugin ) ) {
410
431
await this . validate ( this . console , 'OpenVINO Plugin' , async ( ) => {
411
432
const settings = await openvinoPlugin . getSettings ( ) ;
412
433
const availbleDevices = settings . find ( s => s . key === 'available_devices' ) ;
0 commit comments