opencl

Is OpenCL good for agent based simulation?

I'm learning Scala with the aim of writing agent based simulations using actor concurrency. I currently know very little about OpenCL, and before I dive in can anyone tell me if it is likely to be appropriate/compatible with agent based simulations? If so, then ScalaCL looks very attractive. ...

How to define functions in OpenCL?

How do i define functions in OpenCL? I tried to build one program for each function. And it didn't worked. float AddVectors(float a, float b) { return a + b; } kernel void VectorAdd( global read_only float* a, global read_only float* b, global write_only float* c ) { int index = get_global_id(0); //c[index] = a[...

Memory management in OpenCL

Heya, When I started programming in OpenCL I used the following approach for providing data to my kernels: cl_mem buff = clCreateBuffer(cl_ctx, CL_MEM_READ_WRITE, object_size, NULL, NULL); clEnqueueWriteBuffer(cl_queue, buff, CL_TRUE, 0, object_size, (void *) object, NULL, NULL, NULL); This obviously required me to partition my data ...

Does any OpenCL host have more than one platform?

The definition of a platform in Khronos' OpenCL 1.0 and 1.1 specifications: Platform: The host plus a collection of devices managed by the OpenCL framework that allow an application to share resources and execute kernels on devices in the platform. The OpenCL function clGetPlatformIDs creates an array of platforms, implying...

gpgpu programming in python

i want to start gpgpu programming in python. should i start with pyopencl or clyther? whats the difference? ...

Tesla double precision

I am looking for the information, how double precision is hardware implemented in the tesla gpu . I have read, that two stream processors are working on the single double value, but i didn't found any official paper from nvidia. Thanks in advance. PPS Why most GPU are computing with only single precision (because colors can be stored as...

Sparse array in CUDA or OpenCL

I have a large array (say 512K elements), GPU resident, where only a small fraction of elements (say 5K randomly distributed elements - set S) needs to be processed. The algorithm to find out which elements belong to S is very efficient, so I can easily create an array A of pointers or indexes to elements from set S. What is the most e...

OpenCL: basic questions about SIMT execution model

Some of the concepts and designs of the "SIMT" architecture are still unclear to me. From what I've seen and read, diverging code paths and if() altogether are a rather bad idea, because many threads might execute in lockstep. Now what does that exactly mean? What about something like: kernel void foo(..., int flag) { if (flag) ...

OpenCL, direct acces to host memory from gpu kernel

Hello, is there any way to allocate memory on host, that is accessible directly from gpu, without copying? like cudaHostGetDevicePointer in cuda. ...

OpenCL Events and Command Queues

I'm working on translating a CUDA application (this if you must know) to OpenCL. The original application uses the C-style CUDA API, with a single stream just to avoid the automatic busy-wait when reading the results. Now I notice that OpenCL command queues look a lot like CUDA streams. But in the device read command, and likewise in ...

Only run C preprocessor in cmake?

I'm trying to use cmake to simplify distributing my OpenCL program. I have a kernel file which includes several headers and other source files, and I want to have a single self contained executable. My plan is to have cmake run the C preprocessor on the kernel source, turning the cl file and its includes into a single unit which is easi...

How do I determine available device memory in OpenCL?

I would like to know how much free memory there is on my device before allocating buffers. Is this possible? I know there's CL_DEVICE_GLOBAL_MEM_SIZE for total memory, and CL_DEVICE_MAX_MEM_ALLOC_SIZE for max size of a single object, but I would like to know the current memory state. As it stands I'm probably going to have to use OpenGL...

Can OpenCL inline functions return OpenCL types?

I know OpenCL supports inline functions, but can those functions accept and return OpenCL types? Specifically, I am interested in something with this signature: float4 func(float4 x, float4 y) ...

Is Apple's OpenCL implementation using CLang and LLVM open-source?

It's clear that Apple has an OpenCL implementation based on Clang and LLVM. There's also a talk by an Apple Engineer about what it took to get OpenCL going on LLVM here However, is the code for this implementation available under some sort of open-source license or is this closed source software? If the code hasn't been released, anyo...

What is the point of GLSL when there is OpenCL?

Consider this the complete form of the question in the title: Since OpenCL may be the common standard for serious GPU programming in the future (among other devices programming), why not when programming for OpenGL - in a future-proof way - utilize all GPU operations on OpenCL? That way you get the advantages of GLSL, without its program...

Does GLSL utilize SLI? Does OpenCL? What is better, GLSL or OpenCL for multiple GPUs?

To what extend does OpenGL's GLSL utilize SLI setups? Is it utilized at all at the point of execution or only for end rendering? Similarly, I know that OpenCL is alien to SLI but assuming one has several GPUs, how does it compare to GLSL in multiprocessing? Since it might depend on the application, e.g. common transformation, or ray tr...

OpenCl cleanup causes segfault.

Hello! I constructed my own little Opencl example using different sources on the net. The actual kernel works, and I get the output I want, but the cleanup functions, I found in one of the examples, cause segfaults. What did I do wrong? #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <CL/cl.h> //opencl #define CL_CH...

How can I force Apple's OpenCL compiler to recompile a cached kernel?

I want to use #include statements in my OpenCL kernels but it appears Apple's OpenCL compiler caches kernels, so if you change the contents of an included file but not the file doing the including, the program will not change between runs. I've coded up an example which illustrates this: http://github.com/enjalot/adventures_in_opencl/tr...

Tutorial OpenCl event handling

Hi, In my last question, OpenCl cleanup causes segfault. , somebody hinted that missing event handling, i.e. not waiting for code to finish, could cause the seg faults. Since then I looked again into the tutorials I used, but they don't pay attention to events (Matrix Multiplication 1 (OpenCL) and NVIDIA_OpenCL_GettingStartedLinux.pdf) ...

Cummulative array summation using OpenCL

I'm calculating the Euclidean distance between n-dimensional points using OpenCL. I get two lists of n-dimensional points and I should return an array that contains just the distances from every point in the first table to every point in the second table. My approach is to do the regular doble loop (for every point in Table1{ for every ...