I'm working on getting these projects up on Github, but for now I've hosted the projects in compressed. If you'd like to run these, please do the following: click on the image, unzip the file, open the .xcodeproj file with xcode and compile to run.
Apple announced a new API for programming GPUs called the Metal API. I wanted to experiment with it. I used it to program the GPU at a very low level to display polygons forming a cube. I then programmed a rotation transformation. To rotate the cube, use the arrow keys.
After using the Metal API to display a cube, I wanted to use it to solve a problem in parallel on the GPU rather than sequentially on the CPU. To that end, I created a program to calculate Pi using the Monte Carlo method. This program will calculate Pi on both the CPU and the GPU and can give you the ratio for how much faster the data-parallel computation is. With no optimization, the data-parallel computation usually ends up about 35x faster than the serial computation.