bkloppenborg / liboi

OpenCL Interferometry Library
https://github.com/bkloppenborg/liboi/wiki
GNU Lesser General Public License v3.0
5 stars 6 forks source link

Data randomization for bootstrapping #19

Closed bkloppenborg closed 11 years ago

bkloppenborg commented 11 years ago

For bootstrapping data must be somehow randomized and placed into the GPU's memory.

At present this library reads OIFITS data from the file and then stores it in RAM. When

COILibData::CopyToOpenCLDevice 

is called the data in RAM are copied to the GPU, allocating memory as required. When ~COILibData() is called, all memory on the GPU and CPU are deallocated.

At present there is no method to bootstrap data without creating a new fake OIFITS data file and copying it to the GPU. It would be nice if each COILibData object could bootstrap itself and keep track of all allocated memory.

bkloppenborg commented 11 years ago

There appear to be a few possible options.

  1. Leave the data alone and simply mask out or re-weight the chi/chi2 values before computing the summed chi2. This results in no additional code being written: simply run all existing routines as-is and copy back the elements of the chi2 before summing. A CPU-based sum could then be used. This encounters a cost of 2 * n_uv.
  2. Leave the data alone and mask out values using a new kernel before doing the parallel sum. Copying the mask to the GPU will cost 1 * n_uv.
  3. Implement routines to randomize the data on the CPU and upload the resulting data. Then run the standard liboi routines on this new fake data set. If X data points are eliminated, we encounter costs of (n_uv - X) for uploading, (n_uv - X)^2 for sorting/eliminating duplicated UV points. But, we gain (n_uv - X) * (n_pixels)^2 from the FT (DFT) algorithm. If I did the analysis correctly, the speed up is basically linear with 1/2 of the data being eliminated resulting in a reduction of 1/2 in computation time for a constant-sized image.

The third option is clearly the best choice, but it will require significant modification to the underlying data storage containers. For now, we'll just suggest option 1 as the best solution.

bkloppenborg commented 11 years ago

CCOIFITS has methods for bootstrapping. This feature is no longer needed.