Skip to content

Commit cc44b60

Browse files
provide a better error message when no platforms found (#826)
* provide a better error message when no platforms found * Add link, improve phrasing --------- Co-authored-by: Andreas Klöckner <[email protected]>
1 parent 3ab6593 commit cc44b60

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pyopencl/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1597,7 +1597,21 @@ def get_input(prompt):
15971597

15981598
# {{{ pick a platform
15991599

1600-
platforms = get_platforms()
1600+
try:
1601+
platforms = get_platforms()
1602+
except LogicError as e:
1603+
if "PLATFORM_NOT_FOUND_KHR" in str(e):
1604+
# With the cl_khr_icd extension, clGetPlatformIDs fails if no platform
1605+
# is available:
1606+
# https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clGetPlatformIDs.html
1607+
raise RuntimeError("no CL platforms available to ICD loader. "
1608+
"Install a CL driver "
1609+
"('ICD', such as pocl, rocm, Intel CL) to fix this. "
1610+
"See pyopencl docs for help: "
1611+
"https://documen.tician.de/pyopencl/"
1612+
"misc.html#installation") from e
1613+
else:
1614+
raise
16011615

16021616
if not platforms:
16031617
raise Error("no platforms found")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ name = "pyopencl"
1414
version = "2025.1"
1515
description = "Python wrapper for OpenCL"
1616
readme = "README.rst"
17+
license = "MIT"
1718
authors = [
1819
{ name = "Andreas Kloeckner", email = "[email protected]" },
1920
]
@@ -24,7 +25,6 @@ classifiers = [
2425
"Intended Audience :: Developers",
2526
"Intended Audience :: Other Audience",
2627
"Intended Audience :: Science/Research",
27-
"License :: OSI Approved :: MIT License",
2828
"Natural Language :: English",
2929
"Programming Language :: C++",
3030
"Programming Language :: Python",

0 commit comments

Comments
 (0)