Questions tagged [opencl-c]

OpenCL C is a programming language based on C99 that is used for writing kernel code to be used in OpenCL.

88 questions
1
vote
1 answer

drand48 on OpenCL Kernel

Does anyone have an implementation of drand48() or an equivalent that can work in an OpenCL kernel? I have been sending random numbers generated on the host through a buffer but I need random numbers generated on the device if there is any way to do…
Carter Roeser
  • 360
  • 3
  • 23
1
vote
1 answer

How could I use a vector buffer on opencl c kernel or set a SVM with this vector?

I am trying to allocate a vector (array of strings) to store 2 or more char(bytes) but the OpenCL kernel's compiler(clang) throw the following error kernel parameter cannot be declared as a pointer to a pointer when declaring a char**…
user11493865
1
vote
1 answer

Concerning OpenCL control flow, where if(false) is read instead of skipped, and debugging OpenCL in general

First of all, this is the first time I've actually felt the need to ask a question on StackOverflow, but I solved my problem while rubberducking and hacking my own OpenCL code. However, given how little useful and approachable debugging information…
Tristan Duquesne
  • 512
  • 1
  • 6
  • 16
1
vote
1 answer

Binary compilation in OpenCL

Following this github example. I have encountered a problem trying to use the pre built binary. I successfully create my binary since I get the message PLATFORM [Apple] --> SUCCESS (1). But, when trying to use the binary, the function…
VMO
  • 66
  • 8
1
vote
1 answer

OpenCL 1.2 out of order execution does not work

I am trying to apply filters in sequence base image -> filter1 -> filter2 -> read image. I used to use CL1.1 (C) in which I had events so filter2 would need to wait for filter1 event to finish and read would need to wait for filter2 event to finish.…
user1031204
  • 701
  • 1
  • 8
  • 30
1
vote
2 answers

Wrong value when copying from global to private memory

I am currently learning OpenCL and I have this kernel that works just fine when directly accessing the global array, but gives wrong results when using an intermediate value on the private memory, for example, aux on the code below. __kernel void…
1
vote
0 answers

How to distribute data read using intel_sub_group_block_read across work items in a subgroup in column major order in OpenCL?

My OpenCL code with vectorization is like this short8 x0, x1, x2, x3, x4, x5, x6, x7, m[8]; x0 = convert_short8(vload8(0, Org + 0 * Stride)); x1 = convert_short8(vload8(0, Org + 1 * Stride)); x2 = convert_short8(vload8(0, Org + 2 * Stride)); x3 =…
Harsh Wardhan
  • 2,110
  • 10
  • 36
  • 51
1
vote
0 answers

How expensive are explicit conversions with convert_T() in OpenCL?

With reference to this question, is it possible that the gain in performance obtained by vectorized operations is being offset by the explicit conversions with convert_T()? Note that the default type of the variable is unsigned char. I am using…
Harsh Wardhan
  • 2,110
  • 10
  • 36
  • 51
1
vote
1 answer

Do preprocessor directives affect OpenCL kernel performance?

If I use preprocessor directives like #if, #elif, etc., in my kernel , will it affect the performance in any way? I'm assuming that these conditions are resolved at the compile time itself.
Harsh Wardhan
  • 2,110
  • 10
  • 36
  • 51
1
vote
3 answers

How to accumulate vectors in OpenCL?

I have a set of operations running in a loop. for(int i = 0; i < row; i++) { sum += arr1[0] - arr2[0] sum += arr1[0] - arr2[0] sum += arr1[0] - arr2[0] sum += arr1[0] - arr2[0] arr1 += offset1; arr2 += offset2; } Now I'm…
Harsh Wardhan
  • 2,110
  • 10
  • 36
  • 51
1
vote
0 answers

How to pass a pointer in a class to a kernel in opencl c++ and get pointer data

The platform i am using is AMD radeon 200 series (sapphire 250 (GPU- Oland) I am creating a class on host having a pointer as data member, and same class on kernel side too. now if in kernel side, pointer is present in the class, build error( -11)…
anil
  • 158
  • 1
  • 12
1
vote
1 answer

How can I simplify this OpenCL Kernel code?

void write_solution(uchar our_index[16], global uchar *solution) { uchar8 solution_data = 0; solution_data.s0 = (our_index[0] & 0xF) + ((our_index[1] & 0xF) << 4); solution_data.s1 = (our_index[2] & 0xF) + ((our_index[3] & 0xF) << 4); …
Xirema
  • 19,889
  • 4
  • 32
  • 68
0
votes
1 answer

Summing a stream of records using OpenCL

We acquire data from an external device in the form of a continuous stream of "records" of 16-bit values. The record length is configured before the streaming starts and can vary between 20,000 and 50,000 (values, not bytes). This remains the same…
Andrew Stephens
  • 9,413
  • 6
  • 76
  • 152
0
votes
1 answer

Problems additionVector with OpenCL

I want to learn OpenCL so i read a tutorial with a simple vector addition https://www.eriksmistad.no/getting-started-with-opencl-and-gpu-computing/ Im working with ubuntu Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: …
0
votes
1 answer

OpenCL clFinish never returns

I'm looking to start learning OpenCL. I was looking for a "hello world" example in order to first verify that everything behaves as expected on my system. After trying multiple such examples, I'm unable to find (or to make) one that works. The code…
martinkunev
  • 1,364
  • 18
  • 39