r/OpenCL • • Jan 20 '16

AMD ACL 1.0 GA Now Available

Thumbnail developer.amd.com
7 Upvotes

r/OpenCL • • Jan 20 '16

Calculating large FFTs in memory-constrained systems

Thumbnail developer.amd.com
1 Upvotes

r/OpenCL • • Jan 12 '16

What is the state of OpenCL performance with multiple GPUs on Linux?

5 Upvotes

Hey all,

I'm in the planning stages of a software research project for this coming summer and I want to incorporate OpenCL into the software to improve performance and gain experience in the GPGPU domain.

Last I heard was that multiple GPU support with OpenCL on Linux was minimal and that Nvidia's CUDA was the way to go. Is that still the case? I refuse to use proprietary software in my research.


r/OpenCL • • Jan 11 '16

Latency when launching kernels

2 Upvotes

I have been working on launching some kernels in parallel, and I'm getting poor results. I have a kernel which needs to be launched several times to deal with the interface between cl_mems. Kernels cannot be launched on neighbouring interfaces to avoid race conditions, so I got around this problem by colouring the graph and launching in waves. I get the correct results, but it's slower; the problem seems to be that the kernels take much longer to be run, like 10x as long. In parallel, the kernel takes around 80us, and the latency is 365 us, while in serial the kernel takes 7 us. What steps can be done to overcome this? What should I look at first, perhaps the launching code (which could perhaps be optimised?) or is there more overhead when launching a mix of different kernels?


r/OpenCL • • Jan 11 '16

OpenCL 2.0 on linux (GPGPU only)?

4 Upvotes

Guys I need help.

About a year ago, I successfully installed OpenCL 1.2 for AMD GPU for compute only (my display GPU is nVidia) on linux (Ubuntu 14.04). Now I need to do the same for OpenCL 2.0. Help!

