20 May 2013

426 Multibooting Windows XP, Vista and Debian

This post will most likely not be particularly interesting to anyone. It's basically just a collection of notes of me putting XP, Vista and Debian on the same box. Turns out that it's actually pretty straightforward -- the lack of drama in this post is what makes it a bit dull. Maybe the chief value of this post is to reassure anyone wanting to do the same of its feasibility.

Anyway.

I've decided to revive an old Dell C521 from 2007 (I accidentally blew the PSU when moving to Oz from the US, I've upgraded the graphics card, and put a 1 Tb hdd in it) and since I don't have any windows machines and it isn't useful for anything high-powered (dual core Athlon), I figure I might as well use it for a bit of experimentation.

This isn't going to be a detailed step-by-step how-to guide -- it's more of an overview of how to set up triplebooting with vista in case I need to help someone at a later point (parents/parents-in-law, I'm looking at you).

I have no real desire to use windows, but I could see the usefulness of having a windows box around. Partly because I'd like to do my bit to help Windows users move towards using FOSS instead of the usual commercial fare (familiarity with the software ecosystem on linux will presumably help adoption). Partly because I haven't played Halo 2 for years...

I'm bracing myself for experiencing the pain of vista again...XP I can just about tolerate -- it's a decade old, so I can accept that it has some limitations.

Anyway, triple-booting Vista, XP and Debian seems ambitious enough for a blog post, given what a pain Vista (and 7) are in terms of playing nicely with other OS:s.

Looking at this post:
When dual-booting, you always install the old OS first, then the new.

Sounds about right...Debian last then ;)

Note that the hard disk was unpartitioned at the beginning. The screen was connected via a KVM switch to the NS210 graphics card (via the VGA port). The on-board ethernet port was connected to a router set up with dhcp.

The remaining original hardware is as follows:
AMD Athlon 64 X2 3800+ 2.0 GHz
2048 Mb DDR2 RAM
Broadcom 440x 10/100

The added bits are:
Realtek RTL8169/8110 Family PCI Gigabit ethernet
MSI NF210 (Geforce 210)
Western Digital Green 1 Tb 3.5"


Installing XP (32 bit):
First I had to burn a CD from an iso from my university. I don't have any cd writer on my desktop, but happen to have one on one of my nodes (an old work computer). So I copied the iso via nfs, and then burned it with
sudo burn -I -n WinXP\ Pro\ US\ with\ SP1\ \&\ MS03-39.iso

There isn't much to say about installing XP, other than me making a partition at the beginning of the disk with 50,000 Mb space. I made the paritition using the windows installation program (as part of the install), chose quick format (ntfs).

The reboot step during XP installs gets me every time and I always hit a key to boot from CD automatically. Don't do that.

I only installed XP. I didn't bother chasing down drivers etc. Those who complain about hardware support in linux don't realise what it's like setting up windows on a computer using a vanilla installation disk....

XP didn't have working internet (didn't recognize either network card) and the video resolution was 640x480. Once the network had been sorted out (R149798; downloaded in Vista and moved to the XP partition)I downloaded SP3, after which I could install the nvidia drivers. Luckily, most of the remaining drivers could be downloaded from Dell (nVidia_SMBus_A02_R132919, R132395, R133065)).

Setting up multiple ethernet cards was...fun. The challenge was the routing, which required a registry change and reboot. And I never knew XP had 'shutdown -r'. It's like a whole new OS to me now.


Installing Vista (32 bit):
Once XP was installed I popped in the Dell DVD (yes, once upon a time you actually got the installation CDs with your computer...) and rebooted.

