Scientific Computing

Measured power consumption of Intel Edison

The Intel Edison power draw was measured while using the Mini Breakout Board.

Yocto 3.0 has PulseAudio, BlueMan, XDG, etc. running in the background. This brings the idle current up 5 times as much as Yocto 2.1. To help preserve battery, perhaps disable unneeded services.

Yocto 3.5:

Activity Power (mW) voltage current (mA)
booting up (peak) 820 5.09 160
100-150% 1 CPU + Wifi 967 5.09 190
50-100% 1 CPU + Wifi (curl https) 820 5.09 160
5% 1 CPU + heavy disk write 561 5.10 110
idle 410 5.12 80
powered off (LED only adapter board) < 51 5.12 < 0.01

Yocto 3.0

Activity Power (mW) voltage current (mA)
booting up (peak) 944 4.97 190
using Wifi  (opkg update) 803 5.02 160
idle 455 5.05 90
powered off (LED only adapter board) < 51 5.12 < 0.01

Yocto 2.1

Activity Power (mW) voltage current (mA)
booting up (peak) 984 8.2 120
using Wifi (opkg update) 680 8.5 80
typing text (using serial port) 346 8.65 40
idle 88 8.8 10
powered off (LED is on adapter board) 45 8.9 5

Benchmarks http://www.davidhunt.ie/raspberry-pi-beaglebone-black-intel-edison-benchmarked/ of Raspberry Pi vs. Beaglebone Black vs. Intel Edison.

The Intel Edison specifications show the idle power with Wifi as 35 mW, while we measure 88 mW. Lkely sources for “high” power reading are the two bright green LEDs on the USB adapter board, and the switching power conversion from 9 V to 1.8 V.

The Edison draws far less power at idle, perhaps 1/20 the power of the Raspberry Pi 3+ at idle.

Raspberry Pi Zero W Practical Uses

The Raspberry Pi Zero W is a capable FTP/SSH server, but for field deployments, I would consider Compute Module 3 or Raspberry Pi 4.

This article is mainly about can be easily done with a Raspberry Pi Zero W vs. Compute Module 3.

Ranking key:

  1. Cannot Install / Not working if Installed
  2. Extremely slow, maybe single patient user only
  3. slow, but perhaps usable for patient 1-3 users
  4. adequate, may handle a handful of users (family, small club)
  5. great, handles multiple concurrent users, not so much slower than a 10-year old Pentium 4 PC

Groupware (email/calendar) server

Citadel

Rank: 3

Citadel is an easy to install groupware server. Accessing features took a few seconds per click, and it didn’t seem that users would have the patience for Citadel on Raspberry Pi Zero.

FTP server

Rank: 4.5

Like SSH below, the Raspberry Pi Zero can handle a few connections at once, but is limited to less than raw Ethernet speeds due to:

  1. CPU: USB-Ethernet onboard conversion
  2. CPU: encryption (if using SSL/SSH, etc.)
  3. CPU: filesystem – if using external HDD with FUSE (NTFS,exfat,etc.)
  4. CPU: USB HDD – takes some CPU to manage the transfer from USB to external HDD
  5. SD card: read/write speed

Web LAMP server

The Raspberry Pi as an NGINX or other lightweight server can work fine–test if your application might need the Compute Module 3 vs. Pi Zero.

Desktop workstation

Rank: 2 - 2.5

The Raspberry Pi 4 and Compute Module 3 are fast enough for light desktop use.

SSH server (port forwarding, SSHFS, remote management)

Rank: 4 - 4.5

The Raspberry Pi Zero W does quite adequately in this regard – you will feel just a bit of the CPU limitation when using many sessions or high Ethernet bandwidth.

FM transmitter

Rank: 4.5

The Raspberry Pi FM transmitter works splendidly – the program can be modified to transmit narrowband (~ 5kHz) FM on the 2 meter ham band, and for a wide variety of software defined radio tasks.

UART ttyMFD1 serial port on Intel Edison

On the Intel Edison Arduino board, the J18 Arduino connector block TX/RX pins have the UART connected to /dev/ttyMFD1 in the default Yocto install.

Edison adapter board GPIO voltage
Arduino 5 V
Mini-Breakout 1.8 V

The Mini-Breakout board Intel Edison has 1.8 V GPIO and can be damaged from connecting directly to 3.3 V or 5 V TTL logic. You need a level shifter board to do the interface to non-1.8V logic from the Mini-Breakout board.

To receive a stream from Intel Edison UART from a serial device that constantly streams output like a GPS NMEA stream.

At the Edison shell prompt:

stty -F /dev/ttyMFD1 9600
cat /dev/ttyMFD1

where 9600 is serial port device baudrate Text streams to console from UART serial device on Edison.

To two-way TX/RX from Intel Edison UART install:

opkg install screen

Connect interactively to UART device from the Edison shell

screen /dev/ttyMFD1 9600

where 9600 is serial port device baudrate


MRAA + PySerial make using the Intel Edison serial port easy from Python.

Install MRAA on the Edison and istall Pyserial:

python -m pip install pyserial

Verify serial port operation with:

import serial
import mraa

uart = mraa.Uart(0)

ser = serial.Serial(uart.getDevicePath(), 9600)

ser.write("TEST")
print ser.read(4)

Notes:

USB-serial FTDI adapters on Intel Edison

Plug the USB-serial adapter into Intel Edison USB OTG host port. Check if new device is seen, from Edison terminal:

dmesg

If there isn’t a new assignment to /dev/ttyUSB*, the FTDI kernel module may be needed.

opkg install kernel-module-ftdi-sio

This assumes setup the Intel Edison opkg repository.

