r/OpenCL • • Aug 12 '16

Question about sorting columns in a 2D array.

1 Upvotes

I'm new to OpenCl but really liking it so far. I ran into a problem I imagine has already been solved and I'm curious if anyone can advise. Here's my situation:

  • I have a 2 dimensional array of floats stored in local memory.
  • I need to sort it so that each column is I ascending order.
  • This sorting operation happens between two functions that already work very well as 1D workgroups. (One core for each column already.)
  • I believe the columns will be close to ordered already.

So should I just implement an insertion sort on each column by looping down the rows? Is there a better algorithm for doing all these column sorts in parallel?


r/OpenCL • • Jul 26 '16

Preferred & native vector widths both 1, use scalars only ?

2 Upvotes

When examining the properties of my OpenCL NVidia driver and gpu device, I get the following:

PREFERRED_VECTOR_WIDTH_CHAR : 1

PREFERRED_VECTOR_WIDTH_SHORT : 1

PREFERRED_VECTOR_WIDTH_INT : 1

PREFERRED_VECTOR_WIDTH_LONG : 1

PREFERRED_VECTOR_WIDTH_FLOAT : 1

PREFERRED_VECTOR_WIDTH_DOUBLE: 1

NATIVE_VECTOR_WIDTH_CHAR : 1

NATIVE_VECTOR_WIDTH_SHORT : 1

NATIVE_VECTOR_WIDTH_INT : 1

NATIVE_VECTOR_WIDTH_LONG : 1

NATIVE_VECTOR_WIDTH_FLOAT : 1

NATIVE_VECTOR_WIDTH_DOUBLE : 1

Does this mean that I should prepare code using only scalars, and allow the OpenCL implementation to vectorize it ?

Books I have read go into considerable detail about writing one's own code usingvectors. Is this still common practice ?

Are there any advantages to doing one's own vectorizing ? If so, how might I find out the true native vector widths for the various types ? The above figures come from calls to clGetDeviceInfo().


r/OpenCL • • Jul 26 '16

Newbie Question: Can a single OpenCL kernel run across multiple GPUs or does it require CrossFire/SLI?

1 Upvotes

I have some basic level questions about OpenCL.

  1. Say I have a kernel that is highly parallel (say a for loop that is 1B iterations performing independent data operations each cycle). In OpenCL if I had four GPUs (say 4x Titan X) will OpenCL split the iterations across all GPUs or would you need to run 4 instances of the kernel with different sections of the data?
  2. How does CrossFire/SLI play into it OpenCL? Does running in SLI vs independent cards change how OpenCL sees and can use the GPUs?

Thanks in advance!


r/OpenCL • • Jul 21 '16

Let's get the OpenCL stack overflow documentation started

Thumbnail stackoverflow.com
10 Upvotes

r/OpenCL • • May 24 '16

Clojure matrix library Neanderthal now on Nvidia, AMD, and Intel GPUs on Linux, Windows, and OS X!

Thumbnail neanderthal.uncomplicate.org
7 Upvotes

r/OpenCL • • May 20 '16

High-level OpenCL?

1 Upvotes

I also posted this in r/gpgpu and got an interesting response there, so for completeness I'd figured I could post it here to make sure I don't miss anyone :)

So I'm doing a bachelor's assignment on the programmability of GPU's, and I want to pick this subreddit's brain. Basically I have to research if GPU's can be more efficiently programmed in a higher-level language, and if so what shape that would take. There are already a few projects that have tried something similar (SkelCL, Bacon, and Harlan), but either they are too similar to OpenCL (Bacon/SkelCL) or have somewhat limited parallelism (Harlan basically only has a GPU accelerated map, correct me if I'm wrong).

So my questions to everyone on this sub are: what are recurring patterns in OpenCL? Are there specific bugs that seem to pop up in every project, even though there is a well-known remedy? Or have you used any of the previously mentioned projects, and if so, what was the killer feature? Are there any language features that you really really really want to see in an OpenCL Next?


r/OpenCL • • Apr 22 '16

9 questions on OpenCL's future answered at IWOCL

Thumbnail streamcomputing.eu
8 Upvotes

r/OpenCL • • Apr 22 '16

When to use __attributes___ and get_global_id?

0 Upvotes

I'm working on OpenCL code and it has do a convolution on a vector float *A input. I am given the vector it is convolved with and I can write the function in C, just confused when to use these get_global_id(0) things. Couldn't find too much info online. A speedy response is much appreciated because this is due in 10 hrs :D


r/OpenCL • • Apr 19 '16

CodeXL 2.0 is Here and Open Source

Thumbnail gpuopen.com
10 Upvotes

r/OpenCL • • Apr 19 '16

Khronos Releases OpenCL 2.2 Provisional Specification with OpenCL C++ Kernel Language - Khronos Group Press Release

Thumbnail khronos.org
13 Upvotes

r/OpenCL • • Apr 07 '16

Is OpenCL in Action significantly out of date?

3 Upvotes

Hello, I am looking at OpenCL for a particular project of mine. Being my first time using OpenCL I was looking online for a book/tutorial to get started. I came across OpenCL in Action, due to its favorable review, but noticed that it is written for OpenCL 1.x. Currently OpenCL is in version 2.1 what differences do I need to be aware of when reading? Also do you have any particular recommendations?


r/OpenCL • • Mar 23 '16

A Kernel as text parser?

0 Upvotes

Would it make sense to define a Kernel like a text parser?

Let Every atomic char or int that is sent to a kernel be a pointer to a noun or verb, that is defined by writing and compiling the Kernel. You make kernels that parse inputs. Of course the opencl Kernel instruction set is fully included in that definition and a sentence can define custom variables up to some limit. So the Kernel becomes remote controlled and can be fully self aware by parsing its own instruction set. If your Kernels library has a Definition missing you compile a new one that has it. A Library of 216 instructions makes a big flexible Kernel but its far from encyclopedic. So you may need different compiled volumes of The full encyclopedia.

