Algorithm in CUDA C that fits points in circles. For the calculation in GPU of the least squares solution, MAGMA library (http://icl.cs.utk.edu/magma/) is used.
Input:
- N = number of points
- X = the Npoints in the 2D coordinate system
- K = number of circles to fit
Output:
- Pi, i ∈ {1..K}: the assignment of points in X to the i-th circle (hence, sum(count(Pi)) = N)
- Ci, i ∈ {1..K}: the circles, represented as centre coordinates and radii
Algorithm Steps:
- Create the set C of initial circles (Ci, i ∈ {1..K})
- While not finished: a. For each point, assign it to the circle that is closest to it - this populates all Pi, i ∈ {1..K} b. For every Pi, fit a circle using least squares method - this creates a better set C
Stopping Criteria:
Stop if either of these conditions are met:
- No change is assignment of points to circles from the previous iteration
- Maximum number of iterations is reached
Instructions
The following enviroment variables must be set in order to compile:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/openblas/0.2.15/gcc/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/magma/1.7.0/openblas/gcc/lib:$LD_LIBRARY_PATH
make
./hpc