Verify USB-serial adapter in Edison terminal

dmesg

The reply should include

usb: FTDI USB Serial Device converter now attached to ttyUSB0

Update kernel if this doesn’t work.


Which Intel Edison Yocto version is installed?

configure_edison --version

Using nmap to find active IPs on a subnet

Example: router with LAN IP address range 192.168.1.xxx.

The address discovery is faster if you know which port is open on your targeted device (host). However, you can also discover the device if open port is unknown.

Unknown open port scan:

nmap -sn 192.168.1.* --open

will tell you some of the IP addresses that are active on that subnet.

Options:

-sn
check if pingable (ping scan, not port scan)
--open
only tell which hosts appear to be up

Many devices will hide themselves from this scan, but it’s the first thing I try for finding a new device that attached to the network, such as an IoT device that isn’t trying to hide itself.

Port known, IP address scan: port scanning is much faster when the open port is known. Note in some rare cases, there is a firewall schedule or port knocking as additional security that could cause a port scan to fail.

Raspberry Pi port scan: assume known 192.168.1.xxx and that factory image has an SSH server on port 22.

Find the new Raspberry Pi IP address with

nmap -Pn -p 22 192.168.1.* --open
-Pn
nmap assumes each host is up
--open
only hosts with specified port open

non-nmap: scan IP address range with known open port: the pure Python program findssh.py, scans for servers with open ports in less than a second concurrently via Python asyncio.

Use LaTeX lowercase package names

When moving files between:

  • case-insensitive filesystems: HFS+, ExFAT, FAT
  • case-sensitive filesystems: Ext4, NTFS, APFS

LaTeX documents may fail to build if filename case differs from LaTeX code. It’s best to always use lowercase for filenames when sharing with case-insensitive systems.

This example is for the UTF8 package. This stanza works for case-insensitive:

\usepackage[UTF8]{inputenc}  % don't use capitals!

but on case-sensitive systems:

UTF8.def not found from inputenc.sty

Fix by always using lowercase LaTeX package names.

\usepackage[utf8]{inputenc}

Raspberry Pi SPI

These are general notes, there are often caveats with GPIO/SPI applications on any embedded device.

Raspberry Pi SPI pinout shows two SPI ports spi0 spi1 for most non-Compute Module Raspberry Pi models. Raspberry Pi Compute Modules have three SPI ports, with the addition of spi2 that’s only available on the Compute Modules.

Software

Python is a popular way to access the Raspberry Pi SPI. spidev is a popular Python module to use SPI. For example, the Raspberry Pi SPI maximum clock speed is set to 1 MHz by

import spidev
spi = spidev.SpiDev()
spi.open(bus, device)
spi.max_speed_hz=1000000

As noted in later sections, having the correct maximum clock speed and correct polarity is essential for SPI communications to work.

Synchronous

You might be familiar with asynchronous protocols such as used in RS232 connections, where the baud rate must be agreed upon in advance by communicating peripherals. Only the SPI controller initiates communications, and the controller must know how many bytes to receive for a given command so as not to cut off the communications too early. Be sure polarity and phase are compatible between devices.

SPI consists of four wires: clock, select, MISO and MOSI.

Clock

The clock line is unidirectional from the controller to peripheral. The peripheral cannot initiate communications. Faster clocks require shorter wires, as remember a 10 MHz square wave needs several harmonics to keep usable shape–perhaps up to 100 MHz. How good of a transmission line is your knotted hookup wire at 100 MHz? not so good perhaps.

Consider clock speed if a peripheral is not responding, or responding erratically, especially considering that the Raspberry Pi 2/3 SPI clock varies with the VPU speed.

Chip Select

The Raspberry Pi can select more than two peripherals by using a binary decoder chip, assuming you have a recent kernel and the appropriate software and configuration.

MISO

MISO is unidirectional from each peripheral to controller. The MISO line is shared between all peripherals. Only one peripheral, selected by Chip Select line may use MISO at once.

MOSI

MOSI is unidirectional from controller to all peripherals. The MOSI line is shared between all peripherals. Only the peripheral selected by Chip Select should respond to MOSI on MISO.

Full duplex

SPI is a full-duplex protocol, that is, the controller can send while the peripheral transmits (for capable hardware).

Debugging

Debugging SPI is most convenient with a four-channel oscilloscope, particularly if the scope has SPI decode.

Notes

Note: In some peripherals, MISO is daisy-chained with MOSI, but your datasheet would tell you for those cases.

See /boot/overlays/README for more details on configuring the GPIO for SPI.

NASA HPFCC FUN3D Fortran competition canceled

On June 16, 2017 NASA announced the cancellation of its FUN3D Fortran supercomputer code improvement competition originally announced May 2, 2017.

The extremely high number of applicants, more than 1,800, coupled with the difficulty in satisfying the extensive vetting requirements to control the public distribution of the software made it unlikely they would achieve the challenge’s original objectives in a timely manner. NASA looked at several alternatives to keep the challenge design intact – things like significantly extending the challenge performance period, and offering a much smaller portion of the code. Neither were considered viable options.

For a one-of-a-kind competition, 1800 participants is a large number, considering the need to verify US citizenship and that the work was done on a personal PC. As a comparison, the notable ACM ICPC competition has several thousand participants each year in teams of three.

I was surprised to see 1800 entries. It may be that a substantial proportion of HPFCC entrants were new to Fortran but experienced with HPC.

It would be interesting to get demographic info on the HPFCC entrants as a snapshot of the future of the Fortran language.

Consolation prize: HeroX Fortran Storytelling competition (ended July 2017) with $1750 in prizes

Further competition: Making industrial cloud competitive with supercomputers