07 February 2013

335. Compiling sinfo in Arch linux

Note: I'm not abandoning Debian. I'm just going on a roadtrip with Arch to see whether we can all happily co-exist in the same machine park.

sinfo is available in AUR, but it's broken and won't build. Luckily it's very easy to build it yourself.

(see here for debian and here for centos)

mkdir ~/tmp
cd ~/tmp
sudo pacman -S wget base-devel boost asio
wget http://www.ant.uni-bremen.de/whomes/rinas/sinfo/download/sinfo-0.0.47.tar.gz
tar xvf sinfo-0.0.47.tar.gz
cd sinfo-0.0.47/
sed -i 's/\-mt//g' sinfo/Makefile.*
sed -i 's/\-mt//g' sinfod/Makefile.*
./configure
make
sudo make install


Not sure about a suitable systemd script (I'll update somewhere down the line). To start sinfod manually do
sudo sinfod --quiet 

if you have multiple ifaces you can set the --bcastaddress.

To start sinfo itself, well, run sinfo
sinfo

Not much fun with only one node...

334. Compiling nwchem with openmpi and python on Arch linux

Here's the reason why I gave my virtual machine 30 Gb in post 333 -- to be able to evaluate whether I can figure out how to build all the software that I need on Arch.

Behold my surprise when I realised that there's no need for separate -dev packages, as is the case on Debian i.e. the headers are generally installed together with the package (so e.g. python is enough -- you don't need python-dev as well).

While debian is probably the best choice for my nodes (I want stability -- not the latest flashiest stuff), nwchem is a good test case since I've been playing with it for years, and it's not available in the pacman or AUR repos.

Your mileage with openblas will vary depending on your hardware. ACML is an alternative on e.g. FX-8150. ATLAS doesn't seem to work with NWChem when I try it, but I'm not sure what I'm doing wrong. See the original post for examples on how to link to other math libs.

I'm mainly looking at this post: http://verahill.blogspot.com.au/2012/09/briefly-compiling-nwchem-611-with.html


Dependencies:
pacman -S wget base-devel gcc-fortran tcsh openmpi

Openblas:
Download from http://github.com/xianyi/OpenBLAS/tarball/v0.1.1

sudo mkdir /opt/openblas
sudo chown $USER /opt/openblas
tar xvf xianyi-OpenBLAS-v0.1.1-0-g5b7f443.tar.gz
cd xianyi-OpenBLAS-e6e87a2/
make all BINARY=64 CC=/usr/bin/gcc FC=/usr/bin/gfortran USE_THREAD=0 INTERFACE64=1 1> make.log 2>make.err
make PREFIX=/opt/openblas install
cp lib*.*  /opt/openblas/lib

Nwchem:
sudo mkdir /opt/nwchem
sudo chown $USER /opt/nwchem
cd /opt/nwchem
wget http://www.nwchem-sw.org/images/Nwchem-6.1.1-src.2012-06-27.tar.gz
tar xvf Nwchem-6.1.1-src.2012-06-27.tar.gz
cd nwchem-6.1.1-src/

Edit nwchem-6.1.1-src/src/config/makefile.h and edit line 1957 as shown in this post.

Then continue:
export LARGE_FILES=TRUE
export TCGRSH=/usr/bin/ssh
export NWCHEM_TOP=`pwd`
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES="all python"
export PYTHONVERSION=2.7
export PYTHONHOME=/usr
export BLASOPT="-L/opt/openblas/lib -lopenblas"
export USE_MPI=y
export USE_MPIF=y
export USE_MPIF4=y
export MPI_LOC=/usr/lib/openmpi
export MPI_INCLUDE=/usr/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib/openmpi:/opt/openblas/lib
export LIBMPI="-L/usr/lib/openmpi -lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread"
cd $NWCHEM_TOP/src
make clean
make nwchem_config
make FC=gfortran 1> make.log 2>make.err
export FC=gfortran
cd ../contrib
./getmem.nwchem

Note that some of the locations are a little bit different from debian.

Edit your ~/.bashrc and add:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openblas/lib export PATH=$PATH:/opt/nwchem/nwchem-6.1.1-src/bin/LINUX64
You can now test your new binary by running a job, e.g. co.nw:
title "co nmr" geometry c 0 0 0 o 0 0 1.13 end basis * library "6-311+g*" end dft direct grid fine mult 1 xc HFexch 0.05 slater 0.95 becke88 nonlocal 0.72 vwn_5 1 perdew91 0.81 end task dft optimize
Run:

nwchem co.nw

or

