Mac OS X Reference Library Apple Developer
Search

OpenCL NBody Simulation Example

Last Revision:
Version 2.3, 2010-02-10
Fix problem reported by developer where application do run from xcode but not when clicking on it (on the bundle)
(Full Revision History)
Build Requirements:
Mac OS X v10.6 or later
Runtime Requirements:
Mac OS X v10.6 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.

Click on the corresponding buttons to select the active simulation and render devices, and/or press the following keyboard shortcuts:

1-6: Select an N-Body System Configuration

g: Select the next Graphics Device

s: Select the next Simulation Device

r: Enable/Disable Auto Rotation

d: Show/Hide Dock UI

h: Show/Hide HUD UI

u: Show/Hide Simulation Updates Meter

f: Show/Hide FPS Meter

space: Pause/Unpause Simulation

Note that the .cl compute kernel file(s) are loaded and compiled at runtime. The example source assumes that these files are in the same path as the built executable.




Last updated: 2010-02-10

Did this document help you? Yes It's good, but... Not helpful...