tinowagner.com // Blog

Dies und das.
  • Blog
  • Projekte
  • Impressum

Untermenü

  • Archiv
  • Kategorien

    • Allgemein
    • Bilder
    • Fundstücke
    • OS & Apps
      • Gimp
      • Linux
      • Mac
    • Physik
    • Programmieren
      • Web-Dev
    • Sprache
  • Neueste Beiträge

    • 750 frames of chaos
    • Magnetic pendulum, the OpenCL way.
    • Asus DH Remote: Crafting an OS X driver
    • Das Magnetpendel
    • Powerbook und Lower Memory Slot
  • Neueste Kommentare

    • Tino Wagner bei Möge es doppel-pendeln!
    • Anna bei Möge es doppel-pendeln!
    • Grandeau bei Das Magnetpendel
    • Tino Wagner bei Das Magnetpendel
    • Grandeau bei Das Magnetpendel
  • Blogroll

    • Nicole Schönfelder
  • Meta

    • Anmelden
    • Feed der Einträge
    • Kommentare-Feed
    • WordPress.org
« Asus DH Remote: Crafting an OS X driver
750 frames of chaos »

Magnetic pendulum, the OpenCL way. 2009-11-23

For the last couple of days I did some effort on porting my Python implementation of a magnetic pendulum (German post here, the slides include lots of pictures) to OpenCL. It's really cool to leverage GPU power for your own benefit.

If you'd like to see code rather than words, you should come around at my Git repository. Just to quote from the README file:

This is an implementation of a magnetic pendulum in OpenCL. A spherical pendulum is influenced by magnets. For every point of origin the program finds the magnet the pendulum's body will be nearest when it comes to rest (friction is taken into account). It will create an image, where every pixel (points in the \(\)-\(\)-plane) is mapped to a color representing each magnet.

The problem is ideally suited for parallel computing as every initial condition can be solved independently from the others. I did a Python version some time ago that utilized Scipy. Although it was quite optimized with C code, it performed very bad. To create a map of 1600x1600 pixels, it took about 2700 minutes! Leveraging the power hidden in GPUs, I wanted to know what speed-up would be reached.

The code works quite good so far. I began coding a CPU version in C that is a lot faster than the original Python version, but even my decent GPU outperforms that by a factor of ten. The map from above can now be done in 284 seconds. That is seconds, not minutes! 🙂

Tags: magnetic pendulum, Magnetpendel, OpenCL

Der Beitrag wurde am Montag, den 23. November 2009 um 19:48 Uhr veröffentlicht und wurde unter Allgemein, Physik, Programmieren abgelegt. Du kannst die Kommentare zu diesen Eintrag durch den RSS 2.0 Feed verfolgen. Du kannst einen Kommentar schreiben, oder einen Trackback auf deiner Seite einrichten.

Eine Reaktion zu “Magnetic pendulum, the OpenCL way.”

  1. tinowagner.com // Blog » Archiv » 750 frames of chaos
    Am 25. November 2009 um 01:44 Uhr

    [...] Magnetic pendulum, the OpenCL way. [...]

Einen Kommentar schreiben

du mußt angemeldet sein, um kommentieren zu können.


tinowagner.com // Blog is proudly powered by WordPress | WPD
Beiträge (RSS) und Kommentare (RSS)