Concurrent Implementation of k-NN for WLAN Positioning Eros Gulo Department of Earth and Space Science, York University December 1 st , 2015
FINAL CONCURRENT IMPLEMENTATION 1. Create a Thread Pool with a user-specified amount of distance calculation threads. 2. Allocate arrays to hold all computed distances and their respective indices. 3. Initialize a CyclicBarrier to pause the main thread until distance calculations are complete. 4. Split up the distance calculations among the threads in the thread pool, passing to them the indices of their respective reference fingerprints. Start the distance calculation threads. 5. Each thread calculates its respective distances then writes them to its allocated section of the distance array, then it calls await() on the CyclicBarrier. 6. Main thread calls await() after starting up the distance calculation threads, the CyclicBarrier allows it to proceed once all distance calculation threads have also called await(). 7. Main thread sorts the distances (while keeping track of their reference location indices) then returns the k reference location indices corresponding to the k -smallest distances.
TESTING ENVIRONMENT (COMPUTERS) MacBook Pro with a Dual-Core, 2.4 GHz, 64-bit CPU (Intel Core 2 Duo). Windows Desktop with a Quad-Core, 2.83 GHz, 64-bit CPU (Intel Core 2 Quad Q9550). Navy with an Octa-Core CPU (specifics unknown). Manycore Testing Lab node with 40 processors/cores.
TESTING ENVIRONMENT (JVM PARAMETERS) Heap size set to 512 MB corresponding to largest heap size allowed on Android. Server mode for best runtime performance. JVM set to 64-bit since tests were performed on 64-bit machines.
TESTING ENVIRONMENT (DATASETS) Reference database made up of 104 discrete locations, each represented by an averaged reference fingerprint. N5 testing dataset has approx. 3100 query fingerprints. N4 testing dataset has approx. 1300 query fingerprints. Z3 testing dataset has approx. 800 query fingerprints. Approx. 50 – 80 AP’s visible at each discrete location, at least 10 – 20 visible in every WLAN scan. Up to 3000 AP signal differences!
VARIABLES TESTED Mean Computation Time Per Position Estimate is the dependent variable that I measured. Number of Threads used for the computation is the main independent variable that I varied throughout the tests. The use of a Thread Pool was a secondary independent variable that I varied throughout the tests.
EXPERIMENTAL RESULTS ON MACBOOK Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints) on MacBook (Dual-Core CPU) Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 3 2.5 2 1.5 1 0.5 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON MACBOOK Mean Computa7on Time Per Posi7on Es7mate (Difference Fingerprints) on MacBook (Dual-Core CPU) Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 1800 1600 1400 1200 1000 800 600 400 200 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON WINDOWS DESKTOP Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints) on Windows Desktop (Quad-Core CPU) Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 2.5 2 1.5 1 0.5 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON WINDOWS DESKTOP Mean Computa7on Time Per Posi7on Es7mate (Difference Fingerprints) on Windows Desktop (Quad-Core CPU) Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 1400 1200 1000 800 600 400 200 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON NAVY Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints) on Navy (Octa-Core CPU) Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 2.5 2 1.5 1 0.5 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON NAVY Mean Computa7on Time Per Posi7on Es7mate (Difference Fingerprints) on Navy (Octa-Core CPU) Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 1400 1200 1000 800 600 400 200 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON MTL Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints) on Manycore Tes7ng Lab Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 2.5 2 1.5 1 0.5 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
EXPERIMENTAL RESULTS ON MTL Mean Computa7on Time Per Posi7on Es7mate (Difference Fingerprints) on Manycore Tes7ng Lab Z3 N4 N5 Mean Computa7on Time Per Posi7on Es7mate (ms) 1400 1200 1000 800 600 400 200 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
IMPACT OF RE-USING THREADS Mean Computa7on Time Per Posi7on Es7mate (Difference Fingerprints - N5 Dataset) on Manycore Tes7ng Lab Thread Pool Off Thread Pool On Mean Computa7on Time Per Posi7on Es7mate (ms) 350 300 250 200 150 100 50 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used
IMPACT OF RE-USING THREADS Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints - N5 Dataset) on Manycore Tes7ng Lab Thread Pool Off Thread Pool On Mean Computa7on Time Per Posi7on Es7mate (ms) 8 7 6 5 4 3 2 1 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used Thread Crea7on ~ 67µs per thread
IMPACT OF RE-USING THREADS Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints - N5 Dataset) on MacBook Thread Pool Off Thread Pool On Mean Computa7on Time Per Posi7on Es7mate (ms) 10 9 8 7 6 5 4 3 2 1 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used Thread Crea7on ~ 72µs per thread
IMPACT OF RE-USING THREADS Mean Computa7on Time Per Posi7on Es7mate (Absolute Fingerprints - N5 Dataset) on Navy Thread Pool Off Thread Pool On Mean Computa7on Time Per Posi7on Es7mate (ms) 14 12 10 8 6 4 2 0 0 8 16 24 32 40 48 56 64 72 80 88 96 104 Threads Used Thread Crea7on ~ 96µs per thread
IRRELEVANT PARAMETERS Sorting Algorithm – Computation time is so small it is immeasurable. k-value of k-NN – Effect is immeasurable, likely due to the small computational impact of the sorting. Effect may become measurable on larger reference datasets.
FUTURE WORK Finish writing Assignment 3. Implement what I learned in this course in my positioning application on Android.
END OF PRESENTATION Thank you for your attention. Feel free to ask any questions you may have.
Recommend
More recommend