Megaprocessor

Today I visited the Cambridge History of Computing Museum: http://www.computinghistory.org.uk/

I met James Newman, the inventor of the megaprocessor. He described the process of designing and building the machine, and stepped us through some clock cycles.

Advertisements

Compiling Fortran

Mixing of Fortran types occurs, and often results in problems when mixing free-form Fortran with older styles of Fortran, and when using different compilers.

As pointed out at Geek Tricks.

In Fortran 90/95, a “&” at the end of a line, or in the front of a line, is treated as line continuation sign. But in Fortran 77, it has to be a character at the sixth column. In the code I get, most “&”‘s comply to the Fortran 77 format, but some are not. So I move all “&”‘s to the sixth column, and now the code compile with gfortran.

If you want to replace lots ampersands from the ‘first column’ to the ‘sixth column’ on a lot of lines you could use ‘sed’ string editor to do that.

sed 's/^&/ &/g' input.f > output.f

You also need to check for lines which are too long in your input.

Many errors can be suppressed for now, with command such as gfortran -std=legacy output.f -o justwork

Software defined radio

There are a number of cheap devices which allow you to listen to radio signals, these devices were originally intended for watching TV, digital TV and radio signals through the computer. By using available software it is possible to tune into many radio broadcasts/signals, e.g. HAM radio, AM, FM, commercial airline signals, etc.

To take a look at some devices search for “sdr usb” or “rtl usb”, prices vary from around 5-20 pounds depending on branding / accessories.

If you are interested to listen to voices from around the world, some of these software defined radios are possible to use over the internet. This has the advantage that you can access better hardware and also listen to stations based across the world.

A list of stations is available here: http://websdr.org/

Overheating the i7 620M processor in my laptop (Lenovo T410)

Having fun causing my laptop to shutdown trying to run some density functional theory code (CASTEP) on my laptop. Usually firefox is the culprit.

I installed cpufreq tools which seem to make no difference.

Installing thermald seems to help.

The fist time I ran simulations with castep.serial, i.e. compiled to run on one processor core, and it ran fine. To try and speed up calculations I managed to compile using intel ifort and supporting mpi. I actually managed to slow down the calculation the first time trying to run on 4 cores… the i7-620M only has 2 cores, but supports hyper-threading to add an additional 2 virtual cores.

After that I also need to make sure I don’t do a bandstructure calculation using multi-cores again, CASTEP will happily perform the calculation on 4 cores, but the output file informs there is no parallelisation implemented yet for this task.

This command lets me know temperatures, fanspeed, cpu frequency etc.

watch -n 2 -d cpufreq-info -c 0 -fm; cpufreq-info -c 1 -fm; cpufreq-info -c 2 -fm; cpufreq-info -c 3 -fm; sensors

Running castep.serial compiled with gfortran / fftw3 ?

Pseudo atomic calculation performed for Ni 3d8 4s2

Converged in 38 iterations to a total energy of -1355.3473 eV

Charge spilling parameter for spin component 1 = 0.20%
Charge spilling parameter for spin component 2 = 0.27%

Initialisation time = 17.13 s
Calculation time = 2663.64 s
Finalisation time = 0.42 s
Total time = 2681.19 s
Peak Memory Use = 397444 kB

Running castep.mpi compiled with ifort / mkl

Pseudo atomic calculation performed for Ni 3d8 4s2

Converged in 38 iterations to a total energy of -1355.3473 eV

Charge spilling parameter for spin component 1 = 0.20%
Charge spilling parameter for spin component 2 = 0.27%

Initialisation time = 10.33 s
Calculation time = 996.47 s
Finalisation time = 1.26 s
Total time = 1008.06 s
Peak Memory Use = 430140 kB

You will notice I haven’t yet tried mpi with gfortran or serial with ifort. These are just the options I tried so far. Also thermal management was different between these two calculations. But it seems playing around with compilation, thermal management, and using parallelisation can more than double the speed of the calculations.

System details:
3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux

Megaprocessor!

Digital electronics engineer James Newman, has built a ten meter long, two meter tall processor using transistors. Running at speeds up to 8 kHz the project ran out of control with total spend of forty thousand UK pounds (£40k). Unlike a computer on a chip, the system allows visualisation of the processes and architecture of a modern computer central processing unit (CPU). James is looking to site the computer in a museum or have it tour the UK to educate the public. Currently it’s possible to visit the computer during open days in James’ lounge were the machine was built.

A physically large chunk of memory built using LEDs allows visualisation of the data stored, and can be used to play Tetris!

Megaprocessor

Megaprocessor

Take the tour:

More info on the Magaprocessor website: http://www.megaprocessor.com/.

Other homebew machines can be seen here: Home Brew Computer Ring.

Installing ab-initio calculators on debian

Installation of elk all-electron full-potential linearised augmented-plane wave (FP-LAPW) as easy as;
“aptitude search elk”
“aptitude install elk-lapw”

Installation of quantum espresso, computer codes for density-functional theory using plane waves, and pseudopotentials, as easy as;
“aptitude install quantum-espresso”

Installation of xrysden
“aptitude install xcrysden”

 


root>
aptitude install elk-lapw
The following NEW packages will be installed:
elk-lapw libcr0{a} libhwloc-plugins{a} libhwloc5{a} libibverbs1{a} libnuma1{a} libopenmpi1.6{a} libxc1{a} ocl-icd-libopencl1{a}
0 packages upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 4025 kB of archives. After unpacking 12.6 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ftp.uk.debian.org/debian/ jessie/main libnuma1 amd64 2.0.10-1 [32.5 kB]
Get: 2 http://ftp.uk.debian.org/debian/ jessie/main libhwloc5 amd64 1.10.0-3 [86.9 kB]
Get: 3 http://ftp.uk.debian.org/debian/ jessie/main ocl-icd-libopencl1 amd64 2.2.3-1+deb8u1 [33.6 kB]
Get: 4 http://ftp.uk.debian.org/debian/ jessie/main libcr0 amd64 0.8.5-2.2 [32.7 kB]
Get: 5 http://ftp.uk.debian.org/debian/ jessie/main libibverbs1 amd64 1.1.8-1.1 [32.2 kB]
Get: 6 http://ftp.uk.debian.org/debian/ jessie/main libopenmpi1.6 amd64 1.6.5-9.1 [1460 kB]
Get: 7 http://ftp.uk.debian.org/debian/ jessie/main libxc1 amd64 2.1.1-1 [284 kB]
Get: 8 http://ftp.uk.debian.org/debian/ jessie/main elk-lapw amd64 2.3.22-1 [2048 kB]
Get: 9 http://ftp.uk.debian.org/debian/ jessie/main libhwloc-plugins amd64 1.10.0-3 [15.2 kB]
Fetched 4025 kB in 5s (750 kB/s)
Selecting previously unselected package libnuma1:amd64.
(Reading database ... 209260 files and directories currently installed.)
Preparing to unpack .../libnuma1_2.0.10-1_amd64.deb ...
Unpacking libnuma1:amd64 (2.0.10-1) ...
Selecting previously unselected package libhwloc5:amd64.
Preparing to unpack .../libhwloc5_1.10.0-3_amd64.deb ...
Unpacking libhwloc5:amd64 (1.10.0-3) ...
Selecting previously unselected package ocl-icd-libopencl1:amd64.
Preparing to unpack .../ocl-icd-libopencl1_2.2.3-1+deb8u1_amd64.deb ...
Unpacking ocl-icd-libopencl1:amd64 (2.2.3-1+deb8u1) ...
Selecting previously unselected package libcr0.
Preparing to unpack .../libcr0_0.8.5-2.2_amd64.deb ...
Unpacking libcr0 (0.8.5-2.2) ...
Selecting previously unselected package libibverbs1.
Preparing to unpack .../libibverbs1_1.1.8-1.1_amd64.deb ...
Unpacking libibverbs1 (1.1.8-1.1) ...
Selecting previously unselected package libopenmpi1.6.
Preparing to unpack .../libopenmpi1.6_1.6.5-9.1_amd64.deb ...
Unpacking libopenmpi1.6 (1.6.5-9.1) ...
Selecting previously unselected package libxc1:amd64.
Preparing to unpack .../libxc1_2.1.1-1_amd64.deb ...
Unpacking libxc1:amd64 (2.1.1-1) ...
Selecting previously unselected package elk-lapw.
Preparing to unpack .../elk-lapw_2.3.22-1_amd64.deb ...
Unpacking elk-lapw (2.3.22-1) ...
Selecting previously unselected package libhwloc-plugins.
Preparing to unpack .../libhwloc-plugins_1.10.0-3_amd64.deb ...
Unpacking libhwloc-plugins (1.10.0-3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libnuma1:amd64 (2.0.10-1) ...
Setting up libhwloc5:amd64 (1.10.0-3) ...
Setting up ocl-icd-libopencl1:amd64 (2.2.3-1+deb8u1) ...
Setting up libcr0 (0.8.5-2.2) ...
Setting up libibverbs1 (1.1.8-1.1) ...
Setting up libopenmpi1.6 (1.6.5-9.1) ...
Setting up libxc1:amd64 (2.1.1-1) ...
Setting up elk-lapw (2.3.22-1) ...
Setting up libhwloc-plugins (1.10.0-3) ...
Processing triggers for libc-bin (2.19-18+deb8u4) ...

root@ptlin10:~# aptitude install quantum-espresso
The following NEW packages will be installed:
libblacs-openmpi1{a} libelpa0{a} libscalapack-openmpi1{a} mpi-default-bin{a} openmpi-bin{a} openmpi-common{a} quantum-espresso
quantum-espresso-data{a}
0 packages upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.8 MB of archives. After unpacking 134 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ftp.uk.debian.org/debian/ jessie/main libelpa0 amd64 2013.11.008-2 [88.9 kB]
Get: 2 http://ftp.uk.debian.org/debian/ jessie/main openmpi-common all 1.6.5-9.1 [110 kB]
Get: 3 http://ftp.uk.debian.org/debian/ jessie/main openmpi-bin amd64 1.6.5-9.1 [154 kB]
Get: 4 http://ftp.uk.debian.org/debian/ jessie/main mpi-default-bin amd64 1.0.2+nmu2 [3356 B]
Get: 5 http://ftp.uk.debian.org/debian/ jessie/main libblacs-openmpi1 amd64 1.1-33 [56.8 kB]
Get: 6 http://ftp.uk.debian.org/debian/ jessie/main libscalapack-openmpi1 amd64 1.8.0-12 [2184 kB]
Get: 7 http://ftp.uk.debian.org/debian/ jessie/main quantum-espresso amd64 5.1+dfsg-3 [10.1 MB]
Get: 8 http://ftp.uk.debian.org/debian/ jessie/main quantum-espresso-data all 5.1+dfsg-3 [11.1 MB]
Fetched 23.8 MB in 30s (774 kB/s)
Selecting previously unselected package libelpa0.
(Reading database ... 209802 files and directories currently installed.)
Preparing to unpack .../libelpa0_2013.11.008-2_amd64.deb ...
Unpacking libelpa0 (2013.11.008-2) ...
Selecting previously unselected package openmpi-common.
Preparing to unpack .../openmpi-common_1.6.5-9.1_all.deb ...
Unpacking openmpi-common (1.6.5-9.1) ...
Selecting previously unselected package openmpi-bin.
Preparing to unpack .../openmpi-bin_1.6.5-9.1_amd64.deb ...
Unpacking openmpi-bin (1.6.5-9.1) ...
Selecting previously unselected package mpi-default-bin.
Preparing to unpack .../mpi-default-bin_1.0.2+nmu2_amd64.deb ...
Unpacking mpi-default-bin (1.0.2+nmu2) ...
Selecting previously unselected package libblacs-openmpi1.
Preparing to unpack .../libblacs-openmpi1_1.1-33_amd64.deb ...
Unpacking libblacs-openmpi1 (1.1-33) ...
Selecting previously unselected package libscalapack-openmpi1.
Preparing to unpack .../libscalapack-openmpi1_1.8.0-12_amd64.deb ...
Unpacking libscalapack-openmpi1 (1.8.0-12) ...
Selecting previously unselected package quantum-espresso.
Preparing to unpack .../quantum-espresso_5.1+dfsg-3_amd64.deb ...
Unpacking quantum-espresso (5.1+dfsg-3) ...
Selecting previously unselected package quantum-espresso-data.
Preparing to unpack .../quantum-espresso-data_5.1+dfsg-3_all.deb ...
Unpacking quantum-espresso-data (5.1+dfsg-3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libelpa0 (2013.11.008-2) ...
Setting up openmpi-common (1.6.5-9.1) ...
Setting up openmpi-bin (1.6.5-9.1) ...
update-alternatives: using /usr/bin/mpirun.openmpi to provide /usr/bin/mpirun (mpirun) in auto mode
Setting up mpi-default-bin (1.0.2+nmu2) ...
Setting up libblacs-openmpi1 (1.1-33) ...
Setting up libscalapack-openmpi1 (1.8.0-12) ...
Setting up quantum-espresso (5.1+dfsg-3) ...
Setting up quantum-espresso-data (5.1+dfsg-3) ...
Processing triggers for libc-bin (2.19-18+deb8u4) ...

root>>aptitude install xcrysden
The following NEW packages will be installed:
bwidget{a} libgl2ps0{a} libopenbabel4{a} openbabel{a} xcrysden xcrysden-data{a}
0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 5387 kB of archives. After unpacking 19.4 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ftp.uk.debian.org/debian/ jessie/main bwidget all 1.9.8-1 [194 kB]
Get: 2 http://ftp.uk.debian.org/debian/ jessie/main libgl2ps0 amd64 1.3.8-1.2 [35.4 kB]
Get: 3 http://ftp.uk.debian.org/debian/ jessie/main libopenbabel4 amd64 2.3.2+dfsg-2 [2913 kB]
Get: 4 http://ftp.uk.debian.org/debian/ jessie/main openbabel amd64 2.3.2+dfsg-2 [254 kB]
Get: 5 http://ftp.uk.debian.org/debian/ jessie/main xcrysden-data all 1.5.60-1 [1603 kB]
Get: 6 http://ftp.uk.debian.org/debian/ jessie/main xcrysden amd64 1.5.60-1 [387 kB]
Fetched 5387 kB in 10s (518 kB/s)
Selecting previously unselected package bwidget.
(Reading database ... 210350 files and directories currently installed.)
Preparing to unpack .../bwidget_1.9.8-1_all.deb ...
Unpacking bwidget (1.9.8-1) ...
Selecting previously unselected package libgl2ps0.
Preparing to unpack .../libgl2ps0_1.3.8-1.2_amd64.deb ...
Unpacking libgl2ps0 (1.3.8-1.2) ...
Selecting previously unselected package libopenbabel4.
Preparing to unpack .../libopenbabel4_2.3.2+dfsg-2_amd64.deb ...
Unpacking libopenbabel4 (2.3.2+dfsg-2) ...
Selecting previously unselected package openbabel.
Preparing to unpack .../openbabel_2.3.2+dfsg-2_amd64.deb ...
Unpacking openbabel (2.3.2+dfsg-2) ...
Selecting previously unselected package xcrysden-data.
Preparing to unpack .../xcrysden-data_1.5.60-1_all.deb ...
Unpacking xcrysden-data (1.5.60-1) ...
Selecting previously unselected package xcrysden.
Preparing to unpack .../xcrysden_1.5.60-1_amd64.deb ...
Unpacking xcrysden (1.5.60-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for mime-support (3.58) ...
Setting up bwidget (1.9.8-1) ...
Setting up libgl2ps0 (1.3.8-1.2) ...
Setting up libopenbabel4 (2.3.2+dfsg-2) ...
Setting up openbabel (2.3.2+dfsg-2) ...
Setting up xcrysden-data (1.5.60-1) ...
Setting up xcrysden (1.5.60-1) ...
Processing triggers for libc-bin (2.19-18+deb8u4) ...

LaTeX figure placement problem solved. Place figures in sections in LaTeX.

If you use LaTeX and you tend to have a lot of figures, they will start to float too much… and you will get misplaced figures that make it difficult to read your documents (even for proof reading!). Here is the solution to this perennial LaTeX problem… there is a package for that… and it’s name is placeins.

Here with the option “section”, all figures in a section will be placed in that section.

Now LaTeX will place your figures sensibly, all thanks to this wonderful package!

\usepackage[section]{placeins}