Skip to content

Commit edde093

Browse files
committed
Merge branch 'main' into cluster
2 parents 153cc3e + 8622934 commit edde093

File tree

12 files changed

+75
-40
lines changed

12 files changed

+75
-40
lines changed

install/docker/install-nvidia-container-toolkit.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ UBUNTU_22_04=$(lsb_release -r | grep "22.04")
22
UBUNTU_24_04=$(lsb_release -r | grep "24.04")
33

44
set -e
5+
6+
# Install CUDA for 22.04
7+
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=24.04&target_type=deb_network
8+
# Install CUDA for 24.04
59
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=24.04&target_type=deb_network
6-
# need this apt for nvidia-utils
7-
# needs either ubuntu 22.0.4 or 24.04
10+
# Do not apt install nvidia-open, must use cuda-drivers.
11+
812
if [ -z "$UBUNTU_22_04" ] && [ -z "$UBUNTU_24_04" ]
913
then
1014
echo "NVIDIA container toolkit can not be installed. Ubuntu version could not be detected when checking lsb-release and /etc/os-release."
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
{
3-
"scrypted.debugHost": "scrypted-nvr",
3+
"scrypted.debugHost": "koushik-winvm",
44
}

plugins/diagnostics/package-lock.json

+19-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/diagnostics/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@scrypted/diagnostics",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"scripts": {
55
"scrypted-setup-project": "scrypted-setup-project",
66
"prescrypted-setup-project": "scrypted-package-json",

plugins/diagnostics/src/main.ts

+25-4
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings {
294294

295295
const nvrPlugin = sdk.systemManager.getDeviceById('@scrypted/nvr');
296296
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');
297299
const openvinoPlugin = sdk.systemManager.getDeviceById<Settings & ObjectDetection>('@scrypted/openvino');
298300

299301
await this.validate(this.console, 'Scrypted Installation', async () => {
@@ -367,10 +369,14 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings {
367369
});
368370

369371
if (process.platform === 'linux' && nvrPlugin) {
370-
// ensure /dev/dri/renderD128 is available
372+
// ensure /dev/dri/renderD128 or /dev/dri/renderD129 is available
371373
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)');
374380
});
375381
}
376382

@@ -406,7 +412,22 @@ class DiagnosticsPlugin extends ScryptedDeviceBase implements Settings {
406412
throw new Error('Invalid response received from short lived URL.');
407413
});
408414

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)) {
410431
await this.validate(this.console, 'OpenVINO Plugin', async () => {
411432
const settings = await openvinoPlugin.getSettings();
412433
const availbleDevices = settings.find(s => s.key === 'available_devices');

plugins/onnx/.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{
33
// docker installation
4-
"scrypted.debugHost": "scrypted-nvr",
4+
"scrypted.debugHost": "koushik-winvm",
55
"scrypted.serverRoot": "/server",
66

77
// pi local installation

plugins/onnx/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/onnx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@
4747
"devDependencies": {
4848
"@scrypted/sdk": "file:../../sdk"
4949
},
50-
"version": "0.1.115"
50+
"version": "0.1.117"
5151
}

plugins/onnx/src/ort/__init__.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ def __init__(self, nativeId: str | None = None):
8383
deviceIds = ["0"]
8484
self.deviceIds = deviceIds
8585

86-
compiled_models = []
87-
self.compiled_models = {}
86+
compiled_models: list[onnxruntime.InferenceSession] = []
87+
self.compiled_models: dict[str, onnxruntime.InferenceSession] = {}
88+
self.provider = "Unknown"
8889

8990
try:
9091
for deviceId in deviceIds:
@@ -121,6 +122,14 @@ def executor_initializer():
121122
thread_name = threading.current_thread().name
122123
interpreter = compiled_models.pop()
123124
self.compiled_models[thread_name] = interpreter
125+
# remove CPUExecutionProider from providers
126+
providers = interpreter.get_providers()
127+
if not len(providers):
128+
providers = ["CPUExecutionProvider"]
129+
if "CPUExecutionProvider" in providers:
130+
providers.remove("CPUExecutionProvider")
131+
# join the remaining providers string
132+
self.provider = ", ".join(providers)
124133
print('Runtime initialized on thread {}'.format(thread_name))
125134

126135
self.executor = concurrent.futures.ThreadPoolExecutor(
@@ -134,6 +143,8 @@ def executor_initializer():
134143
thread_name_prefix="onnx-prepare",
135144
)
136145

146+
self.executor.submit(lambda: None)
147+
137148
self.faceDevice = None
138149
self.textDevice = None
139150
asyncio.ensure_future(self.prepareRecognitionModels(), loop=self.loop)
@@ -206,7 +217,7 @@ async def getSettings(self) -> list[Setting]:
206217
"key": "execution_device",
207218
"title": "Execution Device",
208219
"readonly": True,
209-
"value": onnxruntime.get_device(),
220+
"value": self.provider,
210221
}
211222
]
212223

plugins/openvino/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/openvino/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@
4848
"devDependencies": {
4949
"@scrypted/sdk": "file:../../sdk"
5050
},
51-
"version": "0.1.128"
52-
}
51+
"version": "0.1.129"
52+
}

plugins/openvino/src/ov/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030

3131
availableModels = [
3232
"Default",
33-
"scrypted_yolov9c_junk_320",
34-
"scrypted_yolov9t_yuv_320",
33+
"scrypted_yolov9c_relu_int8_320",
3534
"scrypted_yolov10m_320",
3635
"scrypted_yolov10s_320",
3736
"scrypted_yolov10n_320",

0 commit comments

Comments
 (0)