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.

Friday 29 February 2008

Auto-vectorising C++ and Fortran compilers

This page is a good source of informations for High Performance Computing under Mac OS X. The link provides you with binary packages for the GNU C++, C and Fortran compilers for Leopard. The installation is very clean and goes entirely under /usr/local. These compilers allow auto-vectorisation.

On goofy I've installed XCode and Developer Tools, which install their own compilers. Therefore I have placed the GNU auto-vectorised compilers under /user/local, but I haven't included them in the path, as other users may want to use their own favourite compilers. If you want to use the GNU auto-vectorised ones, modify your .profile.

Important: these compilers do not activate objective C. Therefore, if you try to compile something with the -ObjC flag they would return you an error. When you need the -ObjC flag you can use the default Leopard's GCC compilers. 

Ubuntu Linux under Parallels

Parallels is a non-free virtualisation software that allows you to run Windows or Linux under Mac OS X: I'm not talking about dual booting (i.e. a side by side installation, with you deciding which OS you want to load at boot time). What happens here is that you actually run the guest OS at almost native speed in a window of your Mac. Furthermore, you have facilities like copying/pasting from one OS to another, or synchronising folders and so on. Really good if you want to take the best of both worlds (Mac OS and Ubuntu Linux, in my case). 

Installing Parallels is really easy from the installation cd.

Installing Ubuntu 7.10 as a guest OS is not hard. Follow this how-to from Parallels support forum.

Caveats:
  • In my case, I had to select Bridged Ethernet to get an internet connection under Ubuntu (this is something you can change easily once the installation is done: stop the Ubuntu Linux virtualisation and then go to Edit>Virtual Machine and set Network Adapter to be Bridget Ethernet)
  • Don't forget to upgrade to the latest Parallels version and to install the Parallels Tools
  • Copy/Paste and Sinchronisation work well if the guest OS is Windows. It will be supported soon for Ubuntu Linux. 
Update: I've been in contact with one of Parallels developers. First of all, he pointed me to this summary of Parallels Tools for Linux. Second he told that Parallel Tools is not yet compatible with Ubuntu 7.0.4. It's expected to be soon compatible.

BibDesk: LaTeX bibliographic reference manager

BibDesk is a bibliographic reference manager for Mac OS X. BibDesk is designed to help organize and use bibliographic databases in BibTeX .bib format. In addition to manual typing, BibDesk lets you drag/drop or cut/paste .bib files into the bibliographic database and automatically opens files downloaded from PubMed. BibDesk also keeps track of electronic copies of literature on your computer and allows for searching your database through several keys. Easy installation from universal binaries

MacVim

If you are a vim user, MacVim is all you have ever desired. Mac OS X ships already with its own vim, to be called from the Terminal. MacVim is a port Mac OS X that is meant to look better and integrate more seamlessly with the Mac than the existing Carbon port of Vim. Use it and support it. It comes with a universal binary and a UNIX script. Please read this post to change the paths according to the new Leopard paradigm.

On goofy:
  • unix command under /usr/local/macvim/bin
  • path updated in the file /etc/paths.d/Macvim/etc/

Paraview

Paraview is a great free tool to visualise large data files. It works well for parallel applications and it has a very good server/client interface: the large data can be processed remotely on a server, and the client will only take care of the visualisation. 

It is installed easily, being a universal binary. If you want the server/client facility, you will also install the unix commands provided. Please read this post to change the paths according to the new Leopard paradigm.

On goofy:
  •  unix commands under /usr/local/paraview/paraview-3.2.1-Darwin-i386
  • path updated in the file /etc/paths.d/Paraview

Modifying PATH in Leopard

