pyopencl 2024.3__tar.gz → 2025.1__tar.gz

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.

Files changed (120) hide show
  1. {pyopencl-2024.3 → pyopencl-2025.1}/CMakeLists.txt +2 -0
  2. {pyopencl-2024.3 → pyopencl-2025.1}/PKG-INFO +1 -1
  3. {pyopencl-2024.3 → pyopencl-2025.1}/contrib/cldis.py +1 -1
  4. {pyopencl-2024.3 → pyopencl-2025.1}/contrib/fortran-to-opencl/translate.py +1 -1
  5. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime_memory.rst +1 -1
  6. {pyopencl-2024.3 → pyopencl-2025.1}/doc/subst.rst +1 -1
  7. {pyopencl-2024.3 → pyopencl-2025.1}/examples/n-body.py +4 -4
  8. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/array.py +8 -83
  9. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cltypes.py +2 -2
  10. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/version.py +1 -1
  11. {pyopencl-2024.3 → pyopencl-2025.1}/pyproject.toml +38 -1
  12. {pyopencl-2024.3 → pyopencl-2025.1}/scripts/build-ocl-macos.sh +2 -2
  13. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_cl.hpp +6 -6
  14. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_array.py +18 -0
  15. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_wrapper.py +5 -5
  16. {pyopencl-2024.3 → pyopencl-2025.1}/.gitignore +0 -0
  17. {pyopencl-2024.3 → pyopencl-2025.1}/.gitlab-ci.yml +0 -0
  18. {pyopencl-2024.3 → pyopencl-2025.1}/.gitmodules +0 -0
  19. {pyopencl-2024.3 → pyopencl-2025.1}/.pylintrc-local.yml +0 -0
  20. {pyopencl-2024.3 → pyopencl-2025.1}/.test-conda-env-py3.yml +0 -0
  21. {pyopencl-2024.3 → pyopencl-2025.1}/CITATION.cff +0 -0
  22. {pyopencl-2024.3 → pyopencl-2025.1}/LICENSE +0 -0
  23. {pyopencl-2024.3 → pyopencl-2025.1}/README.rst +0 -0
  24. {pyopencl-2024.3 → pyopencl-2025.1}/contrib/fortran-to-opencl/README +0 -0
  25. {pyopencl-2024.3 → pyopencl-2025.1}/contrib/pyopencl.vim +0 -0
  26. {pyopencl-2024.3 → pyopencl-2025.1}/doc/.gitignore +0 -0
  27. {pyopencl-2024.3 → pyopencl-2025.1}/doc/Makefile +0 -0
  28. {pyopencl-2024.3 → pyopencl-2025.1}/doc/algorithm.rst +0 -0
  29. {pyopencl-2024.3 → pyopencl-2025.1}/doc/array.rst +0 -0
  30. {pyopencl-2024.3 → pyopencl-2025.1}/doc/conf.py +0 -0
  31. {pyopencl-2024.3 → pyopencl-2025.1}/doc/howto.rst +0 -0
  32. {pyopencl-2024.3 → pyopencl-2025.1}/doc/index.rst +0 -0
  33. {pyopencl-2024.3 → pyopencl-2025.1}/doc/make_constants.py +0 -0
  34. {pyopencl-2024.3 → pyopencl-2025.1}/doc/misc.rst +0 -0
  35. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime.rst +0 -0
  36. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime_const.rst +0 -0
  37. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime_gl.rst +0 -0
  38. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime_platform.rst +0 -0
  39. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime_program.rst +0 -0
  40. {pyopencl-2024.3 → pyopencl-2025.1}/doc/runtime_queue.rst +0 -0
  41. {pyopencl-2024.3 → pyopencl-2025.1}/doc/tools.rst +0 -0
  42. {pyopencl-2024.3 → pyopencl-2025.1}/doc/types.rst +0 -0
  43. {pyopencl-2024.3 → pyopencl-2025.1}/examples/.gitignore +0 -0
  44. {pyopencl-2024.3 → pyopencl-2025.1}/examples/black-hole-accretion.py +0 -0
  45. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo-struct-reduce.py +0 -0
  46. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo.py +0 -0
  47. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_array.py +0 -0
  48. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_array_svm.py +0 -0
  49. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_elementwise.py +0 -0
  50. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_elementwise_complex.py +0 -0
  51. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_mandelbrot.py +0 -0
  52. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_meta_codepy.py +0 -0
  53. {pyopencl-2024.3 → pyopencl-2025.1}/examples/demo_meta_template.py +0 -0
  54. {pyopencl-2024.3 → pyopencl-2025.1}/examples/dump-performance.py +0 -0
  55. {pyopencl-2024.3 → pyopencl-2025.1}/examples/dump-properties.py +0 -0
  56. {pyopencl-2024.3 → pyopencl-2025.1}/examples/gl_interop_demo.py +0 -0
  57. {pyopencl-2024.3 → pyopencl-2025.1}/examples/gl_particle_animation.py +0 -0
  58. {pyopencl-2024.3 → pyopencl-2025.1}/examples/ipython-demo.ipynb +0 -0
  59. {pyopencl-2024.3 → pyopencl-2025.1}/examples/median-filter.py +0 -0
  60. {pyopencl-2024.3 → pyopencl-2025.1}/examples/narray.py +0 -0
  61. {pyopencl-2024.3 → pyopencl-2025.1}/examples/noisyImage.jpg +0 -0
  62. {pyopencl-2024.3 → pyopencl-2025.1}/examples/pi-monte-carlo.py +0 -0
  63. {pyopencl-2024.3 → pyopencl-2025.1}/examples/svm.py +0 -0
  64. {pyopencl-2024.3 → pyopencl-2025.1}/examples/transpose.py +0 -0
  65. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/__init__.py +0 -0
  66. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/_cluda.py +0 -0
  67. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/_mymako.py +0 -0
  68. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/algorithm.py +0 -0
  69. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/bitonic_sort.py +0 -0
  70. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/bitonic_sort_templates.py +0 -0
  71. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cache.py +0 -0
  72. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/capture_call.py +0 -0
  73. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/characterize/__init__.py +0 -0
  74. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/characterize/performance.py +0 -0
  75. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-airy.cl +0 -0
  76. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-bessel-j-complex.cl +0 -0
  77. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-bessel-j.cl +0 -0
  78. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-bessel-y.cl +0 -0
  79. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-complex.h +0 -0
  80. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-eval-tbl.cl +0 -0
  81. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-hankel-complex.cl +0 -0
  82. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-random123/array.h +0 -0
  83. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-random123/openclfeatures.h +0 -0
  84. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-random123/philox.cl +0 -0
  85. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/cl/pyopencl-random123/threefry.cl +0 -0
  86. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/clmath.py +0 -0
  87. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/clrandom.py +0 -0
  88. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/compyte/.gitignore +0 -0
  89. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/compyte/__init__.py +0 -0
  90. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/compyte/array.py +0 -0
  91. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/compyte/dtypes.py +0 -0
  92. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/compyte/pyproject.toml +0 -0
  93. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/elementwise.py +0 -0
  94. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/invoker.py +0 -0
  95. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/ipython_ext.py +0 -0
  96. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/reduction.py +0 -0
  97. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/scan.py +0 -0
  98. {pyopencl-2024.3 → pyopencl-2025.1}/pyopencl/tools.py +0 -0
  99. {pyopencl-2024.3 → pyopencl-2025.1}/scripts/build-ocl-windows.sh +0 -0
  100. {pyopencl-2024.3 → pyopencl-2025.1}/scripts/build-ocl.sh +0 -0
  101. {pyopencl-2024.3 → pyopencl-2025.1}/src/bitlog.cpp +0 -0
  102. {pyopencl-2024.3 → pyopencl-2025.1}/src/bitlog.hpp +0 -0
  103. {pyopencl-2024.3 → pyopencl-2025.1}/src/clinfo_ext.h +0 -0
  104. {pyopencl-2024.3 → pyopencl-2025.1}/src/mempool.hpp +0 -0
  105. {pyopencl-2024.3 → pyopencl-2025.1}/src/pyopencl_ext.h +0 -0
  106. {pyopencl-2024.3 → pyopencl-2025.1}/src/tools.hpp +0 -0
  107. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_cl.cpp +0 -0
  108. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_cl_part_1.cpp +0 -0
  109. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_cl_part_2.cpp +0 -0
  110. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_constants.cpp +0 -0
  111. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_helpers.hpp +0 -0
  112. {pyopencl-2024.3 → pyopencl-2025.1}/src/wrap_mempool.cpp +0 -0
  113. {pyopencl-2024.3 → pyopencl-2025.1}/test/add-vectors-32.spv +0 -0
  114. {pyopencl-2024.3 → pyopencl-2025.1}/test/add-vectors-64.spv +0 -0
  115. {pyopencl-2024.3 → pyopencl-2025.1}/test/empty-header.h +0 -0
  116. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_algorithm.py +0 -0
  117. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_arrays_in_structs.py +0 -0
  118. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_clmath.py +0 -0
  119. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_clrandom.py +0 -0
  120. {pyopencl-2024.3 → pyopencl-2025.1}/test/test_enqueue_copy.py +0 -0
