Our Pi2 arrived from Element 14 on Saturday and we wasted no time getting it fired up. The first thing we did was to download the latest Raspian image. Then we verified that our products were still compatible (as it turns out there is currently a problem with the Python GPIO wrapper but this will be fixed very soon).  Then we thought we might do some power measurements so we wrote a little Python program that would exercise the CPU while we measured current. The program calculates the first 50 Fibonacci values 1000 times. It then prints out the average time required to calculate those 50 values. The code looks like:

We put this program on a B+ and our new RPI2. Then using Putty, we opened an SSH shell into each of these RPIs and launched the program from the command line with python fibonacci.py.  After that, we started watching the numbers scroll up the screen. Initially, the RPI2 looked to be about 1.57X faster than the B+ and so we decided to open more SSH shells. Soon we had 4 SSH shells running on the B+ and four on the RPI2. The first thing we noticed was that the B+ slowed with each new shell and that the RPI2 seemed to be unaffected. Here's a screen grab with all the B+ sessions:

Bplusfibbo

If we average and round the last row of numbers we see that it takes each thread on the B+ about 0.00842 seconds to calculate the first 50 Fibonacci values. Next let's look at the RPI2 sessions:

RPI2fibbo

If we average and round the last 4 rows of this data with see that it takes 0.00138 seconds for each thread of the RPI2 to calculate the first 50 Fibonacci numbers. So, for this particular experiment, we can calculate the speed improvement as: 842/138=6.1 and that, as we say in the world of Engineering, doesn't suck. We became so engrossed by this that we ran out of time for our power measurements.

Series Navigation<< Python Cheat SheetsPower and the Single Pi >>
4 Comments
  1. I have a Raspberry Pi 2 and i want to buy a Pi-plates daqc board. You say that there are problems with the python GPIO wrapper.
    Do you know or this is fixed now? Can i use the piplate daqc board without problems on the raspberry pi 2?

    • Yes, the problems with GPIO and the revision 2 of the Raspberry Pi have been addressed. We have been using it without any issues for a few weeks now.

    • If you want to save some money on shipping, I recommend you purchase a Pi-Plates kit from our European distributor:
      The Raspberry Store: http://www.raspberrystore.nl/PrestaShop/index.php

Comments are closed.