Sometimes there is a desire to distract from the vanity of the world and do something interesting. In my case, it was
Vindinium — an AI competition in which four knights fight for fame, wealth, and food.
And prepare yourself a task - to get to the leaderboard. However, the task will be solved even more interestingly if we set a hard limit - artificial intelligence will not draw resources from our undoubtedly powerful computer, but from the single-board system on the ARM architecture! At the same time, we will not only gain experience with portable devices, but also the opportunity to keep the bot turned on 24/7 without any damage to the main computer!
Part 2
Part 3
Let's get started!
Long or short, three single-board computers with a cheap price were found - Orange Pi Zero, NanoPi Neo, NanoPi Neo2, their brief characteristics are presented in the table:
| Orange pi zero | NanoPi Neo | NanoPi Neo2 |
---|
RAM size | 512MB DDR3 | 512MB DDR3 | 512MB DDR3 |
Internal memory | - | - | - |
CPU | Allwinner H2 + Cortex A7 (32-bit architecture, 4 cores, frequency up to 1200Hz) | Allwinner H3 Cortex A7 (32-bit architecture, 4 cores, frequency up to 1200Hz) | Allwinner H5 Cortex-A53 ( 64- bit architecture, 4 cores, frequency up to 1500Hz ) |
Graphics core | ARM Mali400 MP2, without a hint of OpenCL | ARM Mali400 MP4, without a hint of OpenCL | ARM Mali450 MP4, without a hint of OpenCL |
"Three sizes", mm | 52x46x17 | 40x40x17 | 40x40x17 |
Internet access | 100Mbps Ethernet + 802.11 b / g / n WiFi with antenna | 100Mbps Ethernet | 1Gbps Ethernet |
Number of USB outputs | 1 (+2 displayed) | 1 (+2 displayed) | 1 (+2 displayed) |
Price (+ delivery to Moscow), $ | 7 + 3.85 = 10.85 | 8 + 5 = 13 | 15 + 5 = 20 |
Delivery of Orange Pi Zero took exactly 20 days, Neo and Neo2 came a day earlier, I believe, very quickly.
Let's start to understand ...
It is worth saying that the Basic Starter Kit (+13 dollars) was ordered for Neo, which, in addition to the computer, includes:
- USB-to-UART converter;
- large (if you can call an aluminum plate the size of a computer such) radiator + mount;
- MicroSD card for 8GB SanDisk 10class.
- MicroUSB cable.
There is also the Complete Starter Kit ($ 29 + shipping), it includes everything that is in Basic, plus the case and the OLED screen, but for our purpose it is somewhat unnecessary.
Prepare for the first launch ...
From the
armbian site
we download three fresh images for NanoPi Neo, Neo2 and OrangePi Zero, we will use the MicroSD card obtained from the Basic Starter Kit.
From now on, the single-board computer will be referred to as the single-board computer, and the computer - the usual for us large and powerful computer or laptop.
Now we have two ways with which you can work with single-board devices:
[1] Via Ethernet;
Brief instruction - We connect a single-board through an Ethernet cable to a laptop, computer or router;
- We turn on the power for the single board;
- We scan the network; for most linux-based systems, you can do this using the “arp -a” command; for Windows, nmap exists;
- Connect to the single-server, for linux: “ssh ip -l root”, default password “1234”; in Windows, you can use any ssh client, for example, multifunctional putty
[2] Using USB-to-UART converter.
Brief instruction - We connect the converter to the computer, we define its physical address: in linux we look at the last lines of the command “dmesg | grep tty "and look for something similar to ttyUSBX, for Windows we look in the Device Manager new COM devices
- We connect a single-board device to the converter: we connect the wire to the converter so that GND is connected with a black wire and TX is connected with yellow, then we connect a single-board device (Neo / Neo2 are connected to the single unsoldered contacts near the USB port, so that the black wire is near the nearest edge, and yellow pointed in the direction of the flash card, it turns out the order: GND, 5V, RX, TX; Orange Pi Zero cannot be connected with the cable supplied in the Starter Pack, there is no 5V in the middle, so you will have to use another cable)
- Now you need to find a program in which it will be convenient to work with the console via TTY / COM: for linux, I will advise a convenient minicom or putty (you need to run as root), for Windows, putty is still relevant
You need to monitor the temperature, you need to monitor the temperature ...
We need to control the temperature if we want to keep an AI for Vindinium on it, avoiding lowering the frequency, freezing, or the failure of a single board. Let's write a simple script for temperature monitoring (at the same time, let's practice running .py files):
Script import time, sys print('NanoTemp 0.1') while True: with open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') as f: temp1 = f.read()[:-1] with open('/sys/devices/virtual/thermal/thermal_zone1/temp', 'r') as f: temp2 = f.read()[:-1] print('\r'+temp1+' '+ temp2) time.sleep(0.5)
Now you can upload this file on a flashcard in the directory / home /
username /.
TIP: Ubuntu, Debian, and many other Linux-based operating systems can work with ext3 / ext4 file systems from under the box; Windows will offer to format the USB flash drive. You need to use tools that allow you to work with this kind of file systems, for example, install the Ext2Fsd driver.
Later, I learned about a program such as armbianmonitor, with which you can safely monitor not only the temperature, but also the frequency, local time and load, which is undoubtedly useful.
Let's connect each odnoplatnik to the power supply, wait 15 minutes in idle time and see the results:
Orange pi zero | NanoPi Neo | NanoPi Neo2 |
---|
60 ° C | 35 ° C | 50.3 ° C |
Interestingly enough, the sensor on Neo2 shows the temperature down to the first decimal point, but it
hides information about the current processor frequency from us .
It is sad that the Orange Pi Zero is so hot in idle, unlike his brother Neo at the same frequency of 240 MHz. Forums are dotted with discontent on this topic. As an option that solves this problem, a special script is offered, editing system files and using cooling. However, there is also information that these were all measures against heating up to 80 degrees in idle time, and 55-60 degrees in the fresh version of armbian is normal in this case. Apparently, the
problem is solved only partially .
Let's try to install passive cooling. For Orange Pi Zero, a special set of two radiators for the processor and RAM was bought for $ 2.82. In the case of the NanoPi, we have a powerful radiator, which can be purchased separately from the Starter Pack for $ 2.99.
Now the picture 15 minutes after launch looks like this:
Orange pi zero | NanoPi Neo | NanoPi Neo2 |
---|
53 ° C | 30 ° C | 39.5 ° C |
Warm up in full!
It was observed that the orange was very warm. Interestingly, how many degrees will the temperature jump during loading. We will use the cpuburn program available in the repositories (for Neo and Zero we will use the burnCortexA7 command, for Neo2 we will use the burnCortexA8).
Well say ...
All single-board devices easily reach temperatures of 80 degrees with four instances of cpuburn - passive cooling simply does not cope with such heating. However, I believe that in the case of Vindinium, not everything will be so sad - there is a cyclic change in the phase of work and idle time (waiting for a response from the server), and the cpuburn program itself is designed for the most efficient heat dissipation, the AI ​​cannot load the processor as much minimum because of the need to wait for data from the RAM, because our task will not be able to fully accommodate the processor cache.
However, an interesting feature comes out here - the Orange Pi Zero reaches 80 degrees even with a single copy of cpuburn, for Neo2 three copies are enough, and Neo - four copies of the test.
Benchmarks, people demand bread and benchmarks!
Before you write an AI, you need to determine the most important question: how many times are these monolayers weaker than ordinary computers? I can not believe that a small piece of silicon, metal and PCB can do anything out of the ordinary.
For benchmarking
phoronix-test-suite utility was used.
In contrast to all the single-board users, let me allow my laptop to be included in testing (i5 2450M, 6gb DDR3, without discrete graphics, running Ubuntu 16.04 LTS), to facilitate the development of AI (you can run certain pieces of code and know how much, approximately, time will change while working on the same piece on single board). We use only passive cooling. Per unit of productivity we take an orange.
UPD: while the article was moderated, an old computer was found near the house (
Intel Pentium 4 (1 core, 2 threads, 2003, pre-stub processor on its architecture), 512MB DDR x2, Radeon 9600XT 128MB DDR), thirteen years ago this system can be was called strong. In order to compare how it is, I installed
Windows 10 Ubuntu 16.04 LTS, which, to my surprise, turned out to be very efficient.
| A laptop | Dinosaur computer | Orange pi zero | NanoPi Neo | NanoPi Neo2 |
---|
John The Ripper 1.8.0, Test: Blowfish (parrots / sec) | 797 Real C / S (+ 125%) | 313 Real C / S (+ 125%) | 354 Real C / S | 394 Real C / S (+ 11%) | 475 Real C / S (+ 34%) |
Smallpt V1.0.2 (seconds) | 586 Seconds (4.6 times faster) | 1214 Seconds (2.2 times faster) | 2694 Seconds | 2240 Seconds (1.2 times faster) | 1289 Seconds (2.08 times faster) |
C-Ray v1.1 (seconds) | 120.86 Seconds (5.03 times faster) | 294.61 Seconds (2.37 times faster) | 607.83 Seconds | 485.71 Seconds (1.25 times faster) | 349.51 Seconds (1.74 times faster) |
Himeno Benchmark v3.0 (parrots) | 1165.11 MFLOPS (+ 8908%) | 385.28 MFLOPS (+ 2455%) | 15.08 MFLOPS | 13.08 MFLOPS (15% weaker) | 37.23 MFLOPS (+ 185%) |
ompress 7zip (parrots) | 5010 MIPS (+ 585%, large deviation from the average: 22.77%) | 1706 MIPS (+ 88%) | 857 MIPS | 950 MIPS (+ 11%) | 1103 MIPS (+ 29%) |
ffmpeg (seconds) | 30.69 Seconds (13.25 times faster) | 81.22 Seconds (5 times faster) | 406.76 Seconds | 426.94 Seconds (5% slower) | Test failed to run - compile error |
Cost including delivery and radiators | $ 283.39 (+ 2046%) | - | $ 13.67 | $ 15.97 (+ 17%) | $ 22.97 (+ 68%) |
When studying information on the Internet, it became clear that H2 + is a
slightly modified version of H3 :
H2 + is a variant of H3, designed for low- capacity OTT blocks, in which there is no support for Gigabit MAC and 4K HDMI.
Original:
H2 + is a variant of H3 boxes that are targeted at low-end OTT boxes, and there is no need for Gigabit MAC and 4K HDMI output support.
In this case, it becomes interesting for what reason there is such a difference in performance and thermal conditions between H2 + and H3.
Summarizing.
Having compared three different single-board apps, I can summarize:
- Orange Pi Zero is undoubtedly the cheapest among all. The presence of WiFi on board is a very good advantage, but its speed is no more than 4 Mbit / s (I got about the same value), which excludes its use as a normal wireless file server, but for IoT it fits perfectly . You should buy at least some radiator in order not to experience problems with abnormal temperatures even in idle time. There is one more beautiful side - the presence of TV-OUT, which I managed to work with, but if you are looking for a single-board device for working in graphic mode, you should look towards devices with HDMI, because the screen resolution of 720x576 does not please the eyes. It is very convenient that the official store of the manufacturer is available on Aliexpress;
- NanoPi Neo, unlike its younger brother, is deprived of TV-OUT and built-in Wi-Fi (for wireless operation you have to buy a dongle for 2-3 Wi-Fi, the stated data transfer rate of which is at 150 Mbit / s), and by itself, it is a fifth more expensive, but it can please us with a lower heat emission, a firm, high-quality radiator, and higher performance that will cover all the shortcomings of the platform. Also worth noting is the large variety of components offered by the manufacturer for its offspring. Another caveat - will have to order from the official site, although it is in fact not so difficult;
- NanoPi Neo2. The firmware version from armbian is at the experimental stage, which was reflected in the problems described in the article (impossibility to see the frequency, error when compiling ffmpeg). However, even in this raw form, the second coming of Neo can boast of quite good performance in tests (recall the 64-bit architecture), Gigabit Ethernet, which immediately raises it as a favorite for those tasks that require good performance and wire transfer speed. But do not forget about Ubuntu Core, the situation may be better on it, and the armbian does not stand still. It costs, of course, more than one and a half times more than an orange, so you should see the competitors in its price segment.
For myself, I decided to continue to work with Neo and Neo2, and to put off an orange until some interesting idea about a smart house appears, because Neo's performance is very much like Zero, but without any problems with temperature.
In the next article we will choose a new programming language, which can be learned as soon as the AI ​​is written.
→
Link to Vindinium
→
Link to Vindinium sabreddit - a very useful thing, there you can track my movements on Vindinium
→
Link to my githab with some insights on Vindinium
I would be very pleased if more people pull themselves to this game, because during the rivalry the most interesting begins!