Raspberry Pi 4 and a preferred OS

Hi, I was asked by a colleague about the Raspberry Pi and PTB setup. I had previously played a bit, but gave up due to lots of fiddling required; It seems GPU drivers are now in place in recent kernels etc. Ubuntu 20.10 installs and runs great (using this to build a first computer for my son). Using neurodebian I just tried to install octave 5.2 + PTB, PsychLinuxConfig runs fine, but no mex files work (“cannot open shared object file: No such file or directory”). I tried also installing liboctave-dev but this did nothing. Is the problem Ubuntu, and sticking with the default RPi OS is required?

OK, I noticed Mario’s post in the windows tablet thread and applied his fix, and reinstalled octave and now everything is working pretty well (VBLSyncTest and PerceptualVBLSyncTest both work perfectly), though text drawing fails with this error:

Failed to load X11 font with name -*-calibri-regular-r-*--64-*-*-*.
Try a Screen('TextFont') name according to one of the listed available fonts above.

Error in function DrawText:     Usage error
Couldn't select the requested font with the requested font settings from X11 system!

I tried using fc-cache -r -v to rebuild the OS cache, to no avail.

And OpenGL blending is broken in e.g. ProceduralGarboriumDemo

Actually, this is just a side effect of the default configuration in the demos. For e.g. ProceduralGarboriumDemo uses this to set up the screen:

PsychImaging('AddTask', 'General', 'FloatingPoint32BitIfPossible');

The Raspberry Pi GPU doesn’t support 32bit and falls back to 16bit, but then disables blending. Passing in FloatingPoint16bit or 8bit explicitly and blending is enabled (although the blending mode looks wrong for that demo)…

That’s because PTB does not yet handle the RPi 4’s new VideoCore-6
gpu. The older VC-4 for RPi 0-3 doesn’t support floating point textures or framebuffers at all, only the new VC-6 does, but with some limitations in full 32 bpc float mode. I just added needed detection logic for the VC-6 on my master branch to detect and handle this, and now we get 32 bpc float without alpha-blending, or 16 bpc float framebuffers with alpha-blending and for 32 bpc float textures we get a fallback for texture filtering, based on our filter shader. See comments in following commit, but it looks pretty good what the new Pi can do in terms of precision and functionality:

-mario

Oh, that’s neat! Do you have a preferred method to run Octave on the RPi but with your latest PTB? It seems Neurodebian installs 3.0.15 of PTB and this becomes a system toolbox (sorry I’ve never used Octave so its all a bit new to me). I get lots of complaints of shadowing functions if I just dump a PTB folder in the path, but perhaps that’s the way?

This is what i add at the top of my ~/.octaverc:

warning('off', 'Octave:shadowed-function');
graphics_toolkit('gnuplot');
more off;

Suppresses shadowed function warning, chooses old gnuplot plotting backend if the OpenGL qt based one makes trouble on some embedded graphics drivers like on the RPi. more off; makes output paging behave like Matlab, although latest Octave already uses Matlab compatible settings.

The distros itself ship whatever NeuroDebian had as recent version at time of distro version initial release, e.g., at Debian-10 initial release in case of Raspbian. NeuroDebian does not ship more up to date PTB’s for ARM atm.

I only test on Raspbian atm., the surprisingy low number of installations and lack of payment by labs does not justify much effort - i consider it still a hobby project. These are the kind of projects that need to be funded via contract work, or by many labs buying our licenses, so this can be paid out of the common money pot. E.g., if i wouldn’t have considered the RPi 4 enablement work done so far as a “christmas day fun project” hobby - and even paid the RPi 400 out of my own pocket - this would have so far cost 2500 Euros in billable time.

-mario

OK thanks, my RPi will go to its intended purpose soon (first computer for my Son), so I’ve also just about run out of play time.

Neurodebian did install on the 64bit Ubuntu 20.10, and had 5.2 octave & 3.0.16 of PTB which worked OK. Fully loaded it uses about 1GB of the 4GB of RAM, more than Raspian for sure but the performance was smooth in use. I assumed that having a newer kernel and MESA etc. should help PTB. But as Ubuntu is a 64bit cuild it doesn’t work at all with a standard PTB download, only the Neurodebian builds. I also didn’t find a way to get Octave 6.1 to install (I tried flatpak and other distribution-agnostic systems to no avail, and didn’t have time to attempt compiling it myself).

For anyone who is looking for a tiny and flexible system to run experiments, I would think that with a small further push and a bit of support to Mario, RPi is close to being an ideal solution. We currently use Android tablets for automated training (using Mymou for experiment control), but I do think there are advantages in terms of programming flexibility in being able to run RPi with an largely functional PTB.