Open main menu

CDOT Wiki β

Changes

0xCAFEBABE

1,911 bytes added, 21:22, 14 October 2015
Added my profiling for A1.
- Martin Ristov
 
== Profile 2: Solving a Rubiks Cube ==
 
My choice of an application to profile is a Rubiks cube solver. While a Rubiks cube is typically thought of as a 3x3 cube, you can exponentially increase the number of squares. By doing so, solving a much larger Rubiks cube on a typical CPU becomes useless.
 
I came across a github repo for a (GPL v3) Rubiks cube solver at: https://github.com/brownan/Rubiks-Cube-Solver
 
I compiled Brown's code with profiling flags and got some interesting results.
 
Flat profile:
 
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
'''44.24 301.99 301.99 1768367109 0.00 0.00 cube_turn'''
'''41.94 588.30 286.31 1768367110 0.00 0.00 edge_hash2'''
13.51 680.53 92.24 1 92.24 682.02 edge_generate
0.10 681.24 0.71 132162051 0.00 0.00 stack_push
0.06 681.67 0.43 cube_120convert
0.05 682.03 0.36 edge_hash1
0.04 682.33 0.31 132162010 0.00 0.00 stack_peek_cube
0.03 682.52 0.19 132162010 0.00 0.00 stack_peek_distance
0.03 682.70 0.18 132162051 0.00 0.00 stack_pop
0.02 682.81 0.11 132162010 0.00 0.00 stack_peek_turn
0.00 682.82 0.02 _GLOBAL__sub_I_65535_0_cube_solved
0.00 682.82 0.00 1 0.00 0.00 edge_write
0.00 682.82 0.00 1 0.00 682.02 make_edge
 
cube_turn and edge_hash2 are the top two hotspots.
 
cube_turn - https://github.com/brownan/Rubiks-Cube-Solver/blob/master/cube.c#L181
 
edge_hash2 - https://github.com/brownan/Rubiks-Cube-Solver/blob/master/edgetable.c#L227
 
 
I feel like either two of these hotspots would be an excellent opportunity to parallelize.
 
~ Steven
=== Assignment 2 ===
=== Assignment 3 ===