bkloppenborg / simtoi

The SImulation and Modeling Tool for Optical Interferometry
GNU General Public License v3.0
7 stars 6 forks source link

Photometric computations could be accelerated further #70

Closed bkloppenborg closed 10 years ago

bkloppenborg commented 10 years ago

At present the photometric task (CPhotometry) simulates photometric data one epoch at a time: It renders the image, calculates the sum (using liboi's parallel sum) of the image, then compares this to the original photometric data. Although this process is accelerated, it spends a lot of time waiting for the parallel sum kernel iterations to enqueue. This is photometric data simulated serially using a parallel sum.

I wonder if it might not be faster to render out all of the epochs of photometry to some buffer, then use a single thread per image to calculate the flux. This would be calculating the photometric data in parallel using a serial sum.

Lets quantify whether or not this could make a difference.

bkloppenborg commented 10 years ago

Initial throughput test using samples/epsAur_AAVSO_H.phot data set and epsAur_star_RingedDisk.json. The photometric simulation loop has the following form:

for data_point in list:
    set time
    render to off-screen buffer
    blit to storage buffer
    blit to screen
    copy image to OpenCL buffer (necessary for OpenCL parallel sum)
    compute parallel sum

Initial timing on the loop with everything enabled is as follows:

Completed 5 iterations in 46.867 seconds.
Throughput: 0.106685 iterations/second.

OpenCL operations only:

Completed 5 iterations in 1.14 seconds.
Throughput: 4.38596 iterations/second.

OpenCL + blit:

Completed 5 iterations in 2.554 seconds.
Throughput: 1.95771 iterations/second.

Set time only:

Completed 5 iterations in 0.209 seconds.
Throughput: 23.9234 iterations/second.

Render only:

Completed 5 iterations in 43.202 seconds.
Throughput: 0.115735 iterations/second.

Both blits only:

Completed 5 iterations in 1.745 seconds.
Throughput: 2.86533 iterations/second.

One blit:

Completed 5 iterations in 0.548 seconds.
Throughput: 9.12409 iterations/second.

Nothing (no render, blit, OpenCL):

Completed 5 iterations in 0.19 seconds.
Throughput: 26.3158 iterations/second.

Clearly improving the rendering operations, which take 16 times longer than anything else, should be prioritized prior to any other enhancements proposed.

bkloppenborg commented 10 years ago

Instead of implementing this method, I think it better to create a pool of workers which can evaluate the chi2r (or similar) of the data in parallel. Thus multiple photometric model could be rendering in parallel.