Author Topic: Multi-core support?  (Read 6058 times)

Offline Beanspoon

  • Bot Neophyte
  • *
  • Posts: 26
    • View Profile
Multi-core support?
« on: March 28, 2012, 10:35:45 AM »
Hey guys,
I'm hoping DB3 is still in the works!  I would offer to help out, but currently university degree must take precedence.  Also I hear that it is currently a little difficult for people to just jump in at present.

My question was just regarding whether DB3 would feature multi-core processor support.  While my i7 runs sims a lot faster than any of the single-core PCs I've been using, I notice that DB2 is still only utilising one core's worth (16%) of the available processing power.

I know that coding for multi-core processors is a lot more difficult, as jobs have to be divided between available cores, but each bot script can be thought of as a job in itself, and I would have thought that if you were able to specify somewhere in the settings the number of cores you would like to utilise, it shouldn't be too difficult to get to program to divide running of the scripts evenly across the processors.

Seeing as future technology seems to be moving towards more and more cores, this seems like a sensible avenue to explore.

If you're feeling really adventurous, DB doesn't really need a lot of graphics processing, so you could look into GPU support too.  That would really give sims a turbo boost!

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Multi-core support?
« Reply #1 on: March 28, 2012, 02:57:09 PM »
Numsgil is probably busy, i'll reply:

This is exactly what Numsgil is doing!

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Multi-core support?
« Reply #2 on: March 28, 2012, 04:22:40 PM »
I actually have a lot of experience with multicore programming.  The eventual plan is actually to have DB3 utilize GPGPUs using OpenCL.  The main computation cost is DNA execution, physics constraint solving, and bot vision.  And the latter two are really well suited to GPGPU style coding.  Which means DB3 will not only be using multiple cores but using the graphics card for computation, too.  Or even something like the Intel MIC when it's out.  For DNA execution, I think it should be possible to have it compile in to CIL, which means it could be JITed and run as fast as native code.  And then I could of course split up the DNA execution on to a bunch of different worker threads.

All that said, the initial version will be largely single threaded just because it doesn't make sense to put the time investment in to performance until you have a program actually running :)  I'll use a few different threads for things like keeping the UI response, though, so it'll still run faster on dual cores than single cores.

The super far off eventual goal is that I'll buy a bunch of GPGPU servers and run a server farm for Darwinbots for internet mode.  Either that or a connected zerobot sim.  And people could connect remotely and watch the sim going on from their computers.  It should be possible to get a few 1 TFLOP computers by the time I'd want them, which would let Darwinbots run at real time (60-100 FPS) or faster with 1000+ bots.  Which would be pretty cool.
« Last Edit: March 28, 2012, 04:25:42 PM by Numsgil »

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
Re: Multi-core support?
« Reply #3 on: March 29, 2012, 03:51:28 AM »
For DNA execution, I think it should be possible to have it compile in to CIL, which means it could be JITed and run as fast as native code

I've looked into doing this a fair amount. Entirely doable, and I will probably hammer it out some weekend that I'm not wiped out from the school week (this weekend maybe? we'll see).

Offline Beanspoon

  • Bot Neophyte
  • *
  • Posts: 26
    • View Profile
Re: Multi-core support?
« Reply #4 on: April 10, 2012, 05:56:32 PM »
Brilliant.  Hopefully by then I'll have the money to create a dedicated PC for DB.  Looking forward to it guys!

Offline rwill128

  • Bot Builder
  • **
  • Posts: 67
    • View Profile
Re: Multi-core support?
« Reply #5 on: September 07, 2012, 02:21:43 PM »
I was *just* thinking about the possibility of optimizing some of this stuff for the GPU. So glad to read this thread. Also excited about the possibility of that huge server.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Multi-core support?
« Reply #6 on: November 11, 2012, 12:34:46 PM »
I have just discovered the "Parallel Class" that is shipped with version 4.0
Numsgil, are you aware of this? If so, can you give me a general idea of how useful it is and if you are implementing it with DB3?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Multi-core support?
« Reply #7 on: November 12, 2012, 02:56:30 AM »
From my experiments the overhead from it seems really high.  I'll probably use a lower level system and manually set up worker threads and run it that way.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Multi-core support?
« Reply #8 on: November 12, 2012, 03:22:07 PM »
hmm, that's gtk

cjmaxik

  • Guest
Re: Multi-core support?
« Reply #9 on: January 04, 2013, 09:35:41 AM »
we need a GPU support  :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Multi-core support?
« Reply #10 on: January 04, 2013, 08:15:35 PM »
If you mean like using the GPU for calculations, that's one of the potential goals, yeah.

If you mean using the GPU to make the graphics look nicer/faster, that's also one of the goals :P