Shared Memory Parallel Ray Tracer using OpenMP and CUDA

November 18, 2009 at 8:14 pm (Computer Science, Graphics) (, , , , , , , , )


So since I’ve been doing my Masters in Computer Science at Dalhousie, I’ve been working on some neat projects. I’ll post them separately since they’re in separate research areas though.

For a parallel algorithms course, I’ve decided to play around with the ray tracer that Adam Stirtan and I created for an undergrad project. Right now I’m intending on using OpenMP to parallelize the ray tracing aspect of the program. If I have time left over then I’m hoping to use NVidia’s CUDA to get the GPU on my graphics card to work on the post processing shading effects. I’ve gotten some “hello world” style code compiled and running so my next step is to dig in a bit further with that and see what I can come up with.

Blind insertion of OpenMP to a ray tracer

Last night I made a simple stab at using OpenMP (Shared memory API for parallel programming) for using multiple threads for ray tracing. I wasn’t expecting much since I was just blindly adding some annotations to the project, but as you can see from the image it looks kinda neat. I’m assuming it chose to use 4 threads (since I didn’t specify a number).

Getting back to CUDA programming, trying to get a project set up isn’t really a fun thing. Thankfully somebody out there has made a project creation macro:

http://forums.nvidia.com/index.php?showtopic=65111

Using this, you can create a project that has the NVidia extra build step. This a crucial aspect of writing a CUDA program as you have to run it though an NVidia program so it can parse out the extension keywords. On that note, you have to rename anything using the C for CUDA extensions to a .cu file. Since this will then turn off your syntax highlighting I suggest you edit the text editor options so that the .cu extension will be opened in a C++ context. It’s really easy to do but if anybody is actually reading this and doesn’t know how, just post for help.

For some initial test code to make sure your program is compiling and running properly, I suggest you check out this page:

http://llpanorama.wordpress.com/2008/05/21/my-first-cuda-program/

That’s all for now.

Keep fit, and have fun

Advertisements

1 Comment

  1. Mark said,

    I think you may have found your true calling…a computer scienartist lol.

    I think it look pretty cool.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: