5,780 questions
0
votes
1
answer
52
views
What's the OpenCL idiom for elementwise array-lookup / gather operation with vectorized types?
Consider the following OpenCL code in which each element in a vector-type variable gets its value via array lookup:
float* tbl = get_data();
int4 offsets = get_offsets();
float4 my_elements = {
...
1
vote
1
answer
68
views
Local atomics causes GPU to crash
I am writing a OpenCL kernel that uses atomics. As I only need to synchronize groups of 192 threads, I figured using local atomics would be ideal. However, the change from global to local atomics ...
1
vote
0
answers
41
views
Unresolved extern function '__write_pipe_2' when building an OpenCL program
I'm using the OpenCL clBuildProgram() API function on a program created from a source string. The source is:
kernel void foo(int val, write_only pipe int outPipe)
{
write_pipe(outPipe, &val);
}...
0
votes
0
answers
14
views
Can clEnqueueSVMMap be used with a sub-region of an SVM memory region?
Suppose I've allocated a region of memory with clSVMAlloc(). Looking at the clEnqueueSVMMap() function, we are told that it will "allow the host to update a region of a SVM buffer".
Does ...
0
votes
0
answers
14
views
When should I use clEnqueueSVMMemcpy?
OpenCL has the mechanism of "shared virtual memory" (SVM), where the same memory region is available both in OpenCL kernel code and in host-side code - and updates on one side affect the ...
0
votes
0
answers
11
views
How can I determine why clSVMAlloc failed?
Most OpenCL API calls return a status/error value, either directly or via an out-parameter (example: clCreateBuffer()). While that is not as informative as a long-form string description, it can tell ...
0
votes
1
answer
31
views
How should I perform an elementwise cast of an OpenCL C vector value?
OpenCL C supports "vector data types" - a fixed number of scalar types which may be operated on together, as though they were a single scalar, mostly: we can apply arithmetic and logic ...
0
votes
1
answer
31
views
Why is clEnqueueWaitForEvents deprecated? It seems indispensible
I'm looking at the clEnqueueWaitForEvents() OpenCL API function.
As I see it, this is a real boon. You see, almost all clEnqueueXXX functions take an array-of-events, and the size of that array, to ...
0
votes
1
answer
35
views
What's the right way to determine which kind of cl_program I have?
The OpenCL API has one object which is sort of a "kitchen sink" for a lot of stuff: The program (with handle type cl_program). It can hold:
A textual program source ( ...
1
vote
1
answer
38
views
Why can't I create a kernel (CL_INVALID_PROGRAM_EXECUTABLE) after successfully compiling an OpenCL program?
In the following program, I compile a kernel for the first device on the first platform:
const char* kernel_source_code = R"(
__kernel void vectorAdd(
__global float * __restrict C,
...
0
votes
1
answer
85
views
OpenCL createProgramWithSource doesn't work with a c-string declared in either global or function scope
I'm trying to run a basic kernel in OpenCL. See the snipped attached
const char kernel_source[] = "__kernel void matmul(__global float* A, __global float* B, __global float* C) { int row = ...
0
votes
0
answers
42
views
SIGV on clGetPlatformIDs
There is an SIGV wile calling clGetPlatformIDs, which is sometimes a fatal SIGSEGV.
Minimum exemple I found producing it:
#include <stdio.h>
#include <stdlib.h>
#include "CL/cl.h"...
1
vote
0
answers
54
views
How can I optimize the SPH part (OpenCL) of my N-Body-Simulation
I implemented a N-body simulation that combines gravity and SPH (smoothed particle hydrodynamics). I want to optimize the SPH part. I use spacial hashing for the neighborhood search. On the host side (...
0
votes
1
answer
41
views
What happens when you set the same OpenCL callback more than once on the same object?
OpenCL has several API functions to set callback functions - for events, for buffers/memory objects, for contexts and maybe more.
What happens if you invoke one of these functions, more than once, on ...
1
vote
1
answer
69
views
Do I need to set a CL_MEM_READ_WRITE when creating a buffer?
When creating a buffer in OpenCL, one passes a flags bitfield. One of these possible flags is CL_MEM_READ_WRITE, being the lowest bit in the field (value 1 << 0). Its documentation says that &...