A Terapixel Image for the DelphiWebScript Christmas!

Previous: Terapixel Image

Grid Computing

The new experiment is thus divided between a browser that allows to explore pre-computed levels:

http://mandelbrot.dwscript.net

and a “contribute your CPU power page”, compiled with SmartMobileStudio and that allows just about any device to contribute a small amount of computing time:

http://mandelbrot.dwscript.net/compute/

You can check the whole progress at

http://mandelbrot.dwscript.net/progress.dws

Finally there is also an API that allows 3rd party applications to request raw tiles from the cache, so they can apply their own palette, coloring or effects.

API to Access the Terapixel Mandelbrot

I’ve opened a simple API that allows 3rd-party to access the tiles as a JSON array of iteration depths.

To request a tile simply make an http request like

http://mandelbrot.dwscript.net/api.dws?level-xxx-yyy.js

The first number is the level, the second the x coordinate in the level, the third is the y coordinate.

For instance “4-2-3.js” will request a tile from level 4, at tile coordinates 2 and 3.

Valid coordinates for a a tile level go from 0 to 2^Level.

The response is a JSON array of the iteration depths on the smoothed Mandelbrot Set with the following convention:

  • if the array contains only one element, then the tile is a uniform one (all points in the tiles have the same iteration depth). You can use that to optimize rendering.
  • otherwise the array will contain 65536 elements, as a top-down raster of iteration depths

Ideally you’ll want to make sure you perform the HTTP requests with a client that supports HTTP compression, as some tiles can be quite large otherwise, and you’ll be limited by bandwidth.

The API is behind a CloudFlare cache, so performance should eventually scale up the more it is used 🙂

Access to the raw database is possible, but the logistics of bandwidth requirements means I’ll need some mirror. If you want to provide one, be aware you’ll have to serve files in the multi-gigabyte range.

Technical Details

Server-side is handled by DWScript Web Server, running under Windows 2012, it handles not just the server-side “grid” computing needs (provide and store work, statistics…) but also JPEG image generation for the browser.

Storage databases are SQLite. Initially there was a single monolithic database, but when breaking the gigabyte range, it was split into multiple databases to facilitate back ups.

Computing client is compiled with Smart Mobile Studio, and thus shares the computing code with the server-side. Using JavaScript means that every platform can contribute, and makes it very simple to deploy client code, even on the fly.

4 thoughts on “A Terapixel Image for the DelphiWebScript Christmas!

  1. It seemed like Level 13 was almost completed yesterday and then earlier today the finished percentage jumped back quite a bit. Was there a section that had to be re-processed?

  2. For Level 13, the “very low complexity” tiles were tagged to be processed server-side, but there was a bug which had the high complexity tiles be tagged as well…
    These were added back for processing, just about a couple millions of them, but they’re all high complexity tiles, hence the lower compute rate per tile (a future improvement would be to have statistics in terms of MegaFlops, which would be more immune to that), they’re also all larger in terms of bandwidth (a few hundreds of gigabytes of data), so the server I/O is also getting bottle-necked.

  3. Hi Eric,

    Opening the Grid Computing page http://mandelbrot.dwscript.net/compute/ I get an error, “Warning: Unreachable code [line: 9, column: 1] Syntax Error: T…” (The rest is cut off.) Although it looks like text, I can’t select and copy/paste it, it might be in an image. The text below that is “Starting…” but nothing happens.

    I’m using Chrome on OSX Mavericks, all updated.

    Cheers,

    David

Comments are closed.