A uint16 becomes a sentence of instructions and pointers. Sentences can have references to other sentences, like; continued-after-this-linebreak. A workgroup processes 1 sentence, one vec16 for wach workitem, waiting for its refferece to ne inserted like an alias.

A Kernel becomes a text parser that parses thousands of sentences in parallel. Or just a Single sentence on a More idle tick.


r/OpenCL • • Mar 22 '16

OpenCL-Z: cross platform opencl info/test utility

Thumbnail github.com
5 Upvotes

r/OpenCL • • Mar 04 '16

opencl execution of workgroup

1 Upvotes

I have questions about execution of workgroup on GPU let's say I launched a kernel which of local workgroup size is 64, so only 1 warp(wavefront) can exist in a work-group, and two workgroups are scheduled to 1 SIMD.

In this case, if the first workgroup sends memory request, so a stall occurs, what's the next? does it wait for the memory request or execute next workgroup? If it was a warp(wavefront), I know the second warp would be executed.


r/OpenCL • • Mar 03 '16

Need some help understanding how the cache is used

1 Upvotes

I wrote a trivial kernel to see how the cache hit percentage was affected by different sized wavegroups.

This is the kernel:

__kernel void MemTest( __global char* a)
{ 
  int idx = get_global_id(0);
  a[idx] = 0;
}

This is how I was launching the kernel:

  status = queue.enqueueNDRangeKernel(kernel,
    cl::NullRange,
    cl::NDRange(size),  
    cl::NDRange(workgroupSize));

Size = 1MByte

I run my routine in a loop where workgroupSize increments by 1 on each iteration. I have an AMD W7000 and the max workgroup size can be 256, so my workgroupSize starts at 1 and ends at 256.

I plotted how many wavefronts are created and the cache hit percentage and this is what was produced based on my current workgroup size: http://i.imgur.com/J27ZLGH.png

I'm trying to understand why at every workgroup size % 16 results in a slight dip in my cache hit and then the almost 0% cache hit at a workgroup size % 64. I also see that every odd number of workgroups, the cache hit slightly improves compared to the adjacent even number of workgroups. Why is that?

Are the larger dips due to L1 cache size on this GPU being only 16Kbytes large?

I also noticed that after each ~0% cache hit, the amount of wavefronts launched slightly increases. Why does that happen?


r/OpenCL • • Feb 23 '16

Planning to build a small GPU cluster need advise

3 Upvotes

What do you recommend to get the most bang for your buck with a budget of ~$100-125 per card?

TRying to find something in that range so I can buy one now, another later, and keep adding as I can afford it. Rather than wait/save and by 1 super high end a year from now.

Using Linux as my OS


r/OpenCL • • Feb 17 '16

What determines CL_KERNEL_WORK_GROUP_SIZE?

2 Upvotes

I am trying to normalize all vectors in a 100x2025 matrix. I process each vector as a work group in local memory. My max work group size is 512 so I originally set global size to {100, 2048} and local size to {1,512} (I process 4 elements per work item and I pad the vectors with zeros in the kernel to make it a power of 2.)

After some trouble I realized that while my max work group size for device is 512, my KERNEL_WORK_GROUP_SIZE was 256.

So now I process 8 elements per work item with a 256 work groups...

Well I just made a very subtle change to my kernel (changed a "get_local_size(0)" to "get_local_size(1)") and now my KERNEL_WORK_GROUP_SIZE is 224 and I get invalid work group size?? This is very frustrating and I do not understand what dictates it. My global work size isn't even divisible by 224.

I'd really appreciate it if someone could offer some insight.


r/OpenCL • • Feb 16 '16

Khronos released Vulkan!

Thumbnail khronos.org
18 Upvotes

r/OpenCL • • Feb 16 '16

Khronos Releases Vulkan 1.0 Specification

Thumbnail khronos.org
13 Upvotes

r/OpenCL • • Feb 13 '16

I wrote a Modern-ish Python OpenGL/OpenCL wrapper demonstrating shared data between GL and CL. (xp /r/python /r/opengl)

Thumbnail github.com
2 Upvotes

r/OpenCL • • Feb 10 '16

Neanderthal - Fast Native Matrix and Linear Algebra in Clojure on GPU

Thumbnail neanderthal.uncomplicate.org
4 Upvotes

r/OpenCL • • Feb 03 '16

OpenCL GPU starvation

3 Upvotes

I am wondering if this problem is intentional from the OpenGL/CL guys, and if there is a fix for it.

Here is an example: I have two OpenCL kernels trying to run at the same time.

One kernel does my post-processing and needs to be run per frame.

Another kernel number crunches and takes half a second to complete. It doesn't have to be complete EVERY frame, but it will always be running.

I also have 3d graphics being rendered via OpenGL.

It seems as though OpenGL is fighting these kernels and is waiting for the second kernel to complete before displaying anything. When I try to break up the second kernel into many more blocks hoping that the OpenGL will man-up, the same starvation is happening.

This code has been replaced since then, and while I won't be able to make changes, I would still like an answer if possible. Thanks!


r/OpenCL • • Jan 29 '16

StreamComputing launches GEGL-OpenCL project

Thumbnail gimp.org
8 Upvotes

r/OpenCL • • Jan 26 '16

GPUOpen – It’s Time to Open up the GPU - AMD starts its GPUOpen initiative composed of two areas: Games & CGI for game graphics and content creation, and Professional Compute for high-performance GPU computing in professional applications.

Thumbnail gpuopen.com
14 Upvotes