Questions tagged [pyopencl]
PyOpenCL provides Pythonic access to the OpenCL parallel computation API.
342
questions
0
votes
0
answers
24
views
pyopencl: "clEnqueueReadBuffer failed: INVALID_VALUE"
I have attempted to search for a solution or possible cause for this but I cant find anything.
Python 3.9 / pyopencl 2022.3.1
Getting Context / Queue:
PLATFORM = cl.get_platforms()[0]
DEVICE = ...
0
votes
0
answers
27
views
pyopencl crashes randomly after enqueueing a kernel on device
I am trying to perform grayscale ( a random operation I arbitrarily choose ) to perform in a heterogenous manner. If I have 100 pictures, i want to split them across all the available devices in the ...
2
votes
1
answer
257
views
Opencl not detecting T4 hardware accelerator in colab
I use a notebook in colab and I started to get the following error message:
LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR
My code uses PyRQA package, which uses opencl to perform ...
0
votes
0
answers
35
views
pyopencl throws "RuntimeError: Unresolved external function" during program build
I am implementing the k nearest neighbors (kNN) algorithm in Python from scratch. During the operation of this classification algorithm, it is necessary to calculate the distance between objects in n-...
0
votes
0
answers
33
views
I am trying to use adreno GPU in qualcomm RB5 in ubuntu environment using pyopencl
I am trying to use adreno GPU in qualcomm RB5 in ubuntu environment by using pyopencl. Does anyone have experience of similar project through pyopencl?
import pyopencl as cl
Create a PyOpenCL context
...
1
vote
0
answers
160
views
Using Adreno GPU for deep learning
I need to use Adreno GPU for deep learning (TensorFlow, PyTorch) instead of Nvidia is there has anyone know how? I'm using Python what do I have to do I really have no idea. I also got the ...
0
votes
0
answers
37
views
Python - Fast KNN Search for calculate points distances
I'm trying to do a knn lookup to calculate the distances between all points in a reference cloud to another cloud. I have two large point clouds with over 200 million points and my algorithm needs to ...
1
vote
1
answer
109
views
Random Generator in OpenCL?
Since there is no built-in random function in OpenCL (not that I know of, please correct me if this is not true). To generate a random list that put into kernel will not work for the purpose of my ...
0
votes
1
answer
91
views
How to Use Functions of Complex Numbers In Pyopencl?
Ive been trying to implement newton fractals using pyopencl's element wise kernel, from what i can tell it essentially compiles a section of C code then runs it for each element in parallel on a GPU. ...
2
votes
1
answer
133
views
Can I use PyOpenCL in integration with Scipy to perform Differential Evolution in parallel with GPU?
I got my code for simulating a multivariate regression model to work using the Differential Evolution, and even got the multiprocessing option to help out in reducing runtime. However, with 7 ...
0
votes
1
answer
767
views
How do I use the OpenCL C++/C++ for OpenCL kernel languages?
I have only tried compiling kernels using pyopencl, but I can only seem to be able to use OpenCl C. Looking at clinfo, I only see support for CLC listed, heres some truncated output from my pc:
...
0
votes
1
answer
239
views
Composite multiple images using OpenCL and Python: Kernel image2d_array_t?
As I'm exploring some ways to composite (custom overlay) multiple images into one and I found this great article https://towardsdatascience.com/get-started-with-gpu-image-processing-15e34b787480. My ...
0
votes
1
answer
38
views
Change the default value of CL_DEVICE_IMAGE3D_MAX_WIDTH
I have a 3d image with dimensions of more than 2048. When I try to load the image into the OpenCL program using the clCreateImage3d() call, I get an error. Because the underlying device can also ...
0
votes
1
answer
79
views
Copying random values to OpenCL device returns non valid values
I have a simple problem where I want to copy randomly generated floats on an OpenCL device and use those values on the device because OpenCL doesn't provide a random number generator.
However, it ...
0
votes
1
answer
50
views
opencl skipping data during operation on struct
I have a custom struct on which I want to do an operation to reduce the field scalar1 on all my structs. It is a very straightforward operation. It seems the subtraction is happening, but OpenCL does ...
0
votes
2
answers
140
views
pyopencl initialize non zero float4 array
I want to populate an array with float4 type. I have no idea how to initialize the arrays with something else than zeros. I've tried variations of this, but this is what I've come with, that explains ...
-3
votes
2
answers
133
views
Memory Crash on Intel CPU when running OpenCL code for particular input
I'm working on running my OpenCL codes on CPU and GPU. I'm experiencing some memory crash issue when I run my OpenCL code on CPU that is for particular input vector...I'm not seeing the issue when I ...
0
votes
1
answer
722
views
Opencl clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL, &num_devices) returning -1
I'm using Intel OpenCL SDK. Last month, when I tried to run my opencl code on CPU present in my system , by clGetDeviceIDs(platform, CL_DEVICE_TYPE_CPU, 0, NULL, &num_devices), it worked..and ...
1
vote
1
answer
105
views
pyopencl kernel outputs black image
Why is the image coming out as black when saved? I am just beginning to learn opencl.
Without opencl, on purely CPU, the loop iterates through the matrix and uses the rgb2gray average formula to store ...
0
votes
1
answer
30
views
PyOpenCL: Unpredictable behavior of normalize() in kernel code
I have the following function in my kernel source code:
double bondAngle(double3 pI, double3 pJ, double3 pK){
double3 pJK =normalize(pK-pJ);
double3 pJI = normalize(pI-pJ);
double3 _pJI = ...
0
votes
1
answer
32
views
Trying to skip recasting causes a race condition in OpenCL
I'm just going to start with code, then explain.
Say I have the following host code:
import pyopencl as cl
import numpy as np
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
host_arr = ...
2
votes
0
answers
178
views
Pyopencl._cl.LogicError: clWaitForEvents failed: <unknown error -9999>
I'm solving some equations using pyopencl on GPU device. If I increase size of computational arrays I get:
launch.wait()
pyopencl._cl.LogicError: clWaitForEvents failed: <unknown error -9999>
...
0
votes
1
answer
135
views
Why calculating of unique work id wrong after magic number 16777216?
I can't undestand where I make mistake.
Target - fill array with unique work id.
I found magic number - q = 16777216 = 1024 * 1024 * 16.
If array length less than q, all good: check_array function ...
0
votes
1
answer
157
views
Translate OpenCl code for CPU compilation
Sometimes I find myself writing OpenCl kernel code (using pyopencl), even for tasks which involve moderate computational complexity, because it is easier to develop than a chain of numpy operations (...
0
votes
1
answer
38
views
strange OpenCL behavior
I faced very strange behavior of OpenCL. I've linked a minimal code sample.
Starting from some random index (commonly 32-divisible) values is not written to array if I add one extra operation ...
-1
votes
1
answer
276
views
pyopencl on Intel(R) Iris(R) Plus Graphics
I'm getting the following error:
"Build on <pyopencl.Device 'Intel(R) Iris(R) Plus Graphics' on 'Intel(R) OpenCL HD Graphics' at 0x1cf4da041e0>:
**error**: use of type 'double' requires ...
1
vote
0
answers
121
views
How to bridge arrays between pyopencl and numpy on CPU?
In my program the data is processed with numpy and pyopencl. To exchange data between those two libraries I always have to copy the data with .to_device() or .get() functions available in pyopencl. ...
0
votes
1
answer
75
views
Is it possible to run a 4 dimensional work item in pyopencl?
I have a pyopencl based code which runs perfectly fine for 3-dimensional work groups, but when moving to 4-dimensional work groups, it breaks down with the error:
pyopencl._cl.LogicError: ...
1
vote
0
answers
66
views
Correlation matrix using opencl
How can we efficiently implement calculation of correlation matrix (pearson correlation) using opencl? Can anyone help me with the kernel function?
1
vote
1
answer
50
views
OpenCL bincount
I am trying to implement a bincount operation in OpenCL which allocates an output buffer and uses indices from x to accumulate some weights at the same index (assume that num_bins == max(x)). This is ...
0
votes
1
answer
59
views
pyopencl - how to use generic types?
I work Interchangeably with 32 bit floats and 32 bit integers. I want two kernels that do exactly the same thing, but one is for integers and one is for floats. At first I thought I could use ...
0
votes
1
answer
533
views
How to use PyOpenCl passing arguments to kernel
I wrote a python code to generate the mandelbrot set to a ppm file, and now I'm trying to implement pyopencl to speed up the process and compare running times but I'm very unaware of how pyopencl ...
0
votes
1
answer
333
views
PyOpenCl Invalid Kernel Argument
I wrote some code to parallelize convolution with one filter in python on my gpu. I keep receiving this error and I am unsure how to fix it. I posted the error below as well as my code. Thank you so ...
0
votes
1
answer
436
views
OpenCL max_work_item_sizes
I am having trouble understanding what the work item constraints mean. I am using pyopencl and looking at the max_work_item_sizes it gives what I assumed was the max number of global work threads for ...
0
votes
1
answer
59
views
Does chaining commutative operations improve performance?
I have some OpenCL kernels which are interfacing with python threw the pyopencl library. The kernels are used to speed up commutative operations (like addition or multiplication), where the order of ...
0
votes
1
answer
390
views
Does CL_DEVICE_HOST_UNIFIED_MEMORY change how buffers are handled?
I'm learning OpenCL, using PyOpenCL and Numpy. So far I've learned that when passing a Numpy array to a kernel, you need to create a pyopencl.Buffer object that represents an array on the device, and ...
0
votes
1
answer
93
views
Interaction between numpy arrays of pyOpenCL vector types and numpy arrays of floats
I find it quite convenient to use both structs and np.ndarrays using dtypes like pyopencl.cltypes.float2. This is a clear and self documenting way to pass structured data to my kernels, as opposed to ...
2
votes
1
answer
915
views
Maximum number of parallel processes on a simple CPU/GPU
I am trying to run a particle filter with 3000 independent particles. More specifically, I would like to run 3000 (simple) computations in parallel at the same time, so that the computation time ...
1
vote
1
answer
404
views
PyOpenCl simple matrix multiplication
I am trying to learn PyOpenCl.
I am following various tutorials/examples that I found online, and I have been trying to put together a simple matrix multiplication.
I fail to see why I cannot get the ...
0
votes
1
answer
339
views
PyOpenCL - Multi-dimensional reduction kernel
I'm a total newbie to OpenCL.
I'm trying to code a reduction kernel that sums along one axis for a multi-dimensional array. I have stumbled upon that code which comes from here: https://tmramalho....
4
votes
3
answers
4k
views
How to run Python script on a Discrete Graphics AMD GPU?
WHAT I WANT TO DO:
I have a script that I use for factorizing prime numbers given a certain range:
# Python program to display all the prime numbers within an interval
lower = 900
upper = 1000
...
0
votes
1
answer
319
views
OpenCL - Element-wise operations on 4D array
I am trying to write an OpenCL code to do element-wise operations on multi-dimensional arrays.
I know that OpenCL buffers are flattened, which makes indexing a bit tricky. I succeeded when dealing ...
0
votes
1
answer
48
views
pyOpenCL increasing times in coping
I am new with OpenCL, and I've just started with the tutorial. There is one problem with performances: the time it takes to get back results increases with the number of executions, although the copy ...
0
votes
2
answers
220
views
(Py)OpenCL modify value from all threads simultanously
Simple, I have the following kernel which modifies the value of C[0], where C is an array with only one element.
__kernel void sigma(__global float *A, __global float *B, __global float *C) {
int ...
0
votes
1
answer
74
views
OpenCL returns "OUT_OF_RESOURCES" error when loading an RGB texture-buffer and everything works fine with RGBA
OpenCL stubbornly refuses to load three-component textures, but if you add an empty fourth component, everything works fine. I suppose this is some kind of hardware limitation associated with the ...
1
vote
0
answers
551
views
(Windows 10) Miniconda Pyopencl - ImportError: DLL load failed while importing _cl: The specified procedure could not be found
I've been working with pyopencl on my Macbook. I installed miniconda and installed pyopencl from there by using these instructions.
On my Mac everything works fine, I can run a small example program ...
1
vote
0
answers
94
views
Array passed to opencl kernel incorrect
I'm a trying hard on AMD Radeon RX570 Series' OpenCL.
I'm trying to pass a array of argument onto OpenCL kernel but unsuccessful.
Here is the code
is_prime.py
import os
import sys
import numpy as np
...
1
vote
1
answer
385
views
OpenCL Compute units and GPU Processing units mismatch
I'm a bit confused about compute units. I have an nvidia gtx 1650Ti graphics card. When I asked for max_compute_units, it returns 16 units, and max_work_group_size is 1024.
But when I executed the ...
0
votes
0
answers
102
views
Naive 2D Square Matrix Multiplication using pyopencl
I'm trying to implement a simple naive MVM kernel for two square matrices using OpenCL and the pyopencl python library, however, the result is not as expected. My OpenCL and Python code used are as ...
3
votes
0
answers
649
views
ERROR: Could not build wheels for pyopencl which use PEP 517 and cannot be installed directly
I am trying to install pyopencl using pip install pyopencl but am getting the following error lines:
ERROR: Failed building wheel for pyopencl \
Failed to build pyopencl \
ERROR: Could not build ...