Changes

Jump to: navigation, search

GPUSquad

841 bytes added, 22:53, 25 February 2018
Idea 3 - MergeSort
It has been adjust to work only with int arrays and perform operation on worst case scenario for merge sort, which is something similar to this array - [0, 2, 4, 6, 1, 3, 5, 7].
=====================
<b>CODE</b>
=====================
To compile on matrix - <b>g++ -O2 -g -pg -oa1 a1.cpp</b>
</source>
==================
<b>Profiling</b>
==================Profiling with 1000000 elements <source>Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 69.23 0.09 0.09 999999 0.00 0.00 merge(int*, int*, int, int, int) 30.77 0.13 0.04 1 40.00 130.00 mSort(int*, int*, int, int) 0.00 0.13 0.00 1 0.00 0.00 _GLOBAL__sub_I_SIZE </source>  Profiling with 10000000 elements <source>Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 88.89 1.04 1.04 9999999 0.00 0.00 merge(int*, int*, int, int, int) 11.11 1.17 0.13 1 0.13 1.17 mSort(int*, int*, int, int) 0.00 1.17 0.00 1 0.00 0.00 _GLOBAL__sub_I_SIZE </source>  Profiling with 100000000 elements
<source>
</source>
==================
<b>Analysing</b>
==================
The most time consuming part is merging, which can be at least partially paralleled. The Big(O) of this case is O(n).

Navigation menu