evenmore-pi.tex /size: 8091 b    last modification: 2021-10-28 13:50
1% language=us runpath=texruns:manuals/evenmore
2
3\environment evenmore-style
4
5% This appeared in TB 126, thanks to Karl Berry for fixing the English.
6
7\startcomponent evenmore-pi
8
9\startchapter[title=\TEX\ and Pi]
10
11This is a short status report \footnote {This chapter appeared in \TUGBOAT\ 40:3.
12Thanks to Karl Berry for corrections.} on Pi, not the famous version number of
13\TEX\ (among other things), but the small machine, meant for education but
14nowadays also used for Internet Of Things projects, process control and toy
15projects. While the majority of \TEX\ installations run on an Intel processor,
16the Raspberry Pi has an \ARM\ central processing unit. In fact, its main chip has
17the same foundation as those found in settop boxes all around the world. It's
18made for entertainment, not for number crunching.
19
20At the \CONTEXT\ meetings, it has become tradition to play with electronic
21gadgets. Every year we are curious what Harald K\"onig might bring this time. The
22last couple of meetings we also had talks about using \TEX\ and \METAPOST\ for
23designing (home|-|scale, automated) railroad systems, using \LUATEX\ for running
24domotica applications, using \METAPOST\ for rendering high quality graphics from
25data from appliances, presenting \TEX\ at computer and electronics bootcamps, and
26more. This year Frans Goddijn also brought back memories of low speed modem
27sounds, from the early days of \TEX\ support. It is these things that make the
28meetings fun.
29
30This year the meeting was in Belgium, close to the border of the Netherlands, and
31on the way there Mojca Miklavec traveled via my home, where the contextgarden
32compile farm runs on a server with plenty of cores, lots of memory and big disks.
33But the farm also has an old Mac connected as well as a tiny underpowered
34Raspberry Pi 2 for \ARM\ binaries that we had to fix: the small micro \SSD\ card
35in it had finally given up. This is no surprise if you realize that it does a
36daily compilation of the whole \TEX\ Live setup and also compiles \LUATEX,
37\LUAMETATEX\ and pplib when changes occur. Replacing the card worked out but
38nevertheless we decided to take the small machine with us to the meeting. We also
39took an external (2.5 inch) \SSD\ box with us. The idea was to order a Raspberry
40Pi~4 on location, the much praised successor of the older models, the one with
414~\GB\ of memory, real \USB~3 ports and proper Ethernet.
42
43At the meeting Harald showed us that he had version~1, 3 and~4 machines with him
44because he was looking into an energy control setup based on Zigbee devices. So
45we had the full range of Pi's there to play with.
46
47This is a long introduction but the message is that we are dealing with a small
48but popular device with up to now four generations, using an architecture
49supported in \TEX\ distributions. So how does that relate to \CONTEXT ? One of
50the reasons for \LUAMETATEX\ going lean and mean is that computers are no longer
51getting much faster and \quote {multiple small} energy|-|wise has more appeal
52than \quote {one large}. So then the question is: how can we make \TEX\ run fast
53on small instead of gambling on big becoming even bigger (which does not seem to
54be happening anyway).
55
56At the meeting Harald gave a talk \quotation {Which Raspberry Pi is the best for
57\CONTEXT ?} and I will use his data to give an overview: see Table~\ref{rpispec}.
58
59\starttabulate[||c|c|c|c|]
60\BC model     \BC 1         \BC 2         \BC 3         \BC 4          \NC \NR
61\BC chipset   \NC BCM2835   \NC BCM2835   \NC BCM2835   \NC BCM2835    \NC \NR
62\BC CPU core  \NC v6l rev 7 \NC v7l rev 5 \NC v7l rev 4 \NC v7l rev 3  \NC \NR
63\BC cores     \NC 1         \NC 4         \NC 4         \NC 4          \NC \NR
64\BC free mem  \NC 443080    \NC 948308    \NC 948304    \NC 3999784    \NC \NR
65\BC idlemips  \NC 997.08    \NC 38.40     \NC 38.40     \NC 108.00     \NC \NR
66\BC bogomips  \NC 997.08    \NC 57.60     \NC 76.80     \NC 270.00     \NC \NR
67\BC read SD   \NC 23.0 MB/s \NC 23.2 MB/s \NC 23.2 MB/s \NC  45.1 MB/s \NC \NR
68\BC read USB  \NC           \NC 30.0 MB/s \NC 30.0 MB/s \NC 320.0 MB/s \NC \NR
69\stoptabulate
70
71After some discussion at the presentation we decided to discard the (absurd)
72bogomips value for the tiny Pi~1 computing board and not take the values for the
73others too seriously. But it will be clear that, especially when we consider the
74external drive that things have improved. The table doesn't mention Ethernet
75speed but because the~4 now has real support for it (instead of sharing the \USB\
76bus) we get close to 1~\GB/s there.
77
78The real performance test is of course processing a \TEX\ document and what
79better to test than the \TEX\ book. The processing time in seconds, after initial
80caching of files and fonts is:
81
82\starttabulate[||c|c|c|c|]
83\BC model                   \BC 1      \BC 2      \BC 3      \BC 4      \NC \NR
84\BC \TEX book               \NC 13.649 \NC  7.023 \NC  4.553 \NC  1.694 \NC \NR
85\BC {\tt context --make}    \NC        \NC 19.949 \NC 11.796 \NC  6.034 \NC \NR
86\BC {\tt context --make} TL \NC 89.454 \NC 46.578 \NC 29.256 \NC 14.146 \NC \NR
87\stoptabulate
88
89The test of making the \CONTEXT\ format using \LUATEX\ gives an indication of how
90well the \IO\ performs: it loads the file database, some 460 \LUA\ modules and
91355 \TEX\ source files. On my laptop with Intel i7-3840QM with 16GB memory and
92decent \SSD\ it takes 3.5 seconds (and 1 second less for \LUAMETATEX\ because
93there we don't compress the format file). Somehow a regular \TEXLIVE\
94installation performs much worse than the one from the contextgarden.
95
96We didn't test real \CONTEXT\ documents at the meeting but when I came home the
97Pi~4 was bound again to the compile farm. Harald and Mojca had prepared the
98machine to boot from the internal micro \SSD\ and use the external disk for the
99rest. So, when we could compile \LUAMETATEX\ again, I made an \ARM\ installer for
100\LMTX, and after that could not resist doing a simple test. First of course came
101generating the format. It took 6.3 seconds to make one, which is a bit more than
102Harald measured. I see a hiccup at the end so I guess that it has to do with the
103(external) disk or maybe there is some throttling going on because the machine
104sits on top of a (warm) server.
105
106More interesting was testing a real document: the upcoming \LUAMETATEX\ manual.
107It has 226 pages, uses 21 font files, processes 225 \METAPOST\ graphics, and in
108order to get it \LUAMETATEX\ does more than 50\% of the work in \LUA, including
109all font and backend|-|related operations. On my laptop it needs 9.5~seconds and
110on the Pi~4 it uses 33~seconds. Of course, if I take a more modern machine than
111this 8|-|year|-|old workhorse, I probably need half the time, but still the
112performance of the Raspberry Pi~4 is quite impressive. It uses hardly any energy
113and can probably compete rather well with a virtual machine on a heavily loaded
114machine. It means that when we ever have to upgrade the server, I can consider
115replacement by an Ethernet switch, with power over Ethernet, connected to a bunch
116of small Raspberries, also because normally one would connect to some shared
117storage medium.
118
119Because I was curious how the dedicated small Fitlet that I use for controlling
120my lights and heating performs I also processed the manual there. After making
121the format, which takes 6~seconds, processing the manual took a little less than
12230~seconds. In that respect it performs the same as a Raspberry Pi~4. But, inside
123that small (way more expensive) computer is an dual core AMD A10 Micro-6700T APU
124(with AMD Radeon R6 Graphics), running a recent 64|-|bit Ubuntu. It does some
1252400 bogomips (compare that to the values of the Pi). I was a bit surprised that
126it didn't outperform the Raspberry because the (fast \SSD) disk is connected to
127the main board and it has more memory and horsepower. It might be that in the end
128an \ARM\ processor is simply better suited for the kind of byte juggling that
129\TEX\ does, where special \CPU\ features and multiple cores don't contribute
130much. It definitely demonstrates that we cannot neglect this platform.
131
132\stopchapter
133
134\stopcomponent
135