Is OpenCL good for agent based simulation?
Asked Answered
P

2

10

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.

Polyvinyl answered 30/7, 2010 at 7:59 Comment(1)
I found that GPU can speed things up hugely but, as suggested, it's non-trivial to code them and it's nothing to do with actors. Think I will stick to actors in Scala and check out Akka. gpgpu.org/index.php?s=agent+based&searchbutton=SearchPolyvinyl
S
4

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
Stakeout answered 30/7, 2010 at 9:55 Comment(0)
S
2

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.

Schade answered 30/7, 2010 at 10:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.