pyopencl 2025.2.4__cp311-cp311-win_amd64.whl → 2025.2.6__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyopencl might be problematic. Click here for more details.
- pyopencl/_cl.cp311-win_amd64.pyd +0 -0
- pyopencl/_cl.pyi +10 -7
- pyopencl/_monkeypatch.py +51 -10
- pyopencl/algorithm.py +1 -1
- pyopencl/array.py +210 -125
- pyopencl/cache.py +1 -1
- pyopencl/characterize/__init__.py +2 -4
- pyopencl/clmath.py +0 -1
- pyopencl/cltypes.py +42 -27
- pyopencl/elementwise.py +226 -112
- pyopencl/scan.py +30 -25
- pyopencl/tools.py +328 -213
- {pyopencl-2025.2.4.dist-info → pyopencl-2025.2.6.dist-info}/METADATA +3 -4
- {pyopencl-2025.2.4.dist-info → pyopencl-2025.2.6.dist-info}/RECORD +16 -16
- {pyopencl-2025.2.4.dist-info → pyopencl-2025.2.6.dist-info}/WHEEL +1 -1
- {pyopencl-2025.2.4.dist-info → pyopencl-2025.2.6.dist-info}/licenses/LICENSE +0 -0
pyopencl/cache.py
CHANGED
|
@@ -505,7 +505,7 @@ def create_built_program_from_source_cached(ctx, src, options_bytes, devices=Non
|
|
|
505
505
|
except Exception as e:
|
|
506
506
|
from pyopencl import Error
|
|
507
507
|
build_program_failure = (isinstance(e, Error)
|
|
508
|
-
and e.code == _cl.status_code.BUILD_PROGRAM_FAILURE)
|
|
508
|
+
and e.code == _cl.status_code.BUILD_PROGRAM_FAILURE)
|
|
509
509
|
|
|
510
510
|
# Mac error on intel CPU driver: can't build from cached version.
|
|
511
511
|
# If we get a build_program_failure from the cached version then
|
|
@@ -24,8 +24,6 @@ THE SOFTWARE.
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
from typing import cast
|
|
28
|
-
|
|
29
27
|
from pytools import memoize
|
|
30
28
|
|
|
31
29
|
import pyopencl as cl
|
|
@@ -70,9 +68,9 @@ def reasonable_work_group_size_multiple(
|
|
|
70
68
|
}
|
|
71
69
|
""")
|
|
72
70
|
prg.build()
|
|
73
|
-
return
|
|
71
|
+
return prg.knl.get_work_group_info(
|
|
74
72
|
cl.kernel_work_group_info.PREFERRED_WORK_GROUP_SIZE_MULTIPLE,
|
|
75
|
-
dev)
|
|
73
|
+
dev)
|
|
76
74
|
|
|
77
75
|
|
|
78
76
|
def nv_compute_capability(dev: cl.Device):
|
pyopencl/clmath.py
CHANGED
pyopencl/cltypes.py
CHANGED
|
@@ -22,13 +22,17 @@ THE SOFTWARE.
|
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
import warnings
|
|
25
|
-
from typing import Any
|
|
25
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
26
26
|
|
|
27
27
|
import numpy as np
|
|
28
28
|
|
|
29
29
|
from pyopencl.tools import get_or_register_dtype
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
if TYPE_CHECKING:
|
|
33
|
+
import builtins
|
|
34
|
+
from collections.abc import MutableSequence
|
|
35
|
+
|
|
32
36
|
if __file__.endswith("array.py"):
|
|
33
37
|
warnings.warn(
|
|
34
38
|
"pyopencl.array.vec is deprecated. Please use pyopencl.cltypes.",
|
|
@@ -53,16 +57,19 @@ double = np.float64
|
|
|
53
57
|
|
|
54
58
|
# {{{ vector types
|
|
55
59
|
|
|
56
|
-
def _create_vector_types()
|
|
60
|
+
def _create_vector_types() -> tuple[
|
|
61
|
+
dict[tuple[np.dtype[Any], builtins.int], np.dtype[Any]],
|
|
62
|
+
dict[np.dtype[Any], tuple[np.dtype[Any], builtins.int]]]:
|
|
57
63
|
mapping = [(k, globals()[k]) for k in
|
|
58
64
|
["char", "uchar", "short", "ushort", "int",
|
|
59
65
|
"uint", "long", "ulong", "float", "double"]]
|
|
60
66
|
|
|
61
|
-
def set_global(key, val):
|
|
67
|
+
def set_global(key: str, val: np.dtype[Any]) -> None:
|
|
62
68
|
globals()[key] = val
|
|
63
69
|
|
|
64
|
-
vec_types = {}
|
|
65
|
-
vec_type_to_scalar_and_count
|
|
70
|
+
vec_types: dict[tuple[np.dtype[Any], builtins.int], np.dtype[Any]] = {}
|
|
71
|
+
vec_type_to_scalar_and_count: dict[np.dtype[Any],
|
|
72
|
+
tuple[np.dtype[Any], builtins.int]] = {}
|
|
66
73
|
|
|
67
74
|
field_names = ["x", "y", "z", "w"]
|
|
68
75
|
|
|
@@ -70,20 +77,21 @@ def _create_vector_types():
|
|
|
70
77
|
|
|
71
78
|
for base_name, base_type in mapping:
|
|
72
79
|
for count in counts:
|
|
73
|
-
name = "
|
|
74
|
-
|
|
75
|
-
titles = field_names[:count]
|
|
80
|
+
name = f"{base_name}{count}"
|
|
81
|
+
titles = cast("MutableSequence[str | None]", field_names[:count])
|
|
76
82
|
|
|
77
83
|
padded_count = count
|
|
78
84
|
if count == 3:
|
|
79
85
|
padded_count = 4
|
|
80
86
|
|
|
81
|
-
names = ["s
|
|
87
|
+
names = [f"s{i}" for i in range(count)]
|
|
82
88
|
while len(names) < padded_count:
|
|
83
|
-
|
|
89
|
+
pad = len(names) - count
|
|
90
|
+
names.append(f"padding{pad}")
|
|
84
91
|
|
|
85
92
|
if len(titles) < len(names):
|
|
86
|
-
|
|
93
|
+
pad = len(names) - len(titles)
|
|
94
|
+
titles.extend([None] * pad)
|
|
87
95
|
|
|
88
96
|
try:
|
|
89
97
|
dtype = np.dtype({
|
|
@@ -96,14 +104,16 @@ def _create_vector_types():
|
|
|
96
104
|
for (n, title)
|
|
97
105
|
in zip(names, titles, strict=True)])
|
|
98
106
|
except TypeError:
|
|
99
|
-
dtype = np.dtype([(n, base_type) for
|
|
100
|
-
in zip(names, titles, strict=True)])
|
|
107
|
+
dtype = np.dtype([(n, base_type) for n in names])
|
|
101
108
|
|
|
109
|
+
assert isinstance(dtype, np.dtype)
|
|
102
110
|
get_or_register_dtype(name, dtype)
|
|
103
|
-
|
|
104
111
|
set_global(name, dtype)
|
|
105
112
|
|
|
106
|
-
def create_array(dtype
|
|
113
|
+
def create_array(dtype: np.dtype[Any],
|
|
114
|
+
count: int,
|
|
115
|
+
padded_count: int,
|
|
116
|
+
*args: Any, **kwargs: Any) -> dict[str, Any]:
|
|
107
117
|
if len(args) < count:
|
|
108
118
|
from warnings import warn
|
|
109
119
|
warn("default values for make_xxx are deprecated;"
|
|
@@ -116,21 +126,26 @@ def _create_vector_types():
|
|
|
116
126
|
{"array": np.array,
|
|
117
127
|
"padded_args": padded_args,
|
|
118
128
|
"dtype": dtype})
|
|
119
|
-
|
|
129
|
+
|
|
130
|
+
for key, val in kwargs.items():
|
|
120
131
|
array[key] = val
|
|
132
|
+
|
|
121
133
|
return array
|
|
122
134
|
|
|
123
|
-
set_global(
|
|
124
|
-
"
|
|
125
|
-
"*args, **kwargs
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
set_global(
|
|
136
|
+
f"make_{name}",
|
|
137
|
+
eval("lambda *args, **kwargs: "
|
|
138
|
+
f"create_array(dtype, {count}, {padded_count}, *args, **kwargs)",
|
|
139
|
+
{"create_array": create_array, "dtype": dtype}))
|
|
140
|
+
set_global(
|
|
141
|
+
f"filled_{name}",
|
|
142
|
+
eval(f"lambda val: make_{name}(*[val]*{count})"))
|
|
143
|
+
set_global(f"zeros_{name}", eval(f"lambda: filled_{name}(0)"))
|
|
144
|
+
set_global(f"ones_{name}", eval(f"lambda: filled_{name}(1)"))
|
|
145
|
+
|
|
146
|
+
base_dtype = np.dtype(base_type)
|
|
147
|
+
vec_types[base_dtype, count] = dtype
|
|
148
|
+
vec_type_to_scalar_and_count[dtype] = base_dtype, count
|
|
134
149
|
|
|
135
150
|
return vec_types, vec_type_to_scalar_and_count
|
|
136
151
|
|