@@ -167,6 +167,8 @@ find_package(OpenCL REQUIRED)
167
167
  nanobind_add_module(
168
168
  _cl
169
169
  NB_STATIC # Build static libnanobind (the extension module itself remains a shared library)
170
+ LTO
171
+ NOMINSIZE
170
172
  src/wrap_constants.cpp
171
173
  src/wrap_cl.cpp
172
174
  src/wrap_cl_part_1.cpp
@@ -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
@@ -64,7 +64,7 @@ def main(ctx, tmp_dir, cl_str, output=None, build_options=()):
64
64
  if output == "sass":
65
65
  with open(os.path.join(tmp_dir, "cl.ptx"), "w") as f:
66
66
  f.write(res)
67
- tgt = re.findall(".target sm_[0-9]*", res, re.MULTILINE)[0]
67
+ tgt = re.findall(r".target sm_[0-9]*", res, re.MULTILINE)[0]
68
68
  gpu_name = tgt[8:]
69
69
  subprocess.check_call(["ptxas", "cl.ptx", "--verbose",
70
70
  f"--gpu-name={gpu_name}", "--warn-on-spills"], cwd=tmp_dir)
@@ -624,7 +624,7 @@ class Scope:
624
624
 
625
625
  if self.implicit_types is None:
626
626
  raise TranslationError(
627
- "no type for '%s' found in implict none routine"
627
+ "no type for '%s' found in implicit none routine"
628
628
  % name)
629
629
 
630
630
  return self.implicit_types.get(name[0], np.dtype(np.int32))
@@ -238,7 +238,7 @@ Operations on SVM
238
238
  Image
239
239
  -----
240
240
 
241
- .. class:: ImageFormat([channel_order, channel_type])
241
+ .. class:: ImageFormat(channel_order, channel_type)
242
242
 
243
243
  .. attribute:: channel_order
244
244
 
@@ -8,7 +8,7 @@
8
8
  (e.g. by being an :class:`numpy.ndarray`)
9
9
  .. |explain-waitfor| replace:: *wait_for*
10
10
  may either be *None* or a list of :class:`pyopencl.Event` instances for
11
- whose completion this command waits before starting exeuction.
11
+ whose completion this command waits before starting execution.
12
12
  .. |std-enqueue-blurb| replace:: Returns a new :class:`pyopencl.Event`. |explain-waitfor|
13
13
 
14
14
  .. |copy-depr| replace:: **Note:** This function is deprecated as of PyOpenCL 2011.1.
@@ -317,7 +317,7 @@ __kernel void InBallSplutterPoints(__global MYFLOAT4* clDataX,
317
317
  Heat=MWCfp;
318
318
  }
319
319
 
320
- // More accurate distribution based on spherical coordonates
320
+ // More accurate distribution based on spherical coordinates
321
321
  // Disactivated because of AMD Oland GPU crash on launch
322
322
  // private MYFLOAT Radius,Theta,Phi,PosX,PosY,PosZ,SinTheta;
323
323
  // Radius=MWCfp*diameter/2.e0f;
@@ -375,7 +375,7 @@ __kernel void SplutterStress(__global MYFLOAT4* clDataX,__global MYFLOAT4* clDat
375
375
  }
376
376
 
377
377
  // cast to float for sin,cos are NEEDED by Mesa FP64 implementation!
378
- // Implemention on AMD Oland are probably broken in float
378
+ // Implementation on AMD Oland are probably broken in float
379
379
 
380
380
  FromCoM=(MYFLOAT4)(clDataX[gid]-clCoM[0]);
381
381
  Length=length(FromCoM);
@@ -387,7 +387,7 @@ __kernel void SplutterStress(__global MYFLOAT4* clDataX,__global MYFLOAT4* clDat
387
387
  // Second tangential vector to sphere of length radius
388
388
  ThetaB=acos((float)(FromCoM.x/Length));
389
389
  PhiB=atan((float)(FromCoM.y/FromCoM.z))+5.e-1f*PI;
390
- // (x,y) random coordonates to plane tangential to sphere
390
+ // (x,y) random coordinates to plane tangential to sphere
391
391
  Polar=MWCfp*2.e0f*PI;
392
392
  tA=cos((float)Polar);
393
393
  tB=sin((float)Polar);
@@ -781,7 +781,7 @@ if __name__ == "__main__":
781
781
  Velocity = MyFloat(Velocity)
782
782
  Step = MyFloat(Step)
783
783
 
784
- print("Device choosed : %s" % Device)
784
+ print("Device chosen : %s" % Device)
785
785
  print("Number of particules : %s" % Number)
786
786
  print("Size of Shape : %s" % SizeOfShape)
787
787
  print("Initial velocity : %s" % Velocity)
@@ -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))
@@ -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
 
