Exponential mapping and OpenMP
Robert Munafo pointed me at a cunning technique for transforming coordinates for optimizing zoom animation computations - it involves vastly less book-keeping than the ideas I've experimented with before and so makes it easier to do other clever things, like parallelizing with OpenMP:
... do { progress = 0; #pragma omp parallel for private(p) reduction(||:progress) schedule(static, 1) for (int x = 0; x < W; ++x) { p = iteratePoint(y * W + x, count); progress = progress || p; } } while (progress); ...
which leads to some impressive scaling benchmarks:
mode | time |
---|---|
plain (1 thread) | 10m02s |
OpenMP (1 thread) | 10m27s |
OpenMP (2 threads) | 5m22s |
Adding -fopenmp to the gcc flags is the only other thing needed to make it use another core and finish twice as quick, with attractive tall and thin results.