Once you have implemented a testcase which is running and doing what you want, the computation might still take longer than you expected. A program to visualize profile data of your code's run is KCachegrind, which can be installed on a Ubuntu system by
sudo apt-get install kcachegrind
Profiling a whole computation
To profile the whole computation, start your testcase with
python -m lsprofcalltree your_testcase.py
and get a log file called your_testcase.py.log. Open this file with KCachegrind by
and analyze the graphs to get an idea of where the most time is spent in your computation.
Profiling a single method
To profile a single method of your testcase, you have to add some lines to your code. The following lines shall serve you as an example for profiling a method called profiled_method with the arguments arguments.
You would get a log file called your_testcase_profiled_method.log which you can analyze with KCachegrind. In experiments/hedge/maxwell/maxwell-cuda.py you can find an example for that.
Plotting the computation time data
If you want to plot the computation time data, have look at the part of this Wiki that explains plotting graphs with matplotlib.