@@ -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("."))
@@ -11,7 +11,7 @@ requires = [
11
11
 
12
12
  [project]
13
13
  name = "pyopencl"
14
- version = "2024.3"
14
+ version = "2025.1"
15
15
  description = "Python wrapper for OpenCL"
16
16
  readme = "README.rst"
17
17
  authors = [
@@ -154,6 +154,14 @@ test-command = "pytest {project}/test"
154
154
  test-extras = [
155
155
  "test",
156
156
  ]
157
+ environment-pass = [
158
+ "CL_INC_DIR",
159
+ "CL_LIB_DIR",
160
+ ]
161
+ test-skip = [
162
+ "*-macosx_*:arm64",
163
+ "*-macosx_arm64",
164
+ ]
157
165
 
158
166
  [tool.cibuildwheel.linux]
159
167
  skip = [
@@ -205,3 +213,32 @@ skip = [
205
213
  ]
206
214
  test-command = ""
207
215
  before-all = "bash {package}/scripts/build-ocl-windows.sh"
216
+
217
+ [tool.typos.default]
218
+ extend-ignore-re = [
219
+ "(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$"
220
+ ]
221
+
222
+ [tool.typos.default.extend-words]
223
+ # for ND Range
224
+ ND = "ND"
225
+ nd = "nd"
226
+
227
+ # level-of-detail
228
+ LOD = "LOD"
229
+
230
+ # short for 'series'
231
+ "ser" = "ser"
232
+
233
+ # like the numpy function
234
+ "arange" = "arange"
235
+
236
+ [tool.typos.files]
237
+ extend-exclude = [
238
+ # No thanks, hex IDs in JSON should not be spellchecked.
239
+ "examples/*.ipynb",
240
+ # Copied from upstream
241
+ "pyopencl/cl/pyopencl-random123/*",
242
+ # This one has comments in French
243
+ "examples/black-hole-accretion.py"
244
+ ]
@@ -8,11 +8,11 @@ git clone --branch v2022.01.04 https://github.com/KhronosGroup/OpenCL-Headers
8
8
 
9
9
 
10
10
 
11
- cmake -D CMAKE_INSTALL_PREFIX=./OpenCL-Headers/install -S ./OpenCL-Headers -B ./OpenCL-Headers/build
11
+ cmake -D CMAKE_INSTALL_PREFIX=./OpenCL-Headers/install -S ./OpenCL-Headers -B ./OpenCL-Headers/build
12
12
  cmake --build ./OpenCL-Headers/build --target install
13
13
 
14
14
  cmake -D CMAKE_PREFIX_PATH=${PWD}/OpenCL-Headers/install -D OPENCL_ICD_LOADER_HEADERS_DIR=${PWD}/OpenCL-Headers/install/include -D CMAKE_INSTALL_PREFIX=./OpenCL-ICD-Loader/install -S ./OpenCL-ICD-Loader -B ./OpenCL-ICD-Loader/build
15
15
  cmake --build ./OpenCL-ICD-Loader/build --target install --config Release
16
16
 
17
17
  echo "PyOpenCL wheel includes Khronos Group OpenCL-ICD-Loader which is licensed as below" >> ${SCRIPT_DIR}/../LICENSE
18
- cat ./OpenCL-ICD-Loader/LICENSE >> ${SCRIPT_DIR}/../LICENSE
18
+ cat ./OpenCL-ICD-Loader/LICENSE >> ${SCRIPT_DIR}/../LICENSE
@@ -1893,7 +1893,7 @@ namespace pyopencl
1893
1893
  py::object m_py_event;
1894
1894
  py::object m_py_callback;
1895
1895
 
1896
- bool m_set_callback_suceeded;
1896
+ bool m_set_callback_succeeded;
1897
1897
 
1898
1898
  bool m_notify_thread_wakeup_is_genuine;
1899
1899
 
@@ -1901,7 +1901,7 @@ namespace pyopencl
1901
1901
  cl_int m_command_exec_status;
1902
1902
 
1903
1903
  event_callback_info_t(py::object py_event, py::object py_callback)
1904
- : m_py_event(py_event), m_py_callback(py_callback), m_set_callback_suceeded(true),
1904
+ : m_py_event(py_event), m_py_callback(py_callback), m_set_callback_succeeded(true),
1905
1905
  m_notify_thread_wakeup_is_genuine(false)
1906
1906
  {}
1907
1907
  };
@@ -1945,7 +1945,7 @@ namespace pyopencl
1945
1945
  {
1946
1946
  py::gil_scoped_acquire acquire;
1947
1947
 
1948
- if (cb_info->m_set_callback_suceeded)
1948
+ if (cb_info->m_set_callback_succeeded)
1949
1949
  {
1950
1950
  try {
1951
1951
  cb_info->m_py_callback(
@@ -1982,7 +1982,7 @@ namespace pyopencl
1982
1982
  // be woken up. Wake it up to let it know that it can stop.
1983
1983
  {
1984
1984
  std::lock_guard<std::mutex> lg(cb_info->m_mutex);
1985
- cb_info->m_set_callback_suceeded = false;
1985
+ cb_info->m_set_callback_succeeded = false;
1986
1986
  cb_info->m_notify_thread_wakeup_is_genuine = true;
1987
1987
  }
1988
1988
  cb_info->m_condvar.notify_one();
@@ -3673,7 +3673,7 @@ namespace pyopencl
3673
3673
  #ifdef PYPY_VERSION
3674
3674
  // FIXME: get a read-only buffer
3675
3675
  // Not quite honest, but Pypy doesn't consider numpy arrays
3676
- // created from objects with the __aray_interface__ writeable.
3676
+ // created from objects with the __array_interface__ writeable.
3677
3677
  ward->get(holder.ptr(), PyBUF_ANY_CONTIGUOUS);
3678
3678
  #else
3679
3679
  ward->get(holder.ptr(), PyBUF_ANY_CONTIGUOUS | PyBUF_WRITABLE);
@@ -4508,7 +4508,7 @@ namespace pyopencl
4508
4508
  py::tuple name_hdr_tup = py::borrow<py::tuple>(name_hdr_tup_py);
4509
4509
  if (py::len(name_hdr_tup) != 2)
4510
4510
  throw error("Program.compile", CL_INVALID_VALUE,
4511
- "epxected (name, header) tuple in headers list");
4511
+ "expected (name, header) tuple in headers list");
4512
4512
  std::string name = py::cast<std::string>(name_hdr_tup[0]);
4513
4513
  program &prg = py::cast<program &>(name_hdr_tup[1]);
4514
4514
 
@@ -2393,6 +2393,24 @@ def test_xdg_cache_home(ctx_factory):
2393
2393
  # }}}
2394
2394
 
2395
2395
 
2396
+ def test_numpy_type_promotion_with_cl_arrays(ctx_factory):
2397
+ ctx = ctx_factory()
2398
+ queue = cl.CommandQueue(ctx)
2399
+
2400
+ class NotReallyAnArray:
2401
+ @property
2402
+ def dtype(self):
2403
+ return np.dtype("float64")
2404
+
2405
+ # Make sure that np.result_type accesses only the dtype attribute of the
2406
+ # class, not (e.g.) its data.
2407
+ assert np.result_type(42, NotReallyAnArray()) == np.float64
2408
+
2409
+ from pyopencl.array import _get_common_dtype
2410
+ assert _get_common_dtype(42, NotReallyAnArray(), queue) == np.float64
2411
+ assert _get_common_dtype(42.0, NotReallyAnArray(), queue) == np.float64
2412
+
2413
+
2396
2414
  if __name__ == "__main__":
2397
2415
  if len(sys.argv) > 1:
2398
2416
  exec(sys.argv[1])
@@ -865,22 +865,22 @@ def test_user_event(ctx_factory):
865
865
  evt = cl.UserEvent(ctx)
866
866
  Thread(target=event_waiter1, args=(evt, 1)).start()
867
867
  sleep(.05)
868
- if status.get(1, False):
868
+ if status.get(1):
869
869
  raise RuntimeError("UserEvent triggered before set_status")
870
870
  evt.set_status(cl.command_execution_status.COMPLETE)
871
871
  sleep(.05)
872
- if not status.get(1, False):
872
+ if not status.get(1):
873
873
  raise RuntimeError("UserEvent.wait timeout")
874
874
  assert evt.command_execution_status == cl.command_execution_status.COMPLETE
875
875
 
876
876
  evt = cl.UserEvent(ctx)
877
877
  Thread(target=event_waiter2, args=(evt, 2)).start()
878
878
  sleep(.05)
879
- if status.get(2, False):
879
+ if status.get(2):
880
880
  raise RuntimeError("UserEvent triggered before set_status")
881
881
  evt.set_status(cl.command_execution_status.COMPLETE)
882
882
  sleep(.05)
883
- if not status.get(2, False):
883
+ if not status.get(2):
884
884
  raise RuntimeError("cl.wait_for_events timeout on UserEvent")
885
885
  assert evt.command_execution_status == cl.command_execution_status.COMPLETE
886
886
 
@@ -1402,7 +1402,7 @@ def test_empty_ndrange(ctx_factory, empty_shape):
1402
1402
  queue = cl.CommandQueue(ctx)
1403
1403
 
1404
1404
  if ctx._get_cl_version() < (1, 2) or cl.get_cl_header_version() < (1, 2):
1405
- pytest.skip("OpenCL 1.2 required for empty NDRange suuport")
1405
+ pytest.skip("OpenCL 1.2 required for empty NDRange support")
1406
1406
 
1407
1407
  a = cl_array.zeros(queue, empty_shape, dtype=np.float32)
1408
1408
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes