GROMACS 4.5.5, OpenMPI 1.6, And FFTW 3.3.2 Compilation Under Mountain Lion (OSX 10.8) With XCode (And A Little Help From Homebrew)

Minus a few glitches easily fixed with the right software, this build wasn't bad at all (and thanks to Adam Lindsay for the title catch).

Now sitting in front of a new Core i7 MacBook Pro, one of the first compilations I wanted to have finished for new projects was GROMACS 4.5.5. As my procedure for compiling GROMACS 3.3.3 had been a highly-traveled page, I wanted to provide a brief summary of my successful 4.5.5 compilation.

A Few Piece Of Info

1. XCode

This used to be disc-download and install, now it's available as a free download from the App Store (1.57 GB download, so plan to do something else while you wait for the download).

2. Homebrew

Having Homebrew installed in Mountain Lion made the installation of FFTW easy and OpenMPI trivial once gfortran was equally trivially installed. Therefore, to make your life easier, I can't recommend a Homebrew installation enough. For additional install tweaks, I followed the following page: gist.github.com/1860902

Installation Procedure

1. Download gromacs 4.5.5

…and place it in your home folder (will go to Downloads most likely, drag it to your home folder for ease of building).

2. Extract into your home holder

…with a double-click, making ~/gromacs-4.5.5.

3. brew install fftw

With the install of Homebrew, you'll simply run the following from a terminal window and produce the following output:

brew install fftw

==> Downloading http://www.fftw.org/fftw-3.3.2.tar.gz
######################################################################## 100.0%
==> ./configure --enable-single --enable-sse --enable-shared --disable-debug 
--prefix=/usr/local/Cellar/fftw/3.3.2 --enable-threads --disable-fortran
==> make install
==> make clean
==> ./configure --enable-sse2 --enable-shared --disable-debug 
--prefix=/usr/local/Cellar/fftw/3.3.2 --enable-threads --disable-fortran
==> make install
==> make clean
==> ./configure --enable-long-double --enable-shared --disable-debug 
--prefix=/usr/local/Cellar/fftw/3.3.2 --enable-threads --disable-fortran
==> make install
/usr/local/Cellar/fftw/3.3.2: 34 files, 13M, built in 2.7 minutes

4. brew install gfortran

If you don't install gfortran FIRST and try to install OpenMPI, you'll get the following error in Homebrew:

==> Downloading http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.tar.bz2
######################################################################## 100.0%
Error: This formula requires a fortran compiler, but we could not find one by
looking at the FC environment variable or searching your PATH for `gfortran`.
Please take one of the following actions:

  - Decide to use the build of gfortran 4.2.x provided by Homebrew using
        `brew install gfortran`

  - Choose another Fortran compiler by setting the FC environment variable:
        export FC=/path/to/some/fortran/compiler
    Using an alternative compiler may produce more efficient code, but we will
    not be able to provide support for build errors.

So don't. Installing gfortran will produce the following:

brew install gfortran

==> Downloading http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg
######################################################################## 100.0%
==> Installing gfortran 4.2.4 for XCode 4.2 (build 5666) or higher
==> Caveats
Brews that require a Fortran compiler should not use:
  depends_on 'gfortran'

The preferred method of declaring Fortran support is to use:
  def install
    ...
    ENV.fortran
    ...
  end

==> Summary
/usr/local/Cellar/gfortran/4.2.4-5666.3: 86 files, 72M, built in 39 seconds

5. brew install openmpi

This is what allows you to use all cores on your machine and is not in the default XCode install.

brew install openmpi

==> Downloading http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.tar.bz2
Already downloaded: /Library/Caches/Homebrew/open-mpi-1.6.tar.bz2
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.

==> ./configure --prefix=/usr/local/Cellar/open-mpi/1.6 --enable-ipv6
==> make all
==> make install
/usr/local/Cellar/open-mpi/1.6: 674 files, 21M, built in 5.9 minutes

6. cd gromacs-4.5.5

7. ./configure –enable-float –enable-mpi

You'll produce output such as found in: 2012august29_gromacs455_configure.txt

You'll also get two odd errors at the end of the ./configure run that do not affect the rest of the procedure:

./configure --enable-float --enable-mpi

...
./configure: line 29242: sort: No such file or directory
./configure: line 29239: sed: No such file or directory

So ignore them.

NOTE: If you've been going by my 3.3.3 procedure and used…

./configure --enable-mpi --enable-double

You'll get the following error when you try to run make:

Making all in include
Making all in .
make[2]: Nothing to be done for `all-am'.
Making all in types
make[2]: Nothing to be done for `all'.

...

/bin/sh http://www.somewhereville.com/libtool --tag=CC   --mode=compile mpicc -DHAVE_CONFIG_H -I. -Ihttp://www.somewhereville.com/src -I/usr/include/libxml2 -Ihttp://www.somewhereville.com/include -DGMXLIBDIR=\"/usr/local/gromacs/share/top\"   -O3 -fomit-frame-pointer -finline-functions -Wall -Wno-unused -msse2 -funroll-all-loops -std=gnu99 -MT genborn_sse2_double.lo -MD -MP -MF .deps/genborn_sse2_double.Tpo -c -o genborn_sse2_double.lo genborn_sse2_double.c
 mpicc -DHAVE_CONFIG_H -I. -Ihttp://www.somewhereville.com/src -I/usr/include/libxml2 -Ihttp://www.somewhereville.com/include -DGMXLIBDIR=\"/usr/local/gromacs/share/top\" -O3 -fomit-frame-pointer -finline-functions -Wall -Wno-unused -msse2 -funroll-all-loops -std=gnu99 -MT genborn_sse2_double.lo -MD -MP -MF .deps/genborn_sse2_double.Tpo -c genborn_sse2_double.c  -fno-common -DPIC -o .libs/genborn_sse2_double.o
genborn_sse2_double.c:931: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
make[3]: *** [genborn_sse2_double.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

So don't do that, either. The proper flag is the enable-float.

8. make

This will produce the output available for download at: 2012august29_gromacs455_make.txt

9. make install

This will produce the output available for download at: 2012august29_gromacs455_make_install.txt

10. make links

This will produce the short piece of output reproduced below.

cd /usr/local/gromacs/bin && programs=`ls` && cd /usr/local/bin && \
	for i in $programs; do \
	   (test ! -f $i && ln -s /usr/local/gromacs/bin/$i . ; exit 0); \
	done

And with that, you should be able to run all programs from a terminal window.

chown/chmod Your Way To A Backup Free Of The MemeodHelper Error in OSX 10.6.x (Snow Leopard) & A Seagate Vs. Western Digital Experience

UPDATE – 29 September 2010: In my usual policy of *nix-based deference to anything Perry Metzger has to say (other areas, too, but specifically here), I note that my procedure has the potential to mangle whatever is using Memeo (although I've not had anything go bump in the night yet). For those less than interested in the surgery below, your most safest bet is to crack open a Terminal window and sudo cp -R /Users/[you] /Volumes/[Your Backup Drive] (assuming you've activated the root password in OS X, of course). That is all.

There isn't too much of this online so I thought I'd provide my fix. As background, I like the idea of having constant capsules of my MacBook Pro (MBP) sitting on a Time Capsule drive, but I am constantly up-and-running with my MBP and am rarely sitting in front of a machine long enough to let full writes be written to some backup drive (and, as any quantum chemist worth their salt is generating scores of files on an hourly basis, my laptop is constantly undergoing changes). Long story short – I want to spend one hour at my choosing to turn off wireless, close all my open programs, copy my User directory, and paste it onto an external drive. That's it.

Finally upgrading to 10.6.4 (by way of a new 13.3"), my first attempt to backup the first clean copy of the complete migration from my old 15" went all of 20 minutes before the following error popped up on my screen:

The operation can't be completed because you don't have permission to access "MemeodHelper."

There is ONE other mention of this issue and it's present on the Apple Support forum at:

discussions.apple.com/thread.jspa?messageID=11237019&tstart=0

I guess the two of us are the oddballs for not sticking to the OSX program suite.

The solution is to simply change the permissions so that you, the user, DOES have access to read + write this file. I tried a Right Click – Get Info – Sharing & Permissions fix only to discover I DID have Read & Write access. Clearly, I am not the owner of this file. Taking the next proper step…

Applications -> Utilities -> Terminal

cd ~/Library/Application\ Support/Memeo
ls -al

…we see that the permissions set for the MemeodHelper file are as follows:

-r-sr-xr-x

r = read
x = execute
s = domain socket

And that the owner is root (not you). The ownership problem explains the inability to read + write this file. And, I have never seen an "s" in all my days digging around in Terminal (had to look it up to see what it meant. Hail Wikipedia).

This "s" and the missing "w" for you, the user, is the problem. The solution is to allow you (the user) to write and execute this file, which I have chosen to do by simply changing the user ownership and the permissions. The steps are as follows (userid = the userid that shows up for the ".." and "." (shown above this file with an ls -al)):

sudo chown userid MemeodHelper

It will ask for a password – your user password will do.

chmod u+wrx MemeodHelper

This changes the ownership permissions for MemeodHelper.

That's it. You should now be able to copy + paste your User directory (HOME) to another drive. By Firewire 800, I'm copying 220 GB in about 56 minutes, which I cannot complain about. To date (after a week), I've had no machine issues with my change to MemeodHelper and have found no other people having complaints. If you discover something, by all means say something.

And, to continue to discussion, I had the most miserable experience migrating from Seagate FreeAgent USB 2.0 drives used with a Windows XP backup machine to the point that I bought and returned them over 24 hours, with these drives unable to reliably write files larger than 500 MB (and one of the two I bought for my global backup would spontaneously unmount itself. Not cool).

My solution was to spend extra money and pick up Western Digital 2 TB My Book Studio LX (for Mac) USB 2.0/Firewire 800 external drives (and I am using them as Firewire devices). I am presently very happy with this setup.