Friday 7 March 2008

Gnuplot

Gnuplot is a very popular plotting utility. In order to have full support under Mac OSX, I encourage you to compile it from source. The thing is a bit tricky, as Leopard do not include a decent GNU readline for history support. I will report on how to configure Gnuplot to have the aquaterm, X11, png, jpeg, pdf terminals available, and to have GNU readline support (you need it to have tab completion and history facilities).
  • Install Aquaterm (a few mouse clicks)
  • From fink install the packages pdflib and gd2. This is done from a terminal with the commands fink install pdflib and fink install gd2. These packages contain png, jpeg and pdf libraries.
  • Install GNU readline. Some people adviced to delete Leopard's default readline and to substitute with GNU readline. I have rather installed GNU readline in /usr/local and instructed Gnuplot to link against it. Download readline from here and unpack it somewhere: before running configure, make and make install, you will have to patch one of the configure scripts. In the gnuplot folder search for the file support/shobj-conf and patch it following this. Patching is not hard, you can open support/shobj-conf and see that it looks similar to the patch file. Do you see those lines in the patch file that begin by "+" and "-"? Lines with "-" represent lines already existing in support/shobj-conf: you are going to go in support/shobj-conf and replace them with the corresponding "+" lines of the patch. Alternatively, you can use the unix patch command. At this point you can run configure, make and make install. Default installation is in /usr/local/lib.
  • Download Gnuplot source code and unpack it somewhere. In the Gnuplot directory run configure with ./configure CC=/usr/bin/gcc CFLAGS=-O3 CXX=/usr/bin/g++ --with-readline=/usr/local/lib LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/incl. The compilers flag are to make sure you are using Leopard's default compilers (I have installed this ones which create a conflict with Gnuplot in that they do not enable -ObjC flag by default). The LDFLAGS link to the readline directory, already pointed by the --with-readline flag. When the configuration script has run, make sure that aquaterm, png, jpg, pdf and GNU readline are all compiled correctly. Then you can run make and make install.
Update. Gnuplot can be easily installed, with all dependencies, using MacPorts. I strongly recommend to do this.

Installing Fink

Fink does not come with a binary package for Leopard, therefore one must install it from source. Thankfully, this is extremely easy. Everything can be done by following the Important Note for Leopard Users found here. The only caveat is: when running ./bootstrap, you will be asked to make some choices (it's quite a long process). In most cases, you have just to press Enter and accept the default option. The only place where I have overridden a default option was about activating unstable repositories. I'd advice to do so, as many important packages are still available only in those repos. Important things:
  1. Do not forget set your path in your .profile file. An automatic way to do that is to run the command /sw/bin/pathsetup.sh in a terminal. 
  2. Close the actual terminal and open a new one before running the final command fink selfupdate-rsync or fink selfupdate-cvs. 
  3. If you are behind a firewall you have to setup fink to work correctly. In my case, whenever I need to use fink, I connect via VPN at UoB

Monday 3 March 2008

VPN connection at UoB

If you have a UoB account and want to use Virtual Private Network authentication, these are the steps to follow
  • under System Preferences>Network click "+" to create a new connection.
  • Interface: VPN
  • VPN Type: PPTP
  • Service Name: whatever you like 
  • Configuration: Default
  • Server Address: staff-vpn.bris.ac.uk (it could be student-vpn.bris.ac.uk in your case)
  • Account Name: your UoB username
  • Select Show VPN status in menu bar
  • Under Advanced>Options, select Send all traffic over VPN connection (thanks Jon Ward for this essential tip!)
Now you will
  1. activate your wireless connection (Air Port) if you haven't already
  2. Click on the  icon and select Connection...
  3. Insert password
  4. You are online
Important: if you are Tiger user, the Send all traffic over VPN connection step should be unnecessary. You'll be probably presented with a different interface to create the connection, but the settings should be analogous (thanks Thomas Melvin and Jon Ward). 

Sunday 2 March 2008

MacFuse, SSHFS, MacFusion: mounting remote filesystems

These tools are great if you want to connect remotely to a server and mount locally a directory which lives on the server. In this way you can use all your local tools to edit/modify, copy/paste files: you'll be editing files on the server, but using local software. Install SSHFS and MacFuse and then MacFusion to manage your sshfs volumes from the desktop. Painless installation. One thing: if you want to see the mounted volumes appear on your desktop, do not forget to activate Show Connected Servers under Finder>Preferences>General.

Saturday 1 March 2008

Trilinos

Trilinos is a comprehensive set of libraries and solvers for parallel computation. The installation and configuration of Trilinos is not possible to cover here. On Trilinos website you will find adequate explanations as to how to install the packages. It makes sense, for other Trilinos users trying to install it under Mac OS X 10.5.2, to report here my configuration script

../configure \
--prefix=/usr/local/trilinos/trilinos-8.0.5/MAC_MPI/build \
--enable-mpi --with-mpi-compilers \
--cache-file=config.cache \
--enable-nox-lapack \
--enable-nox-epetra \
--enable-loca-lapack \
--enable-loca-epetra \
--enable-amesos \
--enable-anasazi \
--enable-aztecoo \
--enable-ifpack \
--enable-ml \
--enable-teuchos \
--enable-teuchos-complex \
--enable-triutils \
--enable-galeri \
--disable-examples \
--disable-tests \
CFLAGS="-O3 -ftree-vectorize" \
CXXFLAGS="-O3 -ftree-vectorize" \
FFLAGS="-O3 -ftree-vectorize" \
FLIBS="-Wl,-framework -Wl,vecLib -lSystem"


I have used these compilers and this MPI implementation. On goofy, you can link against Trilinos from the directory /usr/local/trilinos/trilinos-8.0.5/MAC_MPI/build.

OpenMPI

OpenMPI is an open source implementation of the Message Passage Interface protocol, which allows you to compile and run codes in parallel. OpenMPI is composed by a set of wrappers (mpic++, mpif77 etc.) to use in place of your favourite compilers and by scripts (mpirun, mpiexec, etc.) to launch the parallel job.

On goofy, I have used these GNU compilers and run
  • ./configure CC=/usr/local/bin/gcc CFLAGS='-O3 -ftree-vectorize' CXX=/usr/local/bin/g++ CXXFLAGS=' -O3 -ftree-vectorize' F77=/usr/local/bin/gfortran FFLAGS=' -O3 -ftree-vectorize' FC=/usr/local/bin/gfortran FCFLAGS=' -O3 -ftree-vectorize'
  • make all install
The compilation took quite a long time, but it worked. Please note that these wrappers are located in /usr/local/bin and you have to include them in your PATH (via changing the .profile). If you have already done so for the GNU compilers, you don't need to change anything, as /usr/local/bin is already in your path.