Skip to content

Commit 392c32b

Browse files
authored
try to create vulkan device on init and fail with nicer error if we can't (#291)
Signed-off-by: Francis Williams <francis@fwilliams.info>
1 parent 60b840f commit 392c32b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ jobs:
108108
pushd fvdb-reality-capture
109109
pip install -e .
110110
popd
111-
111+
112112
- name: Build docs
113113
run: |
114114
micromamba activate fvdb
115115
which sphinx-build
116116
sphinx-build docs/ -E -a _docs_build
117117
sphinx-build fvdb-reality-capture/docs -E -a _docs_build/reality-capture
118-
118+
119119
120120
- name: Upload static files as artifact
121121
id: deployment

fvdb/viz/_viewer_server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ def init(ip_address: str = "127.0.0.1", port: int = 8080, vk_device_id: int = 0,
5858
"""
5959
global _viewer_server_cpp
6060
if _viewer_server_cpp is None:
61+
try:
62+
import nanovdb_editor as editor
63+
64+
compiler = editor.Compiler()
65+
compute = editor.Compute(compiler)
66+
di = compute.device_interface()
67+
di.create_device_manager(enable_validation=False)
68+
69+
di.create_device(device_index=vk_device_id, enable_external_usage=False)
70+
except Exception as e:
71+
raise RuntimeError(
72+
f"Failed to create Vulkan device with ID {vk_device_id}. You may have an incompatible version of Vulkan installed."
73+
) from e
6174
_viewer_server_cpp = ViewerCpp(ip_address=ip_address, port=port, device_id=vk_device_id, verbose=verbose)
6275
else:
6376
warnings.warn(

0 commit comments

Comments
 (0)