[SOLVED] Switch to OpenCL in your impl using Bullet quickly?

Post Reply
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

[SOLVED] Switch to OpenCL in your impl using Bullet quickly?

Post by benelot »

Hello,

I have an implementation of my rigid body 3D creature simulator running Bullet on the CPU. I ran the Bullet Demos on my system and they worked properly.
1. So what is an easy way to switch my implementations to OpenCL? Is there an easy demo where I can look at what has to be changed? In fact it should basically be just a switch of the Constraint Solver, right?

2. Can I expect a speed up on an SLI of two high-end GFX cards if a creature is built from simple collision primitives and Generic6DoFJoint Constraints? Do they not slow down parallel constraint solving?

3. Another issue I am not sure about is that I have another library that is running on the GPU using CUDA. Can I run OpenCL and CUDA both at the same time(switching contexts probably or one context per GFX card or whatever works) on the GFX cards?
Last edited by benelot on Tue Aug 18, 2015 1:39 pm, edited 1 time in total.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: How to switch your Bullet implementations to OpenCL quic

Post by benelot »

Or is it not ready yet to be really used?
johnsonalpha
Posts: 73
Joined: Fri May 01, 2015 8:23 pm

Re: How to switch your Bullet implementations to OpenCL quic

Post by johnsonalpha »

Its not ready to be used. Bullet3 OpenCL is experimental and sometimes isnt stable.
johnsonalpha
Posts: 73
Joined: Fri May 01, 2015 8:23 pm

Re: How to switch your Bullet implementations to OpenCL quic

Post by johnsonalpha »

You do realize OpenCL is an entirely different programming language then C++ and so is Cuda by the way your talking i can tell you don't have much experience in either one. And the concept of switching between Cuda and OpenCl is just silly.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: How to switch your Bullet implementations to OpenCL quic

Post by Erwin Coumans »

There is currently no easy way to use the OpenCL rigid body pipeline, you will need to be an expert GPU programmer to use it.

Besides that, many OpenCL drivers are generally not ready to be used, let alone the Bullet 3.x OpenCL kernels.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Modify my program that uses Bullet to run with the GPU solve

Post by benelot »

Thanks for your answers. I just realized that my question is very misleading and I am sorry if it looked like I was questioning the huge effort you all put into porting the Bullet Physics Pipeline to OpenCL. I know that C++ and CUDA or OpenCL are entirely different languages. I have a lot of experience with C++, but never wrote more than 20 lines of OpenCL code. I know that it is not a quick and easy thing to switch over from C++ to OpenCL or CUDA and vice versa already because of the SIMD architecture and the totally different paradigms of programming in either language.

My question was in fact more if it was easy to modify a program I wrote using Bullet Physics to run with OpenCL instead of on my CPU. From what I see, the bullet demos can already be run in OpenCL or on the CPU. Am I right there? So since this is already possible, I thought that maybe I just need to add a compile flag or change some of my code to use another solver and then it would run using the GPU solver.

But as Erwin Coumans mentioned, it is not yet easy to use the Pipeline, so probably I can not yet just switch over.

@Erwin Coumans: Thanks for writing such a beautiful Physics Library! I am really happy you chose the Open Source way and keep the library at a such high standard together with all the other developers that help you do that.
Post Reply