Message Boards Message Boards


Mathematica slow down on Raspberry Pi 3

Posted 6 years ago
13 Replies
2 Total Likes

Just benchmarked my RPI3 vs RPI2 Model B V1.1 with the built in Mathematica Benchmark[]. I was quite surprised to see the benchmark significantly decline. RPI3 had benchmark of 0.03 and time of 465 while the RPI2 had benchmark of 0.045 and time of 305 sec. On the RPI3, two tests dominated the time, matrix multiply and solving linear systems which took only slightly less than the entire benchmark on RPI2. Both systems were fully updated. I wonder if Wolfram could comment on this : do they feel it is the hardware or this might be improved in a future release?. As it is it is difficult to use Mathematica on an RPI and I was looking to RPI3 to improve this. Thanks

13 Replies
Posted 6 years ago

Update: I think the issue is related to Mathematica 10.3.1. I turns out the fastest benchmark on the RPI2 was collected with 10.0.2. I could not get my RPI3 to boot with older systems (NOOBS 1.4) so I built a brand new one (NOOBS 1.8). The new system works on older RPI's so I compared the same hardware and switched the SD cards out on the RPI2. Using 10.3.1 on an RPI2 I got a benchmark of 0.015 and time of 907, which is almost 2x slower than the same SD card in the RPI3. So RPI3 is faster than RPI2, but Mathematica 10.3.1 is slower than 10.0.1

FYI, I can replicate your results. On RPi v2 with 10.3 I get a score of 0.015 with a time of ~ 900s and the time is cut in half for the v3 with a score of 0.03. I'm pleasantly surprised that 2D graphics in a manipulate on a v3 are acceptably smooth and a 3D plot can be rotated with less lag than on a v2; however 3D graphics are still not ready for prime time on the RPi.

While I don't have a RPi3 handy, any change in linear algebra performance is likely explained by this portion of @Alex Newman 's post in another thread.

We also experimented with performance tuned BLAS libraries for the ARM CPU, but the Raspberry Pi distribution's use of ARMv6 [Raspberry Pi 1] software for their ARMv7 [Raspberry Pi 2] and ARMv8 [Raspberry Pi 3] devices makes that very difficult. Libraries like OpenBLAS don't do the same sort of runtime CPU detection that things like Intel MKL do and the hand-tuned assembly for ARMv6 will often just crash on ARMv7 (and have missing operations if you target ARMv7 and attempt to run it on ARMv6).

I would definitely be interested if anyone did create such libraries, though. Of course a tremendous amount of time and validation from vendors and the community would be required to get them up the quality where they'll be accurate enough in all scenarios we rely on them. For now, I'm having to use very basic CBLAS because it's the best way to deliver software that runs on all generations of the Raspberry Pi and is relatively accurate.

The general linear algebra performance has been improved considerably in the recent 11.3.0 Raspberry Pi release while still maintaining ARMv6 compatibility.

This will be reflected as a corresponding improvement in the Benchmark[] results.

I have no Pi 3 - but in my opinion you should install the temp-monitor to your taskbar and watch it while running Mathematica. On my slightly overclocked Pi2 some calculations bring it to temperatures around 70°C - and as the Pi 3 runs hotter, I could imagine that it possibly runs too hot and clocks down while calculating.

A good idea to check the temperature/cpu clock. Alas, the problem evidently can't be fixed with a couple of heat sinks and a fan.

I installed a power monitor on the USB power cord, the Raspberry Pi's temperature monitor and the CPU clock monitor on the taskbars of both computers.

I updated both the Raspberry Pi 2 and a Raspberry Pi 3 to Jessie (uname -r -> 4.1.13-v7+) and wolfram-engine ($Version -> 10.3.1 for Linux ARM (32-bit) (January 11, 2016).

The benchmark summary is as follows:

Model                Benchmark        Total Time        Voltage        Current    Temperature Range    CPU clock
Raspberry Pi 2       0.011                1248                >5. V          0.3-0.4 A      <49 deg C                 900MHz
Raspberry Pi 3        0.022                 842                >5. V           0.3-0.4 A      <50 deg C                    -

These data are less confusing to me in that the 3 is faster than the 2 running the same versions of the software (to the extent arranged by $sudo apt-get install). Evidently, there's no quick fix.

Finding whether the 3 is going to be usable for my projects will have to wait. Doing linear algebra on the GPU wold be a worthwhile step though.

Cheers, Fred Klingener

Hello, if you have both computers, can you possibly clock both Pi's, 2 and 3, with forceturbo (or without, but the same setting on both pcs) to the same speed of 1000 Mhz and a corefreq of 500, and give us some more benchmark-results (+temperature-differences)?

This would interest me, how they behave at the same clockspeed (and voltage? (for temperatures))...are there maybe some Mathematica-benchmarks to do a little comparison?

Many thanks already.

(the point is, when I am not completely wrong the Pi 2 only has a regular corefreq of 250 - but runs well with 500 and an armfreq of 1000 with an overvoltage of 2 here since I got it...presumably this makes a 'little' difference in a benchmark compared to a Pi 3)

Posted 6 years ago

Here are a couple of plots showing the performance as a function of frequency for Mathematica and also python3 (first 20000 digits).The procedure used the overclock menu in raspi-config. For G/L 7 Wheezy the options were 700, 800, 900, 950 and 1000. For G/L 8 Jessie the pi2 had two options 900 and 1000, and the pi3 had only 1 setting 1000. The Mathematica benchmarks significantly deteriorate for 10.3.1/Jessie. The Python benchmarks are all better for Jessie, excluding Linux as the problem.

Fig 1 Mathematica benchmarks

Fig 2 python benchmarks

Posted 6 years ago

There's a Raspberry Pi 3? I never saw anything on the tech review sites.

Posted 6 years ago

Hi and thanks for the feedback. The experiment is pretty simple: load a noobs os, set up raspian, log into terminal, start wolfram (not mathematica) Needs["Benchmarking`"] Benchmark[]. I am very convinced 10.3.1 has a problem and that 10.0.2 is the best wolfram-engine. I performed the same experiment on the model A. With 10.0.2 I see numbers for time ranging from 1100-1600. With 10.3.1 on the A I get 3400 sec for benchmark. On the model B the time is 306 seconds with 10.0.2, I then get 901 sec with 10.3.1. I get 500 sec on the 3 and I would expect a number around 170 with 10.0.2 if I could run it on the 3. I would hope wolfram would consider pulling 10.3.1 in favor of 10.0.2. Is there a way to back port 10.0.2 on to Jessie? I am happy to do more experiments, such as those suggested by M.S. but I don't think its the hardware.

Here's my enthusiastic vote for making 10.0.2 the default distribution until 10.0.3 is ready.

Face it. Mathematica is a tough sell on Raspberry Pi, and this isn't making it any easier.

Cheers, Fred Klingener

Posted 6 years ago

Thanks. Thats at least two votes now. Its clear that the RPI is really making progress with the hardware. I would hope that Mathematica would advance with it. The RPI 3 is great and let's put it to good use.

Issue solved with MMA Version 11.3.0 for Raspberry Pi running Raspbian Stretch June 2018 (2018-06-27):

Pi 3B+ V11.3 score is 0.13 and it took 107–110 seconds (test 9 & 15 both around 8 seconds each)

Pi 3B+ V11.2 score is 0.03 and it took 454 seconds (test 9 172 s & test 15 105 s)

Tests 4, 5, 8 are 3-times faster now and test 14 is slightly over 4 times faster. Other tests are about the same as before.

Wow. Great improvement on the same hardware. Especially, but not only, the very slow computations are now greatly accellerated. Great news indeed.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract