Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 516
Pengin Avatar asked Jul 30 '10 07:07

Pengin


2 Answers

You should use OpenCL if you have some heavy weight computations that can be parallelized and you want to use your graphic card to do it (or parts of it).
It has a bit strange model of computation (at least if you know just "general" programming and not how the GPU works or if you have strong background in some areas of math), and quite some limitations what/how you can do.

So I think it's quite unlikely that's what you are looking for.

Actors have very little to do with OpenCL, I think the only commonality of the two that they both address the problem of parallel computation, but from a very different perspective. IMO the actor model is much easier to understand and probably also to use it (but it's just a guess as I didn't really have any business with OpenCL so far).

If you want to implement an agent based system then actors can be quite useful. You could have a look at standard scala actors, or alternative implementations:

  • Akka, also offering many additional functionality on top of actors + nice docs with some tutorials
  • actors in scalaz
like image 194
Sandor Murakozi Avatar answered Nov 20 '22 06:11

Sandor Murakozi


OpenCL is generally only good for speeding up programs that involve doing the same thing many times with different data. If your agents will all be doing the same thing at the same time, then yes it might be appropriate and compatible.

Otherwise, the two just don't fit well together, and OpenCL will probably make things run slower rather than faster.

like image 2
RD1 Avatar answered Nov 20 '22 06:11

RD1