Saturday, December 10, 2011

Time step bug solved

I forgot to mention yesterday that I managed to figure out what was causing that bug.  I was sending a float* to the device, but the device was interpreting it as a just a float.  I'm surprised this wasn't a compile time error because the signatures of the command in my .cpp file and .cu file did not match.

Moving on.

Thursday, December 8, 2011

A GPU simulation at last!

Yesterday I finally managed to get around all the various compile and run-time errors, and actually get an AI simulation running on the GPU using steersuite!  This is just the simple AI, and so I have many more hard hours to go in order to get something really worth getting excited about, but after weeks of little to no measurable progress this is pretty huge. 

That said I still have an annoying bug that mystifies me.  The simulation runs fine if I hard-code a time-step on the device, but this isn't ideal because the time-step is not actually a constant.  If I try to send down the actual value of the time-step to the device, the simulation does not move, as if it's paused.  I eventually discovered that somewhere along the line the value I sent to the device was being decreased by many many orders of magnitude.  I would send a value of .049, and the device would receive a value of .49e-39.  I would like to resolve this issue before I move on to a more complicated steering algorithm, but I also don't want to spend too much time on it when I have so many other things to do.

Friday, December 2, 2011

Progress at last! Sort of...

So my code compiles, and even runs sort of.  The error I'm getting now if an error that steersuite actually catches itself, so I feel like I must be making progress.  Any day now I'll actually run a for real GPU simulation.

Wednesday, November 16, 2011

It Builds!

This image might not look like much to you, but after an entire weekend dedicated to resolving linker errors, that's pretty huge for me.  I can now include files in my .cu files.  Now the fun begins.

Friday, November 11, 2011


Above is the video I made for my checkpoint presentation this past Monday.  Noticeably absent from it is any mention of algorithms I plan to implement in the AI. 

The update method for the simpleAI will take the position of the agent and the goal and just compute the vector between them.  The agent will then be moved some distance along this vector depending on its speed and acceleration.

To begin the more complicated AI, I will probably start by implementing R* on the GPU.  R* is a suboptimal variant of A* that lends itself better to running in parallel.  After that I will probably try to implement a space-time prediction algorithm like the one described in the paper A Modular Framework for Adaptive Agent-Based Steering (Singh et al.)

My hope is to get simpleAI running on the GPU this weekend, and then I will post some video and metrics of the CPU vs the GPU simulations.

Saturday, November 5, 2011

Finally got steersuite (the framework I'm using) up and running.  Look at all those agents!  My plan now is to try and farm off agents to the GPU.  I may post a video soon, if I get something exciting to show.

Friday, November 4, 2011

It's about time I started posting here about my progress with this project.  First off, what is this project?  The idea is to create an agent based artificial intelligence on the GPU, which will hopefully be able to handle more agents more efficiently that a similar AI on the CPU.  Here are the steps.

Step 0:
- Farm each agent to a thread. This would be simply parallelizing the
for loop which executes update for each agent.
- There will be a result at the end of this which makes for a
good milestone.

Step 1:
- Naive decomposition of agents by taking positions into account (by recursively split the world into quadrants).

Step 2:
- kd-tree decomposition. this is more intelligent spatial decomposition.
- I was given a kd-tree implementation, so I will have to change it to suit my purpose.

Step 3 (independent of Steps 1,2)
- parallelizing the grid database (the database which stores
information of all agent positions)
- parallelizing the drawing loop (this is very similar to step 0 where I simply parallelize a for loop)

 That's it for now, although I will post some pictures later when I get Steersuite (the framework I'm using, which was provided to me by Mubbasir Kapadia) up and running.