Questions tagged [pyopencl]
PyOpenCL provides Pythonic access to the OpenCL parallel computation API.
335
questions
0
votes
1
answer
22
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
33
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
0
answers
42
views
Questions about Improving Performance with from scratch Python Graphics Library
I'm currently working on building a graphics library with Python. (I know opengl exists, but this is just for fun) Essentially, I want to be able to implement many of the common features available ...
0
votes
2
answers
58
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
43
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
84
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
27
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
14
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
21
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 = ...
0
votes
0
answers
39
views
How to use one pyOpenCL buffer for Kernel executions in many child processes?
I have the following problem.
I need to execute an openCL kernel many times and I want this to happen in parallel using multiprocessing.
Now one of the kernels input buffers(which is also quite large) ...
1
vote
0
answers
46
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
0
answers
48
views
Segmentation fault in building OpenCL Kernel (PyOpenCL)
can someone explain to me why the following OpenCL kernel code (assume z_new is some float8):
float fac = 0.0f;
float8 square = 0.0f;
square = powr(z_new[i], 2);
fac += sqrt(square.s0+square.s1+square....
0
votes
0
answers
6
views
Tensor Indexing problems with pyopencl
I am trying to work with 3d arrays in PyOpenCL, however after reading from the output buffer the data is in disorder.
The following code and output shoes an example.
'''
import numpy as np
import ...
0
votes
1
answer
77
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
65
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
27
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
76
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 ...
0
votes
0
answers
102
views
SHA 256 as PyOpenCL KERNEL
I am trying to run sha256 with below codes, using them as header files into the kernel function of a python program.
/*************************** HEADER FILES ***************************/
#include &...
1
vote
0
answers
63
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
0
answers
33
views
PyOpenCL kernel not returning
I'm playing with PyOpenCL for the first time, by writing a ray tracer, real original. I'm encountering an interesting issue where sometimes my opencl kernel does not close. For a while it was "...
0
votes
1
answer
31
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
30
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
44
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
29
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
171
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
119
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
166
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
46
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
155
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
53
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
323
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
235
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
132
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
2k
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
158
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
20
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
84
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
38
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
372
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
41
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
234
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
60
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
529
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 ...
0
votes
2
answers
78
views
Addition of complex 3D arrays in pyopencl
I'm trying to add 2 three dimensional complex arrays with help of python library pyopencl. The result achieved on gpu differs from the reference result achieved with use of cpu. Why does GPU code do ...
1
vote
1
answer
233
views
PyOpenCL problem with printf build in kernel
When execute my program in python, I have a problem with a build only in "cl.device_type.GPU" but "cl.device_type.CPU" don't have problems
import pyopencl as cl
Mi_Contexto=cl....
0
votes
0
answers
172
views
Why does my pyopencl image manipulation stop working when I switch to color?
I'm trying to make a very simple GPU implementation of a lerp between two images in python and opencl (as my first ever opencl project, lol). It works when I use grayscale images, but gives nothing (...
0
votes
2
answers
1k
views
Installing PyOpenCL on Windows using Intel's SDK and pip
Following these instructions, I have downloaded and installed Intel's OpenCL™ SDK (Intel® System Studio) from here. The cl.h file is in the folder
C:\Program Files (x86)\IntelSWTools\...
0
votes
1
answer
141
views
What data-type is used for images?
I was deriving NDVI (Normalized Difference Vegetation Index), which is a ratio of (NIR-R)/(NIR+R) where NIR is Near-Infrared band and R is Red band. This index ranges from -1 to 1. So I wrote a ...
0
votes
1
answer
188
views
Template Matching using PyOpenCl
I was moving ahead with more complicated aspects in image processing using opencl. Now what I tried was template matching and I am getting some results but not sure is it is correct. I think the ...
0
votes
1
answer
141
views
Edge Detection using PyOpenCL
I was having an issue while writing a python script to detect the edge using PyOpenCl. I am new to OpenCL and while trying I encountered a problem which after many tweaks, I am unable to solve. below ...