OpenCL N-Body Simulation

Last Revision:
Version 3.5, 2015-04-15
(1) Utilities for acquiring host info., and computing the load on CPU cores. (2) Added CPU utilization performance meter. (3) Moved from std i/o stream file management to Core Foundation streams. (4) Property lists and data files are now read using the Core Foundation streams. (5) Utility for generating random numbers is using uniform random distribution. (6) N-Body button(s) moved to core and mediator objective-c utilities with properties. (7) N-Body meter(s) moved to core and mediator objective-c utilities with properties. (8) N-Body simulation data generation refactored and decoupled into split and packed utilities, matching split and packed data for cpu and gpu computes. (9) N-Body simulator properties are managed using a property list. (10) N-Body application preferences are managed using a property list. (11) N-Body engine moved to objective-c utility with properties. (12) View code is using the updated N-Body engine.
(Full Revision History)
Build Requirements:
Xcode 6.0 or later
Runtime Requirements:
Mac OS X v10.10 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.