Julia on old desktop vs Matlab on old desktop vs Julia on Raspberry Pi-4

I have an early but complete and working (fairly well) version of a set of routines for analyzing ECG signals for the heart rate. It is mostly based on a popular technique called Pan/Tompkins (published in 1985 that operated on an 8-bit Z80 micropressor), but with some tweaks that I have been playing with (filters implemented using complex 64-bit math, a 256 channel filter bank, median filters, etc.). This is a work (actually hobby) in progress, but I have implemented my current versions in Matlab and Julia. The Julia version runs on both my (fairly old) desktop, and on a Raspberry Pi-4. Currently, I am mostly analyzing data from the MIT database at https://archive.physionet.org/physiobank/database/html/mitdbdir/mitdbdir.htm; these are sampled at 360S/s but I change all my data samples to be 250S/s so I don’t have to change algorithms for different data bases. For a non-optimized example of 30 minutes (451389 samples to be exact), I get:
Matlab: ~54s, Julia (desktop): 2.7s to 3.0s (using @time, Benchmark Tools says 2.6s), Julia (Pi-4): 10.5-12s. The algorithms have not been optimized (well just a little by having the inner loop operate on columns); the filters are mostly IIR which might favor Julia as FIR would be more matrix multiplication based (which I believe Matlab does in C). Still, the numbers are interesting. I would guess the Pi would do better if it used 32-bit floating point rather than 64-bit (I think 64 bit OS’s for the Pi are coming soon or are almost here). Even so, it is seen the Pi can easily handle a large number of ECG signals with very non-optimized algorithms in real time, with plenty of time left over (i.e. 150 times faster than necessary for a single signal). I think running Julia on a Pi-4 might have many interesting real world applications. I might also mention that BenchmarkTools can be added but don’t work on the Pi-4 so I used @time rather than @btime.

I might also add that I find Matlab easier for debugging which algorithms work and which don’t work and why (mostly because functions with breakpoints can be called at breakpoints), but that it is too slow to look at many different ECG signals in a short time; Julia is very good for this. Using each language where it is best might be a good approach.

2 Likes

They’re here:

Linux red.rpicluster 5.3.0-1022-raspi2 #24-Ubuntu SMP Fri Mar 27 21:32:13 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

Ubuntu has had RPi4 64-bit support for several months now.

Would you have link I could download an image from? Thanks.

I did a search and this might be just for the kernel, not the complete OS?

Incorrect, I was able to download and install ubuntu for ARM64 for the Pi4; very interesting.

I installed ubuntu 19.10 AMD64 and installed Julia 4.1. It works fine and BenchmarkTools now work as well. However, the MKL libraries do not install. The time for my analysis is almost unchanged from what it takes on 32-bit Raspbian (11-12 s for 30 minutes on one channel). I spent some time trying to install mkl-intel but so far have not been successful (can’t even down-load 2018 source due to provider throttling connection).