Apple has (regrettably, in my opinion) changed the way to modify the bash PATH variable system-wide. The old way was to carefully edit the file /etc/profile. The new way is quite different. Suppose you have the application MyNewApplication in /usr/local and want to include the directory /usr/local/MyNewApplication/bin in the PATH. Then what you do is
  • Go to directory /etc/paths.d (yes, that's a directory) and create a file called MyNewApplication
  • Edit the file MyNewApplication with the directory you want to include, i. e. /usr/local/MyNewApplication/bin. If you want to include more than one path of MyNewApplication, then add more lines (one line per path)
  • Restart the Terminal
I don't agree with this approach which breaks a standard UNIX feature. This is most likely to be the reason why LaTeXiT is having troubles.

OpenTerminal

OpenTerminal allows you to quickly access a Terminal from Finder. The Terminal opens directly in the folder you're browsing with Finder. I find it very handy. There must be other software out there doing the same task (even better, maybe). Let me know if you recall any.

Cyberduck: FTP client

Cyberduck lets you download files from FTP servers. It's quite handy and polished. Painless installation. 

LaTeXiT: create latex formulae to drag and drop

LaTeXiT is a fantastic application: it allows you to input a LaTeX formula, compile it with a single click, and obtain an image that you can drag and drop pretty much everywhere (an existing LaTeX presentation or a plot for instance).
Important: LaTeXit is not yet packaged for Leopard. If you are a Leopard user, then do not install LaTeXiT 1.14.4, but go for LaTeXiT 1.14.3 instead. More about it later.
Update: LaTeXit 1.15.0 has just been released. This version is Leopard-compatible (thanks Bjorn Sandstede).

Skype

Skype seems to work fine on the external network. 

Guest account

I have setup a guest account, that is you can switch on my machine at any time and login with no password. This account allows you to run practically all the applications that are on goofy (my machine's name). The bad news is that you can not access this account remotely (let me know if you need it, I'll work it out for you) and you can not install programs on this account. The great news is that you can access this account at any time (and please feel free to do so). Here is how:
  • If I am not there and goofy is switched off: switch it on and login as a guest. It's enough you click on the guest icon
  • If I am not there and goofy is switched on: go on the menu, top right corner and click on the shaded man. You'll be prompted in another desktop, and whatever I was doing will keep running on the background (no harm for me, then). 
  • If I am there, just come and ask, it takes a second to switch user.
Why this is useful: you may want to use some software that is on goofy but not on your machine, or you may need goofy to be switched on. Just help yourself. A few caveats
  • You can temporarily store files in a guest account, but they will be deleted when you logout
  • My keyboard is Italian (experience the pain I go through every time I sit on a computer with a differently mapped keyboard...)

Thursday 28 February 2008

Installing XCode and Developer Tools

Go to the Apple Developer Connection Website and activate an AppleID if you haven't already done so (when you register for Apple Protection Plan for instance). Go to Download and then, on the right hand side select Developer Tools. Download XCode 3.0 (it's quite bulky) and install it with a few mouse clicks. Among the proposed packages, double click on XcodeTools.mpkg.

Pdf viewer and note taker: Skim

Beside Preview, the standard pdf viewer, I've installed Skim: it allows you to write notes on the pdf. Useful while correcting a LaTeX paper when the source is not available. Skim supports pdfsync (i.e. you will be able to jump from the source .tex file to the corresponding line on the pdf and the other way round)

Configuring a CUPS printer

Update: the howto described below could be valid only for Leopard users. For Tiger users, I have made available my printer online, therefore you should be able to see it with a laptop and print using my settings. My printer is labelled HP LaserJet with Duplexer. If my machine is off, you can turn it on and login as a guest (see this post about the matter). Anyway, the best thing to do is to configure your own printer. This might be done from System Preferences>Print & Fax from which you could input the printer address and settings. If you succeed, please let me know. Also, people seems to have problems to printer under a VPN connection at ENM.

Setup our printer in Room 2.80 (other printers should work similarly)
  1. Open Safari and go to your local CUPS system at http://localhost:631/
  2. Click Add Printer (eventually input your Mac username and password)
  3. Name: DepartmentalPrinter (customise it as you like)
  4. Location: Room 2.80 (customise it as you like)
  5. Description: HP LaserJet with Duplexer (customise it as you like)
  6. Click Continue
  7. Device: Internet Printing Protocol http
  8. Click Continue
  9. Device URI: http://printsrv.enm.bris.ac.uk:631/classes/2.80
  10. Click Continue
  11. Make: HP
  12. Click Continue
  13. Model HP Color Laserjet 4650
  14. Click Continue
  15. Insert userame and password associated with your Mac
  16. Under Options Installed select Duplex Unit Installed
  17. Under General set Page Size to a4 and Paper Source to Tray 2
  18. Click Set Printer Options
  19. Done
For other CUPS printers you have to insert a different URI for the device (this is the CUPS address of your printer, ask your sytem administrator) and you may have to set different Make, Models, Printer Options.

I would be grateful if you reported me (un)successful installations.

Installing LaTeX

I strongly advice to install the MacTeX distribution. It installs nicely and it is exhaustive.

Configuring email

The settings found here seem to work fine.

Right click

Activate immediately the right click facility of the mouse. Under Preferences>Keyboard & Mouse>Mouse. On the right click menu select Secondary Button