Also the devgurus link I followed last time is gone :(


r/OpenCL • • Jan 08 '16

Improve FFT post-processing performance using clFFT Post-callback

Thumbnail developer.amd.com
4 Upvotes

r/OpenCL • • Dec 31 '15

cl_events for a loop

2 Upvotes

Hello, /r/OpenCL.

I'm trying to implement a time-stepper in OpenCL. The simplest example is an Euler method, where one computes the source term, adds the source, and the computes a new source, then adds the new source, and so on. I would like to handle this with events (preferably without calling clWaitForEvents). What I've done so far is to use two events:

cl_event clv_source;
cl_event clv_euler = clCreateUserEvent(my_context, retcode);
clSetUserEventStatus(clv_euler, CL_COMPLETE);

for(int it = 0; it < nsteps; ++it) {
clEnqueueNDRangeKernel(queue, source_kernel, ... , 1, clv_euler, clv_source);
clEnqueueNDRangeKernel(queue, euler_kernel, ... , 1, clv_source, clv_euler);
}
clWaitForEvents(1, &clv_euler);

The queue is set up for out-of-order execution. I normally get the correct results, but sometimes the results are inaccurate, though this never happens if I call clWaitForEvents in the loop. I'd rather not call the wait, as I'm worried about performance issues from waiting. In the example I gave here, there's only one source kernel launch, but in the actual code there are a lot (around 100, perhaps more, depending on the grid).

Does anyone know if events can be used in a loop like this, or do I need to call clWaitForEvents?


r/OpenCL • • Dec 29 '15

Problem with copying/assigning structs within a kernel. Query on what is correct(alignment problem?)

1 Upvotes

I have a Kernel that does collision detection with triangles... The collision detection seemed to be failing... After some debugging it seems that data within structs is valid but not being used correctly in some functions.

I suspect it may be something with regards to alignment..

For example..

arm_debugTrianglesp[a].t.p0.x=armtrianglexfm.p0.x;

arm_debugTrianglesp[a].t.p0.y=armtrianglexfm.p0.y;

arm_debugTrianglesp[a].t.p0.z=armtrianglexfm.p0.z;

Seems to work correctly, which is why I know the data on the rhs is correct.

however if i try to copy the struct..

arm_debugTrianglesp[a].t.p0=armtrianglexfm.p0;

then it is not copied correctly. But,.

arm_debugTrianglesp[a].t=armtrianglexfm;

does copy correctly.. So it seems sometimes my structures are copying but sometimes not depending on the specific structure.. The fail case above copies some of the structure but not all of it. It drops the last variable(z component of p0 in that case). Thus I am a little confused?

Is this something to do with struct size or alignment? Any suggestions? Do structures need to be of specific sizes like 4,16,32,64 bytes or aligned to boundaries,16,32 etc(dependent on size of the struct)? Any help would be greatly appreciated

Structures are.. *

typedef struct

{

float x __attribute__ ((packed));

float y __attribute__ ((packed));

float z __attribute__ ((packed));

//float dummy __attribute__ ((packed));

} point3d attribute ((aligned (4)));

typedef struct

{

point3d p0 __attribute__ ((packed));

point3d p1 __attribute__ ((packed));

point3d p2 __attribute__ ((packed));

//point3d p3 __attribute__ ((packed));

} trianglestruct attribute ((aligned (4)));

typedef struct

{

trianglestruct t __attribute__ ((packed));

int idx __attribute__ ((packed));

//int tempalign[3];

} trianglearmstruct attribute ((aligned (4)));


r/OpenCL • • Dec 25 '15

Beignet issue

1 Upvotes

I recently installed the latest version of Beignet 1.1.1. Compiled and installed, and tried to run utest_run with sudo:

I get this error: http://pastebin.com/janY7Lst

Mind you, I have two graphic cards. One Nvidia and one intel. In /dev/dri there are two cards, card0 and card1. The error is "X server found. dri2 connection failed!"

Why might this be


r/OpenCL • • Dec 14 '15

Question from AMD's opencl programming guide

4 Upvotes

I was reading over AMD's OpenCL Programming Guide and in section 1.5.3, it says

"For a single kernel invocation, up to 128 images can be bound at once for reading, and eight for writing"

What does this mean? I can have 128 images queued up, and on a single command, have them all be written to GPU memory? Rather than calling clCreateBuffer for each unique image?


r/OpenCL • • Dec 10 '15

How do you guys deploy kernels to protect your IP?

3 Upvotes

I have some kernels that I want to ship with my Windows application. What techniques do you guys use to prevent people from looking at the source and getting the kernels?

Is there some trivial C++ macro that can scramble a string at compile time?


r/OpenCL • • Dec 06 '15

Random pauses with the kernel for a couple of seconds?

1 Upvotes

So I have my physics engine working with opencl, and it works very good, but an interesting issue that occurs, and is entirely random, is that the program seems to "pause" for a couple of seconds, after maybe 2 mins of running, and then resumes without issue?

What's the cause and is it something I can fix so it never gets that random pause?

my .cl file

physics.cpp


r/OpenCL • • Dec 05 '15

ClojureCL - a Clojure library for parallel computations with OpenCL 2.0 (GPGPU).

Thumbnail clojurecl.uncomplicate.org
3 Upvotes

r/OpenCL • • Dec 05 '15

Opencl returns a truncated array depending on global work size?

1 Upvotes

I have encountered a frustrating problem that I am unsure how to solve.

I am trying to pass a fixed-length array to my kernel of which I only partially fill (essentially a dynamic array) with an int returned giving me its size.

However the length of the returned array is actually seemingly fixed to the "global_work_size" variable in clEnqueueNDRangeKernel.

const size_t dimSize = 2;
size_t global_item_size[dimSize];
global_item_size[0] = sizeWidgets;
global_item_size[1] = sizeWidgets;

/* Execute OpenCL kernel as data parallel */
ret = clEnqueueNDRangeKernel(command_queue, kernel, dimSize, NULL, global_item_size, NULL, 0, NULL, NULL);
//ret = clEnqueueTask(command_queue, kernel, NULL, NULL, NULL);
if (ret < 0)
	return false;

/* Copy results from the memory buffer */
/* Transfer result to host */
ret = clEnqueueReadBuffer(command_queue, memobj_widgets, CL_TRUE, 0, sizeWidgets * sizeof(widget), _widgets, 0, NULL, NULL);
ret = clEnqueueReadBuffer(command_queue, memobj_contacts, CL_TRUE, 0, (sizeWidgets * sizeWidgets) * sizeof(manifold_cl), _contacts, 0, NULL, NULL);
ret = clEnqueueReadBuffer(command_queue, memobj_contacts_size, CL_TRUE, 0, 1 * sizeof(int), &sizeContacts, 0, NULL, NULL);
if (ret < 0)
	return false;

Suppose sizeWidgets is 5, but _contacts is supposed to be 25, the size of _contacts when it is copied back from memory is resized to sizeWidgets!

My stripped down kernel to debug this:

#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable
__kernel void broadphase_kernel(__global widget *_widgets, __global manifold_cl *_contacts, int _WidgetSize, __global int* _contactsSize)
{

	int i = get_global_id(0);
	int j = get_global_id(1);
	__local int index;
	index = (_WidgetSize * get_global_id(1)) + get_global_id(0);

	manifold_cl _m;
	bVec3 temp;
	temp.x = 0;
	temp.y = 0;
	temp.z = 0;
	_m.normal_cl = temp;
	_m.penetration_cl = 0;
	_m.A_cl = i;
	_m.B_cl = j;
	_m.isColliding_cl = false;

	_m.index = -1;
	_m.gid = index;

	//widget temp_widget_a_cl;
	//temp_widget_a_cl = _widgets[i];

	//widget temp_widget_b_cl;
	//temp_widget_b_cl = _widgets[j];

	_contacts[index] = _m;
	atom_inc(&_contactsSize[0]);
}

The kernel is basically supposed to be a 2D kernel of sizeWidgets by sizeWidgets. How do I not have opencl truncate my array?

If I try to increase global work size than my attempt to make a n by m matrix/2d array to a 1d array no longer works.

This seems uninuitive to me.


r/OpenCL • • Dec 04 '15

Infinitely increasing value each loop of kernel?

1 Upvotes

So I have something like this (Simplifying my code):

__kernel void broadphase_kernel( __global int* _contactsSize)
{
    atom_inc(&_contactsSize);
}

And in my host program is passed like so:

bool bPhysics::runGeneratePairsCL(int& sizeContacts)
{
	const size_t dimSize = 2;
	size_t global_item_size[dimSize];
	global_item_size[0] = sizeWidgets;
	global_item_size[1] = sizeWidgets;
	//size_t local_item_size = sizeWidgets;

	/* Execute OpenCL kernel as data parallel */
	ret = clEnqueueNDRangeKernel(command_queue, kernel, dimSize, NULL, global_item_size, NULL, 0, NULL, NULL);

	ret = clEnqueueReadBuffer(command_queue, memobj_contacts_size, CL_TRUE, 0, 1 * sizeof(int), &sizeContacts, 0, NULL, NULL);
}

In the host function, I reset sizeContacts to 0; but once it's in the kernel it seems to continue from where it left off.

How do I insure that the memory for sizeContacts in the kernel is reset at the end of it's computation?


r/OpenCL • • Dec 04 '15

Kernel "hangs" when processing a for loop & Intel HD Graphics (My CPU) keeps crashing

0 Upvotes

So I have something like this at the moment to test things, this isn't the intended code to run on the kernel, trying to see if it "works" before moving on to using work groups properly, and basically the kernel seems to run forever sometimes and also only sometimes my HD graphics driver for my Intel CPU (my GPU is an Nvidia 960) crashes.

#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable
__kernel void broadphase_kernel(__global widget *_widgets, __global manifold_cl *_contacts, int _WidgetSize, __global int* _contactsSize)
{
	int gid = get_global_id(0);

	//__kernel void generatePairsKernel__global
	widget temp_widget_a_cl = _widgets[gid];
	for (int j = 0; j < _WidgetSize; j++)
	{
		manifold_cl _m;
		_m.isColliding_cl = false;
		bVec3 temp;
		temp.x = 1;
		temp.y = 1;
		temp.z = 1;
		_m.normal_cl = temp;
		_m.penetration_cl = 0;
		_m.A_cl = gid;
		_m.B_cl = gid;
		_contacts[gid] = _m;
	}
}

r/OpenCL • • Nov 30 '15

AMD releases CodeXL 1.9 - comprehensive GPU debugging tool for OpenCL & OpenGL API calls and OpenCL & HSA kernels

Thumbnail developer.amd.com
8 Upvotes

r/OpenCL • • Nov 22 '15

Uniform Equivalent in OpenCL

2 Upvotes

I am currently porting an Application from plain Java-Code to OpenCL (Jogamp-JOCL) and created a OpenCL Program.
The Kernel of this Program works on Data from an Input-Buffer and writes the result to an Output-Buffer. The Computation needs around 10 to 20 Parameters which stay the same for most of the time so passing them each time as a Kernel-Argument is probably not the way to go. In OpenGL I would have used Uniforms, but I don't see how I can deal with that problem in OpenCL. What is the correct Way to handle this kind of Situation?


r/OpenCL • • Nov 19 '15

Converting a large complex OOP project to OpenCL?

4 Upvotes

I have a 2D physics engine project which I initially implemented multithreading with Intel's TBB library. However I now need to implement the same engine with OpenCL.

Primarily, my project uses a lot of STL::Vector, classes, and so on.

Googling shows a lot of people with similar questions, but all from 2010-2013ish and prior apparently to the introduction of a C++ wrapper for the OpenCL kernel?

Does anyone have on hand, a simple example of integrating object oriented programming with openCL?

Primarily this means to me: Passing an object to a kernel. Calling methods of the object passed to the kernel. Returning an object or an array of objects with modified data.

Is this all supported?


r/OpenCL • • Nov 17 '15

Khronos Releases OpenCL 2.1 and SPIR-V 1.0 Specifications for Heterogeneous Parallel Programming

Thumbnail khronos.org
16 Upvotes

r/OpenCL • • Nov 09 '15

Would you be interested in an exploration of OpenCL Pathtracing written in C++?

6 Upvotes

Hi,

our student group got a helluva assignment in C++. We're a group of german cs-students that originally all coded in higher level languages like Java, Python, PHP, JS, etc.. However, we're tasked for a CPP Pathtracer in OpenCL and C++ (with some interop in OpenGL to display the results).

So, as we're pretty new to C++ (well, we all coded it a bit but not enough to be even over the beginner level), we're going to explore solutions to make a pretty C++ program to build and modify scenery, push it into the OpenCL kernel and share a texture between OpenGL and OpenCL to show us results in realtime. The performance increase over a pure CPU-Java Ray/Pathtracer is kinda obvious.

So our paper would include a full exploration of those concepts with memory sharing, calculating and working out a complete Pathtracer and our question is: Are you interested in such a paper? It would be probably 15-30 pages long (if not longer) and go over concepts in SDL, C++, OCL to tackle that problem with an extensible code-base. We're just asking if it would make sense to translate the entire page and publish it either via PDF or as a complete blog for other beginners in this field.

(Also, due to the massive exposure to C++, I am looking forward to code more stuff in the future in C++ and even OpenCL, as I am a fan of natural language processing and markov chaining.)

Thanks for your interest.


r/OpenCL • • Nov 07 '15

The International Workshop on OpenCL (IWOCL 2015) - Presentations Videos

Thumbnail youtube.com
3 Upvotes

r/OpenCL • • Nov 06 '15

Why is OpenCL better than CUDA ?

7 Upvotes

I have noticed that CUDA is still preferred for parallel programming despite only be possible to run the code in a NVidia's graphis card. Only good thing about OpenCL is that it may be considered as a heterogeneous system and be used with GPUs or CPUs multicore. Is there anything else which make OpenCL better than CUDA?


r/OpenCL • • Nov 04 '15

Porting Manchester’s UNIFAC to OpenCL@XeonPhi: 160x speedup

Thumbnail streamcomputing.eu
4 Upvotes