mpirun -n 2 nwchem co.nw

06 February 2013

333. Arch linux with Gnome in virtualbox

Not too different from what I've posted before (330, 331), but I'm just so excited that I can't help myself, so here we go:

I'll presume that you've got virtualbox installed.


0. Get the Arch iso:
If you're allowed to use bittorrent:

sudo apt-get install bittorrent squashfs-tools
cd ~/Downloads/
btdownloadcurses https://www.archlinux.org/iso/2013.01.04/archlinux-2013.01.04-dual.iso.torrent

If you're not allowed to use bittorrent:

cd ~/Downloads
wget http://mirror.aarnet.edu.au/pub/archlinux/iso/2013.01.04/archlinux-2013.01.04-dual.iso

Note that the links will change with time.



1. Setting up the machine
Start virtualbox and click on New. Select Type=Linux and Version=Arch Linux.

Give the machine at least 512 Mb, although even that is probably a bit on the low end for Gnome.

Create a virtual harddisk. 8 Gb is enough for testing purposes, but if you're actually planning on using the virtual machine you're better off giving it something like 15-20 Gb. VDI is fine when it comes to format, and 'Dynamically allocated' is a safe choice for a normal desktop.








There's a little bit of tinkering left to do. Click on Settings, go to Storage, and mount your iso:





2. First Boot
Click on Star which will boot off of the CD.


You can pick whatever makes you happy here. For the sake of simplicity will pick the first option -- x86_64.

You're now met with the first indication that this ain't Kansas (or Ubuntu):

Remember -- terminals/consoles should give you warm and fuzzy feeling because there is nothing which you can't accomplish in a terminal. A one-click installation option would be nice for checking things out though, but it's actually pretty easy to get started.


Preparing the harddrive
Our first step is to format the harddrive. Remember, it's an imaginary virtual harddrive -- nothing will be touched on your physical harddrive.

Do

fdisk /dev/sda

Hit n to create a new partition. p for primary, 1 to make it partition number 1, make it start at sector 2048, and make it e.g. 2 Gb by having it stop at +2G -- this will be our swap. Hit n again, p again, and make it partition number 2, and accept the default sectors that it suggests. This will be our  /(root) partition.

Hit a, then 2, to make the partition bootable.

Hit t, then 1, then 82 to make a swap disk.

Hit w to finalise the changes.

Do
mkswap /dev/sda1
mkfs.ext4 /dev/sda2

to set up the file systems.

Do
mount /dev/sda2 /mnt

to mount your new ext4 partition.

Install a basic system:
Do
pacman-key --init
pacman-key --populate archlinux

to get set up with pacman. Edit pacman.conf if you want a specific architecture (i686 or x86_64), or the current architecture will be used.

Time to install packages:
pacstrap /mnt base gnome xorg-xinit xorg-server xorg-utils xorg-server-utils virtualbox-guest-modules virtualbox-guest-utils vim mlocate wicd wicd-gtk openssh grub-bios upower

Generate a proto-fstab:
genfstab -p /mnt > /mnt/etc/fstab

Then enter a chroot:
arch-chroot /mnt

Edit /etc/fstab and add a line for swap:
/dev/sda1    none    swap    sw    0 0

Set up your locale and timezone:
ln -s /usr/share/zoneinfo/Australia/Melbourne /etc/localtime
echo 'LANG="en_US.UTF-8"'>/etc/locale
echo 'KEYMAP=us'> /etc/vconsole.conf
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
locale-gen
echo "spinebill" >/etc/hostname

Set up a user:
pacman -S sudo
useradd -p `openssl passwd -1 mypassword` -m verahill
echo "verahill ALL=(ALL) ALL">> /etc/sudoers

Edit /home/verahill/.xinitrc and uncomment
exec gnome-session

Set up grub and booting:
mkinitcpio -p linux
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda

You're now ready to start your Arch system. First you need to shut down your current system though:
exit
umount /mnt
shutdown -h now

Once the machine is off, go to Settings, Storage, and remove disk from virtual drive.



Booting:
Boot by clicking on Start.
You might get the odd error message while booting, but everything will be fine.

Log in as the user you created, then enabled the ssh daemon and the wicd daemon:
sudo systemctl enable sshd
sudo systemctl enable wicd

Start wicd-curses
wicd-curses

and wait 10-20 seconds for wicd to detect the network card and starting it


Quit by hitting 'Q'.

To launch gnome, type
startx
evening gnome?
It'll take a little while to start up. This is a pretty ugly Gnome though, but that's the stock background which changes during the day.
daytime gnome?