Htm.core on RaspberryPi4 + 64 bit Ubuntu 18.04.4 LTS

Hello, everyone.

Thanks to @Paul_Lamb’s post, I was able to install NuPIC on my RaspberryPi4.

I want to use the HTM system in Python3. So, I installed htm.core on my RaspberryPi4.

forum2-1

This post is how to install htm.core on RaspberryPi4.

Preinstalled Image Download and Burn

To use the full 64Bit Ubuntu with RasberryPi4, this blog post is a good reference.

Download the unofficial 64Bit Ubuntu18.04 image from this link.

Burn the .img file using your favorite program. I use BalenaEtcher. I burned it to a 32GB SD card.

You can use almost all of the features in UbuntuDesktop.But you can’t connect to Ethanet Network, refer to this blog post and add the following file.


$ cd /etc/NetworkManager/conf.d

$ sudo touch 10-globally-managed-devices.conf

$ sudo service network-manager restart

Install htm.core

Clone and install the official repository. htm-community/htm.core

the environment variables for ARM64

Define the environment variables for ARM64.

forum2-2

Define the environment variable export ARCHFLAGS="-arch arm64" in .bashrcfile.


export ARCHFLAGS="-arch arm64"

And then reboot after the update.


$ sudo apt update

$ sudo reboot

Installing cmake with PyPI

If you don’t use cmake in python3, you will get an error.

sudo python3 -m pip install cmake>=3.10 installation error.

sudo apt install python3-cmake build error.

See the stackoverflow post to install scikit-build before installing cmake.


$ sudo pip3 install scikit-build

$ sudo pip3 install cmake

install time about 40min. :coffee:

Installing C++ compiler

Install clang as a C++ compiler. (g++ is already installed.)


$ sudo apt install clang

Python build

You will build htm.core using Python3. To reduce memory consumption of RaspberryPi4, build it over an ssh connection instead of a desktop environment.


$ cd ~

$ git clone https://github.com/htm-community/htm.core.git

$ cd htm.core

$ sudo python3 setup.py install

build & make & install time about 1H. :coffee:

Once you have htm.core installed, test it out. (Install numpy, etc., before testing.)


$ python3

>>> import htm

>>> import htm.bindings

>>> exit()

$ sudo pip3 install mock

$ sudo pip3 install hexy

$ sudo pip3 install numpy

$ sudo python3 setup.py test

Install matplotlib

Install matplotlib to run the examples.

sudo apt install python3-matplotlib installation error.


$ sudo apt install libfreetype6-dev pkg-config

$ sudo pip3 install matplotlib

ARM64 program execution speed

I compared the speed at which a desktop PC and Raspberrypi4 run hotgym.py.

  • Intel Core i5-8400 (Ubuntu18.04)

elapsed_time:4.5299530029296875e-05[sec]

  • Arm Cortex-A72 ARMv8 64bit (Ubuntu18.04)

elapsed_time:0.00037026405334472656[sec]

Thank you to everyone in the community.

Translated with www.DeepL.com/Translator (free version)

10 Likes

Hello, everyone.

I installed htm.core on my RaspberryPi4 + Raspberry Pi OS (64 bit) beta test version

I used the Hot Gym app to detect a CPU temperature anomaly.

pi-screenshot

the installation of cmake-python-distributions is done as follows.( scikit-build/cmake-python-distributions)

$ sudo pip3 install scikit-build
$ sudo apt install cmake
$ git clone https://github.com/scikit-build/cmake-python-distributions
$ cd cmake-python-distributions
$ sudo pip3 install -r requirements-dev.txt
$ sudo python3 setup.py bdist_wheel && ls dist

The advantage of the Raspberry Pi OS is the availability of GPIOs.

But there is one problem with using a 64-bit OS on a Raspberry Pi: :fire:CPU temperature is as high as 70 to 80 degrees.Fan is a must!

pi4

I would like to make a HTM system using Raspberry pi sensors.

Thanks to the community.

6 Likes

Ohta-San,
Thank you for your post and I’ve sucessfully installed NuPiC on my RPi4.

Are you able to run swarm on your Pi with Ubuntu 18.04?

Hello, @Vera

It seems that it is possible to implement a cluster environment using Docker swarm.

Sorry. I have not tried that implementation.

wait, I don’t know much about this lib, but how is the ARM chip crushing i5??

ARM is ~8 times slower. 0.37ms vs 0.045ms

It isn’t.

That said, there is a huge benefit in being able to run HTM on a small inexpensive device that is widely available and easy to use for DIY electronics projects. I predict that as HTM advances further in the SMI arena, we’ll see a lot of interesting HTM projects involving the Pi.

ahh, my bad