Select install, and choose custom. Click on the unallocated space, select Drive Options (advanced), then click on New. I set the size to 100,000 Mb (visa is a space hog, but I don't really plan on actually using it so...). Click Apply. A new partition (Disk 0 Partition 2; Primary) should appear. Note that because windows set everything to primary and because GPT only can handle four primary partitions, you become somewhat limited in the number of OSs you can install (there are reasonably simple ways around it though). Click Next and let Vista have a go at your HDD.

The vista installation wasn't too bad, and there was decent hardware support on boot. Note that this was installed using the Vista DVD that came with the Dell I just installed it on i.e. the drivers were presumably included on the DVD.

Both network cards were detected (ipconfig) and I had a working internet connection (ping google.com). The default resolution was 800x600 pixels (display settings), but it was easily changed to 1024x768.

The device manager had an exclamation point next to Standard VGA Graphics Adapter under Display Adapters. The 'Windows Experience Index' was 1.0  due to poor Graphics and Gaming Graphics.

My post install steps consisted of installing Google Chrome, then allowing windows to install updates (451 Mb). Among those updates was GF210 support. Simply downloading 451 Mb took an hour (!) even though I'm on a university connection (i.e. fast -- typically +3M/s). Installing the updates took another hour after that. And that wasn't the end of it.

The nvidia was recognised after the reboot, and I now had a 4.1 "experience rating", and I could set the resolution to 1280x960.

I had another revelation (I've been gone from Windows for a while): I plugged in an Airlink101 USB wlan dongle (rtl8187b), and downloaded the driver from CNET. The installer tried to install two pieces of software without clearly advertising that it was doing so (top arcade something, and 7 wonders something else), then wanted to throw in zonealarm and change my home page. I seem to remember cnet being one of the reasonably trustworthy sites? I don't remember it bundling junk/spy-ware. Huh. Anyway, turns out the drivers got installed via windows update anyway.

Anyway, sorting out the updates was a PITA since a number of them kept failing. Download was slow (microsoft's servers pretty awful -- maybe they should switch to linux or bsd?) and installation takes forever. In the end I had to download SP1 and SP2 manually from the 'service pack center' and install them.

And LINUX is the one they call difficult? Good riddance.


Installing Debian:
While jigdo has worked well for me in the past, I was lazy and simply downloaded an iso. Because of university restrictions I could not use bit torrent.

wget http://cdimage.debian.org/debian-cd/7.0.0/amd64/iso-cd/debian-7.0.0-amd64-CD-1.iso
sudo burn -I -n debian-7.0.0-amd64-CD-1.iso

I popped the CD in the drive, and booted. Manual partition: 100 Gb for / (primary), 200 Gb for /home (logical) and 2 Gb for swap (logical). I used a local network mirror to install.

I installed the GRUB boot-loader to the MBR

Note that only Vista shows up in grub -- if you select Vista in GRUB, you get the Vista boot manager ('loader'), and can select 'Earlier versions of Windows' i.e. XP.

On booting into Debian the full GNOME 3 experience was available i.e. the nouveau driver for GeForce 210 is apparently good enough that we don't need to install the nvidia drivers. glxgears looks really pretty too, with over 700 FPS. Sweet!

Anyway, that's it.

I expected it to be a bit trickier, but even Vista behaved itself and didn't throw a fit on debian being installed.


425. Briefly: Megapov

I want to use glow in a pov, and because of the number of objects it might be easier to use megapov than to add extra objects for each glowing one.

sudo mkdir /opt/megapov
sudo chown $USER:$USER /opt/megapov
wget http://megapov.inetart.net/packages/unix/megapov-1.2.1.tgz
tar xvf megapov-1.2.1.tgz
cd megapov-1.2.1/
./configure --prefix=/opt/megapov COMPILED_BY="me@here"
make
make install
cp /usr/share/povray/include/* /opt/megapov/share/megapov-1.2.1/include/

I chose make install instead of checkinstall since it was easier -- otherwise the ~/.megapov/1.2.1/povray.ini and povray.conf files weren't properly created (it wanted to put them in root).

19 May 2013

424. NWChem 6.3 on Debian Wheezy

Update 23 May 2013: The execution times are pretty much the same as for 6.1.1 with a new patch. I've updated the instructions below to incorporate this new patch (http://www.nwchem-sw.org/images/Iswtch.patch.gz)

Update 21 May 2013: The execution times can be improved considerably by setting
ARMCI_NETWORK=SOCKETS

They are still ca 30% longer than 6.1.1 though due to slower SCF convergence. See http://www.nwchem-sw.org/index.php/Special:AWCforum/st/id834/Nwchem_6.3_running_2-5_times_slo....html

Update 20 May 2013: I did a bit of basic benchmarking. NWChem 6.3 is incredibly slow (ca 190s vs 40s for the 8 core, 3.6 GHz benchmark in http://verahill.blogspot.com.au/2013/05/414-frequency-vs-cores-crude.html). It's parallellising properly from what I can see (i.e. it is not running 8 serial jobs). I've repeated the calc with an unpatched version of nwchem 6.3, and it is just as slow.
 I'll post updates here if I figure this one out.

Original post:
NWChem 6.3 is just out. Here's how to build it for CPU computations.

To build on CentOS 5.6, see http://verahill.blogspot.com.au/2013/05/421-nwchem-63-on-rocks-543centos-56.html


Math library:
Use either openblas (for intel or AMD) or ACML (for AMD).

My GabEdit/Python NWChem patch
This is NOT the patch alluded to in the 23 May update and is optional. It enables python support, and makes the output more verbose so that gabedit can be used as an alternative to ECCE. Hence, it is required if, but only if, you want to enable python and to be able to use GabEdit to open output files.

First create a patch file, e.g. diff.patch.

diff -rupN src.original/config/makefile.h src/config/makefile.h
--- src.original/config/makefile.h 2013-04-15 12:41:45.016853322 +1000
+++ src/config/makefile.h 2013-04-15 12:38:44.933319544 +1000
@@ -2039,7 +2039,7 @@ endif
 
      ifeq ($(BUILDING_PYTHON),python)
 #   EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl
-     EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl
+     EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl -lssl -lz
   LDOPTIONS = -Wl,--export-dynamic 
      endif
 ifeq ($(NWCHEM_TARGET),CATAMOUNT)
diff -rupN src.original/ddscf/movecs_pr_anal.F src/ddscf/movecs_pr_anal.F
--- src.original/ddscf/movecs_pr_anal.F 2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/movecs_pr_anal.F 2013-04-15 12:23:28.100409225 +1000
@@ -195,7 +195,7 @@ c
  22         format(1x,2('  Bfn.  Coefficient  Atom+Function  ',5x))
             write(LuOut,23)
  23         format(1x,2(' ----- ------------  ---------------',5x))
-            do klo = 0, min(n-1,9), 2
+            do klo = 0, min(n-1,199), 2
                khi = min(klo+1,n-1)
                write(LuOut,2) (
      $              int_mb(k_list+k)+1, 
diff -rupN src.original/ddscf/rohf.F src/ddscf/rohf.F
--- src.original/ddscf/rohf.F 2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/rohf.F 2013-04-15 12:23:28.100409225 +1000
@@ -153,7 +153,7 @@ c
             ilo = 1
             ihi = nmo
          endif
-         call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs, 
+         call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs, 
      $        'ROHF Final Molecular Orbital Analysis', 
      $        .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      $        .true., dbl_mb(k_occ))
diff -rupN src.original/ddscf/scf_vec_guess.F src/ddscf/scf_vec_guess.F
--- src.original/ddscf/scf_vec_guess.F 2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/scf_vec_guess.F 2013-04-15 12:23:28.100409225 +1000
@@ -511,19 +511,19 @@ c
          nprint = min(nclosed+nopen+30,nmo)
          if (scftype.eq.'RHF' .or. scftype.eq.'ROHF') then
             call movecs_print_anal(basis, 1,
-     &           nprint, 0.15d0, g_movecs, 
+     &           nprint, 0.01d0, g_movecs, 
      &           'ROHF Initial Molecular Orbital Analysis', 
      &           .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      &           .true., dbl_mb(k_occ))
          else
             nprint = min(nalpha+20,nmo)
             call movecs_print_anal(basis, max(1,nbeta-20),
-     &           nprint, 0.15d0, g_movecs, 
+     &           nprint, 0.01d0, g_movecs, 
      &           'UHF Initial Alpha Molecular Orbital Analysis', 
      &           .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      &           .true., dbl_mb(k_occ))
             call movecs_print_anal(basis, max(1,nbeta-20),
-     &           nprint, 0.15d0, g_movecs(2), 
+     &           nprint, 0.01d0, g_movecs(2), 
      &           'UHF Initial Beta Molecular Orbital Analysis', 
      &           .true., dbl_mb(k_eval+nbf), oadapt, int_mb(k_irs+nmo),
      &           .true., dbl_mb(k_occ+nbf))
diff -rupN src.original/ddscf/uhf.F src/ddscf/uhf.F
--- src.original/ddscf/uhf.F 2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/uhf.F 2013-04-15 12:23:28.096409414 +1000
@@ -144,11 +144,11 @@ C
          enddo
          ihi = max(ihi-1,1)
  9611    continue
-         call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs, 
+         call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs, 
      $        'UHF Final Alpha Molecular Orbital Analysis', 
      $        .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      $        .true., dbl_mb(k_occ))
-         call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs(2), 
+         call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs(2), 
      $        'UHF Final Beta Molecular Orbital Analysis', 
      $        .true., dbl_mb(k_eval+nbf), oadapt, int_mb(k_irs+nmo),
      $        .true., dbl_mb(k_occ+nbf))
diff -rupN src.original/mcscf/mcscf.F src/mcscf/mcscf.F
--- src.original/mcscf/mcscf.F 2013-04-15 12:41:45.000854073 +1000
+++ src/mcscf/mcscf.F 2013-04-15 12:23:23.748613695 +1000
@@ -719,7 +719,7 @@ c
       if (util_print('final vectors analysis', print_default))
      $     call movecs_print_anal(basis, 
      $     max(1,nclosed-10), min(nbf,nclosed+nact+10),
-     $     0.15d0, g_movecs, 'Analysis of MCSCF natural orbitals',
+     $     0.01d0, g_movecs, 'Analysis of MCSCF natural orbitals',
      $     .true., dbl_mb(k_evals), .true., int_mb(k_sym), 
      $     .true., dbl_mb(k_occ))
 c     
diff -rupN src.original/nwdft/scf_dft/dft_mxspin_ovlp.F src/nwdft/scf_dft/dft_mxspin_ovlp.F
--- src.original/nwdft/scf_dft/dft_mxspin_ovlp.F 2013-04-15 12:41:45.604825677 +1000
+++ src/nwdft/scf_dft/dft_mxspin_ovlp.F 2013-04-15 12:23:28.228403211 +1000
@@ -184,14 +184,14 @@ c
       call ga_sync()
 c
       call movecs_print_anal(basis,int_mb(k_non),int_mb(k_non)
-     & ,0.15d0,g_alpha,'Alpha Orbitals without Beta Partners',
+     & ,0.01d0,g_alpha,'Alpha Orbitals without Beta Partners',
      &   .false., 0.0 ,.false., 0 , .false., 0 )
 c
       if (nct.GE.2) then
       do i = 2,nct
       ind = int_mb(k_non+i-1)
       call movecs_print_anal(basis,ind,ind
-     & ,0.15d0,g_alpha,' ',
+     & ,0.01d0,g_alpha,' ',
      &   .false., 0.0 ,.false., 0 , .false., 0 )
       enddo
       endif
@@ -350,7 +350,7 @@ c      endif
 c      endif
 c 9990 format(/,18x,'THERE ARE',i3,1x,'UN-PARTNERED ALPHA ORBITALS')
 c
-       call movecs_print_anal(basis, 1, nalp, 0.15d0, g_ualpha,
+       call movecs_print_anal(basis, 1, nalp, 0.01d0, g_ualpha,
      & 'Alpha Orb. w/o Beta Partners (after maxim. alpha/beta overlap)',
      &   .false., 0.0 ,.false., 0 , .false., 0 )
 c
diff -rupN src.original/nwdft/scf_dft/dft_scf.F src/nwdft/scf_dft/dft_scf.F
--- src.original/nwdft/scf_dft/dft_scf.F 2013-04-15 12:41:45.608825490 +1000
+++ src/nwdft/scf_dft/dft_scf.F 2013-04-15 12:23:28.228403211 +1000
@@ -1774,7 +1774,7 @@ c
             else
                blob='DFT Final Beta Molecular Orbital Analysis' 
             endif
-            call movecs_print_anal(ao_bas_han, ilo, ihi, 0.15d0, 
+            call movecs_print_anal(ao_bas_han, ilo, ihi, 0.01d0, 
      &           g_movecs(ispin), 
      &           blob, 
      &           .true., dbl_mb(k_eval(ispin)), oadapt, 
diff -rupN src.original/nwdft/scf_dft_cg/dft_cg_solve.F src/nwdft/scf_dft_cg/dft_cg_solve.F
--- src.original/nwdft/scf_dft_cg/dft_cg_solve.F 2013-04-15 12:41:45.612825303 +1000
+++ src/nwdft/scf_dft_cg/dft_cg_solve.F 2013-04-15 12:23:28.220403588 +1000
@@ -183,7 +183,7 @@ c
             blob = 'DFT Final Beta Molecular Orbital Analysis'
           endif
           call movecs_fix_phase(g_movecs(ispin))
-          call movecs_print_anal(basis, ilo, ihi, 0.15d0,
+          call movecs_print_anal(basis, ilo, ihi, 0.01d0,
      &         g_movecs(ispin),blob,
      &         .true., dbl_mb(k_eval+(ispin-1)*nbf),
      &         oadapt, int_mb(k_irs+(ispin-1)*nbf),


Compile NWChem
This examples uses the ACML libs. See e.g. this post for openblas settings.

sudo apt-get install build-essential gfortran python2.7-dev libopenmpi-dev openmpi-bin
sudo mkdir /opt/nwchem
sudo chown $USER:$USER /opt/nwchem
cd /opt/nwchem/
wget http://www.nwchem-sw.org/download.php?f=Nwchem-6.3-src.2013-05-17.tar.gz
mv download.php\?f\=Nwchem-6.3-src.2013-05-17.tar.gz Nwchem-6.3-src.2013-05-17.tar.gz
tar xvf Nwchem-6.3-src.2013-05-17.tar.gz
cd nwchem-6.3-src.2013-05-17/
patch -p0 < diff.patch
patching file src/config/makefile.h patching file src/ddscf/movecs_pr_anal.F patching file src/ddscf/rohf.F patching file src/ddscf/scf_vec_guess.F patching file src/ddscf/uhf.F patching file src/mcscf/mcscf.F patching file src/nwdft/scf_dft/dft_mxspin_ovlp.F patching file src/nwdft/scf_dft/dft_scf.F patching file src/nwdft/scf_dft_cg/dft_cg_solve.F
cd src/ wget http://www.nwchem-sw.org/images/Iswtch.patch.gz gzip -d Iswtch.patch patch -p0 < Iswtch.patch cd ../ 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/acml/acml5.3.1/gfortran64_int64/lib -lacml" export USE_MPI=y export USE_MPIF=y export USE_MPIF4=y export MPI_LOC=/usr/lib/openmpi/lib export MPI_INCLUDE=/usr/lib/openmpi/include export LIBRARY_PATH="$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/acml/acml5.3.1/gfortran64_int64/lib" export LIBMPI="-lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread" export ARMCI_NETWORK=SOCKETS cd $NWCHEM_TOP/src make clean make nwchem_config make FC=gfortran 1> make.log 2>make.err cd $NWCHEM_TOP/contrib export FC=gfortran ./getmem.nwchem


Settings
Create /opt/nwchem/default.nwchemrc
nwchem_basis_library /opt/nwchem/nwchem-6.3-src.2013-05-17/src/basis/libraries/ ffield amber amber_1 /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/amber_s/ amber_2 /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/amber_x/ amber_3 /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/amber_q/ amber_4 /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/amber_u/ amber_5 /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/custom/ spce /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/solvents/spce.rst charmm_s /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/charmm_s/ charmm_x /opt/nwchem/nwchem-6.3-src.2013-05-17/src/data/charmm_x/

Symmlink to this file in each user's home:
ln -s /opt/nwchem/default.nwchemrc ~/.nwchemrc