AttributeError: module 'pyopencl' has no attribute 'enqueue_read_buffer'
While trying to use "noise_map_plane_gpu" I encountered an attribute error:
File "d:\Atom\ReinfGame\testing3.py", line 34, in <module>
noise_map = noise_map_plane_gpu(120, 214, 5, 10, 5, 10, perlin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nate\AppData\Local\Programs\Python\Python312\Lib\site-packages\pynoise\noiseutil.py", line 148, in noise_map_plane_gpu
return source.get_values(width, height, lower_x, upper_x, 0, 0, lower_z, upper_z)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nate\AppData\Local\Programs\Python\Python312\Lib\site-packages\pynoise\noisemodule.py", line 649, in get_values
signal = gpu.gradient_noise(xa, ya, za, np.int32(seed), np.int32(self.quality.value))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nate\AppData\Local\Programs\Python\Python312\Lib\site-packages\pynoise\gpu.py", line 34, in gradient_noise
cl.enqueue_read_buffer(self.queue, dest_buf, rv).wait()
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pyopencl' has no attribute 'enqueue_read_buffer'. Did you mean: '_enqueue_read_buffer'?
FYI, per pyopencl github:
That family of functions has been deprecated since 2011 and complained with DeprecationWarnings when used. (Python helpfully doesn't show those by default, although that may have changed recently.) I finally bit the bullet and removed them in favor of plain enqueue_copy with the pybind11 restructuring.
Example code:
import numpy as np
import matplotlib.pyplot as plt
from pynoise.noisemodule import Perlin
from pynoise.noiseutil import noise_map_plane_gpu
perlin = Perlin()
noise_map = noise_map_plane_gpu(120, 214, 5, 10, 5, 10, perlin)
noise = np.array(noise_map).reshape(120, 214)
plt.imshow(noise, origin="lower")
plt.show()