pyopencl 2024.3__cp312-cp312-musllinux_1_2_x86_64.whl → 2025.1__cp312-cp312-musllinux_1_2_x86_64.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/array.py CHANGED
@@ -32,7 +32,7 @@ import builtins
32
32
  from dataclasses import dataclass
33
33
  from functools import reduce
34
34
  from numbers import Number
35
- from typing import Any, Dict, Hashable, List, Optional, Tuple, Union
35
+ from typing import Any, Dict, List, Optional, Tuple, Union
36
36
  from warnings import warn
37
37
 
38
38
  import numpy as np
@@ -58,20 +58,14 @@ else:
58
58
  _SVMPointer_or_nothing = ()
59
59
 
60
60
 
61
- _NUMPY_PRE_2 = np.__version__.startswith("1.")
62
-
63
-
64
61
  # {{{ _get_common_dtype
65
62
 
66
- _COMMON_DTYPE_CACHE: Dict[Tuple[Hashable, ...], np.dtype] = {}
67
-
68
-
69
63
  class DoubleDowncastWarning(UserWarning):
70
64
  pass
71
65
 
72
66
 
73
67
  _DOUBLE_DOWNCAST_WARNING = (
74
- "The operation you requested would result in a double-precisision "
68
+ "The operation you requested would result in a double-precision "
75
69
  "quantity according to numpy semantics. Since your device does not "
76
70
  "support double precision, a single-precision quantity is being returned.")
77
71
 
@@ -81,78 +75,12 @@ def _get_common_dtype(obj1, obj2, queue):
81
75
  raise ValueError("PyOpenCL array has no queue; call .with_queue() to "
82
76
  "add one in order to be able to perform operations")
83
77
 
84
- allow_double = has_double_support(queue.device)
85
- cache_key = None
86
- o1_is_array = isinstance(obj1, Array)
87
- o2_is_array = isinstance(obj2, Array)
88
-
89
- if o1_is_array and o2_is_array:
90
- o1_dtype = obj1.dtype
91
- o2_dtype = obj2.dtype
92
- cache_key = (obj1.dtype, obj2.dtype, allow_double)
93
- else:
94
- o1_dtype = getattr(obj1, "dtype", type(obj1))
95
- o2_dtype = getattr(obj2, "dtype", type(obj2))
96
-
97
- o1_is_integral = np.issubdtype(o1_dtype, np.integer)
98
- o2_is_integral = np.issubdtype(o1_dtype, np.integer)
99
-
100
- o1_key = obj1 if o1_is_integral and not o1_is_array else o1_dtype
101
- o2_key = obj2 if o2_is_integral and not o2_is_array else o2_dtype
78
+ # Note: We are calling np.result_type with pyopencl arrays here.
79
+ # Luckily, np.result_type only looks at the dtype of input arrays up until
80
+ # at least numpy v2.1.
81
+ result = np.result_type(obj1, obj2)
102
82
 
103
- cache_key = (o1_key, o2_key, o1_is_array, o2_is_array, allow_double)
104
-
105
- try:
106
- return _COMMON_DTYPE_CACHE[cache_key]
107
- except KeyError:
108
- pass
109
-
110
- # Numpy's behavior around integers is a bit bizarre, and definitely value-
111
- # and not just type-sensitive when it comes to scalars. We'll just do our
112
- # best to emulate it.
113
- #
114
- # Some samples that are true as of numpy 1.23.1.
115
- #
116
- # >>> a = np.zeros(1, dtype=np.int16)
117
- # >>> (a + 123123123312).dtype
118
- # dtype('int64')
119
- # >>> (a + 12312).dtype
120
- # dtype('int16')
121
- # >>> (a + 12312444).dtype
122
- # dtype('int32')
123
- # >>> (a + np.int32(12312444)).dtype
124
- # dtype('int32')
125
- # >>> (a + np.int32(1234)).dtype
126
- # dtype('int16')
127
- #
128
- # Note that np.find_common_type, while appealing, won't be able to tell
129
- # the full story.
130
-
131
- if (_NUMPY_PRE_2
132
- and not (o1_is_array and o2_is_array)
133
- and o1_is_integral and o2_is_integral):
134
- if o1_is_array:
135
- obj1 = np.zeros(1, dtype=o1_dtype)
136
- if o2_is_array:
137
- obj2 = np.zeros(1, dtype=o2_dtype)
138
-
139
- result = (obj1 + obj2).dtype
140
- else:
141
- array_types = []
142
- scalars = []
143
-
144
- if o1_is_array:
145
- array_types.append(o1_dtype)
146
- else:
147
- scalars.append(obj1)
148
- if o2_is_array:
149
- array_types.append(o2_dtype)
150
- else:
151
- scalars.append(obj2)
152
-
153
- result = np.result_type(*array_types, *scalars)
154
-
155
- if not allow_double:
83
+ if not has_double_support(queue.device):
156
84
  if result == np.float64:
157
85
  result = np.dtype(np.float32)
158
86
  warn(_DOUBLE_DOWNCAST_WARNING, DoubleDowncastWarning, stacklevel=3)
@@ -160,9 +88,6 @@ def _get_common_dtype(obj1, obj2, queue):
160
88
  result = np.dtype(np.complex64)
161
89
  warn(_DOUBLE_DOWNCAST_WARNING, DoubleDowncastWarning, stacklevel=3)
162
90
 
163
- if cache_key is not None:
164
- _COMMON_DTYPE_CACHE[cache_key] = result
165
-
166
91
  return result
167
92
 
168
93
  # }}}
@@ -2518,7 +2443,7 @@ def arange(queue, *args, **kwargs):
2518
2443
  raise TypeError("arange requires a dtype argument")
2519
2444
 
2520
2445
  from math import ceil
2521
- size = int(ceil((stop-start)/step))
2446
+ size = ceil((stop-start)/step)
2522
2447
 
2523
2448
  result = Array(queue, (size,), dtype, allocator=inf.allocator)
2524
2449
  result.add_event(_arange_knl(result, start, step, queue=queue))
pyopencl/cltypes.py CHANGED
@@ -50,7 +50,7 @@ double = np.float64
50
50
  # {{{ vector types
51
51
 
52
52
  def _create_vector_types():
53
- _mapping = [(k, globals()[k]) for k in
53
+ mapping = [(k, globals()[k]) for k in
54
54
  ["char", "uchar", "short", "ushort", "int",
55
55
  "uint", "long", "ulong", "float", "double"]]
56
56
 
@@ -64,7 +64,7 @@ def _create_vector_types():
64
64
 
65
65
  counts = [2, 3, 4, 8, 16]
66
66
 
67
- for base_name, base_type in _mapping:
67
+ for base_name, base_type in mapping:
68
68
  for count in counts:
69
69
  name = "%s%d" % (base_name, count)
70
70
 
pyopencl/version.py CHANGED
@@ -3,7 +3,7 @@ from importlib import metadata
3
3
 
4
4
 
5
5
  VERSION_TEXT = metadata.version("pyopencl")
6
- _match = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
6
+ _match = re.match(r"^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
7
7
  assert _match is not None
8
8
  VERSION_STATUS = _match.group(2)
9
9
  VERSION = tuple(int(nr) for nr in _match.group(1).split("."))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyopencl
3
- Version: 2024.3
3
+ Version: 2025.1
4
4
  Summary: Python wrapper for OpenCL
5
5
  Author-Email: Andreas Kloeckner <inform@tiker.net>
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -1,43 +1,43 @@
1
- pyopencl-2024.3.dist-info/RECORD,,
2
- pyopencl-2024.3.dist-info/METADATA,sha256=3Y2AW8BahKcnAPNcX0jR65xiQPsUluv8sTbrVsCtZZc,4783
3
- pyopencl-2024.3.dist-info/WHEEL,sha256=3zA1ZuXZm16YEeXghxfkMxAdI01btIGLecr0IEG4IxU,117
4
- pyopencl-2024.3.dist-info/licenses/LICENSE,sha256=ed06wscfYbymGrF5jRUX9rPCsefHp5ZOv_xgjbXgGrA,5299
5
- pyopencl/ipython_ext.py,sha256=TUgxJa_w7tvXaKj6kPjiXNEKlxrwsJScQCD0khAA1kk,1915
6
- pyopencl/array.py,sha256=tw-OcXsRyStFcpLEjq64aiuX9rvlcMzu4qtshyJOWY4,111773
7
- pyopencl/scan.py,sha256=Z4Ew6NE0VRNhxPItM4M8oCtPdif0yCclW-CcsFqScu0,65638
1
+ pyopencl-2025.1.dist-info/METADATA,sha256=WUY6JEb89dxhMwOVvX9OJVBYPqzlqPNt1TypeIxsCkQ,4783
2
+ pyopencl-2025.1.dist-info/RECORD,,
3
+ pyopencl-2025.1.dist-info/WHEEL,sha256=3zA1ZuXZm16YEeXghxfkMxAdI01btIGLecr0IEG4IxU,117
4
+ pyopencl-2025.1.dist-info/licenses/LICENSE,sha256=ed06wscfYbymGrF5jRUX9rPCsefHp5ZOv_xgjbXgGrA,5299
5
+ pyopencl/array.py,sha256=tENUt-t3tso0LjQS4o6s2nXFwIOxzazOeTS3V-YpN2M,109612
6
+ pyopencl/_cl.cpython-312-x86_64-linux-musl.so,sha256=T1b9KyO1mcrPbQIOAhtkoB-S0M133_wrhExhgBC9OEQ,2817649
7
+ pyopencl/tools.py,sha256=eZdKtkwY34kPbMR9FuFAmQbDQG8vJdv1az_UPiGNxjE,45940
8
+ pyopencl/clmath.py,sha256=lOxQzE6BEp5-nVRuGu0hgxzk_gcx7aTiy_hRFxAPmcI,8222
9
+ pyopencl/__init__.py,sha256=BDkk5adIO4tHSYxxx_O7W4cyTHALwJB1aPpX5BrKep8,81443
8
10
  pyopencl/elementwise.py,sha256=HxSSpC944TeJkok8LGeNjqRgfKucbjpLEw3IoGOqLGc,38625
11
+ pyopencl/invoker.py,sha256=hL5qMYOJpXEh2X1xbkkDaoYWRXgP-9fISY0N5VtL--8,14060
12
+ pyopencl/reduction.py,sha256=CrWJPDYNy4hxtCGgwq2fkWAQXjJ8zMLxV5CEbAh3Wb8,25533
13
+ pyopencl/scan.py,sha256=Z4Ew6NE0VRNhxPItM4M8oCtPdif0yCclW-CcsFqScu0,65638
9
14
  pyopencl/capture_call.py,sha256=B2d4SkPrj4f8j5jLDmKHSmSLxK0k9646gKL2FYZkejQ,5694
10
- pyopencl/cltypes.py,sha256=DdBVPBU2bRuIbT8ImhWFIQosrefMOkAa4mY4yoSnurc,4818
11
- pyopencl/bitonic_sort.py,sha256=cHd7PHX0arDGJbhaB7AJVI9THVJE69lGuGiB08zeZJ0,8021
12
- pyopencl/clmath.py,sha256=lOxQzE6BEp5-nVRuGu0hgxzk_gcx7aTiy_hRFxAPmcI,8222
13
- pyopencl/version.py,sha256=PhHAIjtUGVQ2wTVlqgoOrcC_2rkvNMmqvy1rRDqWOhg,267
15
+ pyopencl/_mymako.py,sha256=WzmwJ-9EyenDo6RNOcXZmVum886PsmPS2gLNmUBORsA,620
14
16
  pyopencl/clrandom.py,sha256=BciZJkcKaNzmqP8tfGdb5SPI4qMACSUtLbQTJaOT5kE,13044
15
- pyopencl/tools.py,sha256=eZdKtkwY34kPbMR9FuFAmQbDQG8vJdv1az_UPiGNxjE,45940
16
- pyopencl/bitonic_sort_templates.py,sha256=x2hJaR-9AO74C_X7bVTTSxQxGqoDrF2-nQxzmMCSCXs,16151
17
17
  pyopencl/algorithm.py,sha256=8qqD_GqvuQguSCDWcrJCeA05xFMj8mpJH1y5O0tUqmM,51293
18
- pyopencl/_cl.cpython-312-x86_64-linux-musl.so,sha256=XNscSQry09GgqqK_CrjVz6t5w6xzehyRZ6HxAWvx77w,2721681
19
- pyopencl/invoker.py,sha256=hL5qMYOJpXEh2X1xbkkDaoYWRXgP-9fISY0N5VtL--8,14060
20
- pyopencl/_mymako.py,sha256=WzmwJ-9EyenDo6RNOcXZmVum886PsmPS2gLNmUBORsA,620
21
- pyopencl/__init__.py,sha256=BDkk5adIO4tHSYxxx_O7W4cyTHALwJB1aPpX5BrKep8,81443
22
- pyopencl/_cluda.py,sha256=KKUxizD1iQEuZ_TmmFZNJ8IdXa8x8uT9HgB0nmAlYLw,2074
23
- pyopencl/reduction.py,sha256=CrWJPDYNy4hxtCGgwq2fkWAQXjJ8zMLxV5CEbAh3Wb8,25533
24
18
  pyopencl/cache.py,sha256=EbTTIxXmrdcgjzqWQl7O_1EG1RqniHg5sjJQS_5LXIs,16000
25
- pyopencl/.libs/libOpenCL-1ef0e16e.so.1.0.0,sha256=kJi2f80Ihm_qKQuOZdK0MRJvlKCbPsRMUjnhhsjfpLQ,610825
19
+ pyopencl/ipython_ext.py,sha256=TUgxJa_w7tvXaKj6kPjiXNEKlxrwsJScQCD0khAA1kk,1915
20
+ pyopencl/bitonic_sort_templates.py,sha256=x2hJaR-9AO74C_X7bVTTSxQxGqoDrF2-nQxzmMCSCXs,16151
21
+ pyopencl/version.py,sha256=k4ev2_LuJAomsl8CUq1IHcINH3DUnLqTuGkf5q-ua10,268
22
+ pyopencl/bitonic_sort.py,sha256=cHd7PHX0arDGJbhaB7AJVI9THVJE69lGuGiB08zeZJ0,8021
23
+ pyopencl/_cluda.py,sha256=KKUxizD1iQEuZ_TmmFZNJ8IdXa8x8uT9HgB0nmAlYLw,2074
24
+ pyopencl/cltypes.py,sha256=Pkr7_oTkQhVHP-1JyfIWiE8ORpkQ3molOL986Sodvl0,4816
26
25
  pyopencl/cl/pyopencl-bessel-j-complex.cl,sha256=o-17yK_wBFqRiGgTYHg9waooTEKt1SCoguMUbg2LOB0,6026
26
+ pyopencl/cl/pyopencl-complex.h,sha256=gy7Ge9tuDeLYdpM8KIvKK347AxK5XPFhlVjJfgPtIlI,8544
27
27
  pyopencl/cl/pyopencl-bessel-j.cl,sha256=69d5WoqajYSubLgA6OVwYw0yOHGt64zY97J8isnsQgU,23274
28
+ pyopencl/cl/pyopencl-airy.cl,sha256=S6S84BX6v6E9ZuGB7mdbFygUY99BaManrWMf47Ms7NA,8122
28
29
  pyopencl/cl/pyopencl-hankel-complex.cl,sha256=JSm38L6cOdnDssVqzKCNgjMrILT5ExkYAxz7i8rQBtA,31561
29
- pyopencl/cl/pyopencl-bessel-y.cl,sha256=VDy8l4lVxO8VcJR_maeGu_Qjnw27j28zBwhaTKDhBBg,12297
30
- pyopencl/cl/pyopencl-complex.h,sha256=gy7Ge9tuDeLYdpM8KIvKK347AxK5XPFhlVjJfgPtIlI,8544
31
30
  pyopencl/cl/pyopencl-eval-tbl.cl,sha256=YNi_hyeE4GtDwzx3mLOMRIHh9jOOzMwSv-F2F1lMevg,2616
32
- pyopencl/cl/pyopencl-airy.cl,sha256=S6S84BX6v6E9ZuGB7mdbFygUY99BaManrWMf47Ms7NA,8122
31
+ pyopencl/cl/pyopencl-bessel-y.cl,sha256=VDy8l4lVxO8VcJR_maeGu_Qjnw27j28zBwhaTKDhBBg,12297
33
32
  pyopencl/cl/pyopencl-random123/philox.cl,sha256=vYcQH7Vw13Q3qkW5Nhy1HTUDbWLGKoloE1YP0VWk6vU,21740
34
- pyopencl/cl/pyopencl-random123/array.h,sha256=nIV0zDWYuybldNgtsh79icNtDXHYdDsSpFaWIvDTyw4,17088
35
33
  pyopencl/cl/pyopencl-random123/openclfeatures.h,sha256=pAPbl7JkQgJxulSuGGevpaI43P7PwiH2mYxtNfHq59M,2881
34
+ pyopencl/cl/pyopencl-random123/array.h,sha256=nIV0zDWYuybldNgtsh79icNtDXHYdDsSpFaWIvDTyw4,17088
36
35
  pyopencl/cl/pyopencl-random123/threefry.cl,sha256=2WmQGxx5gPSv22UL9_MlXv0eMug91k3bC-5_yQ4wlnI,54699
37
- pyopencl/compyte/pyproject.toml,sha256=wFWDwx-uZHS1OR-em5Rzdfw2w3Ve4Y1IMO3Edg_dgB4,1218
36
+ pyopencl/characterize/__init__.py,sha256=MM56Q4P2IH-piykKeenHgsXYnAcB2HiTj0ftnYVYNVc,14346
37
+ pyopencl/characterize/performance.py,sha256=TD8-cNnGnn46sQwfR5xNF2nr8yQcrmhuzJaYB13pSqk,6866
38
38
  pyopencl/compyte/array.py,sha256=9dUSCSb475naOADXWhgpQb72Yx1FjKWMEaU6jRwdq90,7422
39
- pyopencl/compyte/.gitignore,sha256=HVYtbKRtOCPWZavrgYqO2u7UKFiE7g7ympmuQzKbBBw,168
40
39
  pyopencl/compyte/dtypes.py,sha256=OceW5dP7F0FGPUe4UgFBLX2mnUWFqAGc1vH-xhe6bNg,9843
40
+ pyopencl/compyte/.gitignore,sha256=HVYtbKRtOCPWZavrgYqO2u7UKFiE7g7ympmuQzKbBBw,168
41
41
  pyopencl/compyte/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- pyopencl/characterize/performance.py,sha256=TD8-cNnGnn46sQwfR5xNF2nr8yQcrmhuzJaYB13pSqk,6866
43
- pyopencl/characterize/__init__.py,sha256=MM56Q4P2IH-piykKeenHgsXYnAcB2HiTj0ftnYVYNVc,14346
42
+ pyopencl/compyte/pyproject.toml,sha256=wFWDwx-uZHS1OR-em5Rzdfw2w3Ve4Y1IMO3Edg_dgB4,1218
43
+ pyopencl/.libs/libOpenCL-22b26b87.so.1.0.0,sha256=uQo90gPHclADEUR4iZYlCGHxU667VfPRTLKsAU_D7Fg,610825