OpenCL N-Body Simulation

Last Revision:
Version 3.1, 2014-02-20
(1) Decoupled the CoreText generation from GL text methods. (2) Moved GL text methods into a class. (3) The GL query class uses regular-expresion evaluation. (4) The n-body rendering is now moved into a visualizer class. (4) The n-body meters are now in a mediator class. (5) Removed the dependency on globals in the n-body engine, and encapsulated the engines's functionality into a class. (6) The dock labels are now derived from system properties. (6) Decoupled the host and device memories for CPU compute, and refactored into a mediator class as well as classes for managing split and packed data. (7) The initial random host data generation for CPU and GPU bound computes is encapsulated in a functor. (8) Gaussian and 2D textures are now encapsulated into their own classes. (9) Encapsulated program object generation into a class.
(Full Revision History)
Build Requirements:
Xcode 5.0.2 or later
Runtime Requirements:
Mac OS X v10.9 or later

This example performs an NBody simulation which calculates a gravity field and corresponding velocity and acceleration contributions accumulated by each body in the system from every other body. This example also shows how to mitigate computation between all available devices including CPU and GPU devices, as well as a hybrid combination of both, using separate threads for each simulator.