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:

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:

That’s all for now.

Keep fit, and have fun


Permalink 1 Comment

New Blog, Old Ideas

July 14, 2009 at 5:28 pm (Computer Science) (, , , )

So here’s my new blog/website/string of data on the internet. I’m not a fan of blogs so I probably won’t post much here, but every now and then I feel like ranting so we’ll see.

Anyway, last night I started experimenting with an open source library called OpenMP which is a great help for multithreaded programs. I decided to remake my convex hull and triangulation algorithms with a bit more quality so I figured that was something that could be enhanced by OpenMP. I only ran a few basic tests, but MAN! adding concurrency to this thing was a nice improvement on runtime. I may or may not decide to post some images, but here is some screenshots of my original results.

75,000 point cluster hull peel

75,000 point cluster hull peel

100 point trisection triangulation

100 point trisection triangulation

Permalink Leave a Comment