Skip to content
Justus Calvin edited this page May 23, 2014 · 6 revisions

Madness on a Mac Build MADNESS on Mac OS X

Table of Contents

Software

Required

  • Apple Xcode 3.2 or later
  • MPI-2
  • BLAS and LAPACK (vecLib included with OS X), or Eigen 3
  • GNU Autotools
    • autoconf 2.59 or later
    • automake 1.11 or later
  • Subversion

Recommended

  • MacPorts

Optional

  • Gperftools (formally Google Perftools)
  • Google Test
  • Doxygen
If you have all of the above software installed, you can skip ahead to the “MADNESS installation” section.

Installing Xcode

Lion and later

  1. Open Mac App Store
  2. Search for and “Buy” Xcode (it is free). Xcode will automatically start downloading and install itself.
  3. Open Xcode
  4. Go to Xcode->Preferences...
  5. Select the Downloads and then the components tab
  6. Click “Install” next to “Command Line Tools”
  7. Check the “Check for and install updates automatically” box
Note: Command-line tools are automatically installed with Xcode 4.2.x and earlier.

Xcode Alternative for Lion and later

If you do not want to install Xcode, you may install just Apple's Command-Line Tools package (the same package you would install in Xcode 4.3.x). You can download it from the Apple Developer website. The only disadvantage to this method is you must update this software manually.

Snow Leopard and earlier

  1. Download Xcode 3.2.6 for Snow Leopard or 3.1.4 for Leopard from Apple’s Developer website. You will need to log in with your Apple ID.
  2. Open the .dmg file
  3. Double click install package
  4. Follow the prompts

Environment Variables

Add the following lines to .profile in your home directory using vi.

  $ vi ~/.profile
  • Xcode 4.1 for Lion, and later
export MACOSX_DEPLOYMENT_TARGET=10.7
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
  • Xcode 3.x, 4.0, and 4.1 for Snow Leopard
export MACOSX_DEPLOYMENT_TARGET=10.6
export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2

Note: You will need to restart terminal for the change to take effect.

Building MPI-2

You may choose either MPICH2 or OpenMPI, both will work equally well on your Mac. You do *NOT* need to install both.

Note: Older versions of Xcode included OpenMPI, but it does not work correctly with MADNESS.

Note: In the following instructions you may need to modify the paths and file names to reference the latest version.

MPICH2

Download and extract source files

$ cd /tmp
$ mkdir mpich2
$ cd mpich2
$ mkdir build
$ curl -C - -O http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz
$ tar -xf ./mpich2-1.4.1p1.tar.gz
$ cd build

Set environment variables

unset F90
unset F90FLAGS

Configure and Build

$ ../mpich2-1.4.1p1/configure \
--prefix=/opt/mpich2 \
--with-thread-package=posix \
--enable-timer-type=mach_absolute_time \
--enable-cxx \
--disable-f77 \
--disable-fc \
--with-mpe \
--with-device=ch3:nemesis \
--with-pm=hydra \
--enable-shared \
--enable-cache \
--enable-smpcoll \
--enable-base-cache
$ make -j
$ sudo make install

Update your shell initialization script

Add the following lines to your ~/.profile

export PATH="$PATH:/opt/mpich2/bin"
export MANPATH="$MANPATH:/opt/mpich2/share/man"
export MPICC=/opt/mpich2/bin/mpicc
export MPICXX=/opt/mpich2/bin/mpicxx
export MPICH_CC="$CC"
export MPICH_CXX="$CXX"

OpenMPI

Download and extract source

$ cd /tmp
$ mkdir openmpi
$ cd openmpi
$ mkdir build
$ curl -C - -O http://www.open-mpi.org/software/ompi/v1.5/downloads/openmpi-1.5.5.tar.bz2
$ tar -xf ./openmpi-1.5.5.tar.bz2
$ cd build

Configure and Build

$ ../openmpi-1.5.5/configure \
--prefix=/opt/openmpi \
--enable-silent-rules \
--enable-mpi-thread-multiple \
--disable-mpi-f77 \
--disable-mpi-f90
$ make -j
$ sudo make install

Update your shell initialization script

Add the following lines to your ~/.profile file:

export PATH="$PATH:/opt/openmpi/bin"
export MANPATH="$MANPATH:/opt/openmpi/share/man"
export MPICC=/opt/openmpi/bin/mpicc
export MPICXX=/opt/openmpi/bin/mpicxx
export OMPI_CC="$CC"
export OMPI_CXX="$CXX"

MacPorts

MacPorts is a command-line tool that automates the process of downloading, configuring, installing, and updating open-source software in OS X. Most of the software required by MADNESS is available through MacPorts. To install MacPorts:

  1. Download the install package from: http://www.macports.org/
  2. Open the downloaded .dmg file.
  3. Double click the install package
  4. Follow the prompts
  5. Once MacPorts is installed, in terminal run:
$ sudo port selfupdate

Note: If you are behind a firewall or proxy and having trouble syncing portfiles, you can use the alternate download method described here https://trac.macports.org/wiki/howto/PortTreeTarball.

You can install the remaining software need by MADNESS with MacPorts.

$ sudo port install autoconf automake libtool google-test subversion eigen3 doxygen
  • Note:* Older versions of Xcode included autoconf and automake, but they are very old and do not work correctly with MADNESS.
  • Note:* Gperftools 2.0 does not work correctly on OS X. If you want/need Google Perftools, 1.7 is partially functional. You will need to build it from source. Unless you intend to use the it for profiling purposes, you should not install or use Google Perftools.

MADNESS Installation

Download

In Terminal:

$ mkdir madness
$ cd madness
$ svn  checkout  https://m-a-d-n-e-s-s.googlecode.com/svn/local/trunk src
$ cd src
$ aclocal
$ autoconf
$ autoheader
$ automake
$ cd ..

Configure

$ mkdir build
$ cd build

The configure commands below assume that Google Perftools and Google Test were installed in /opt/local with MacPorts. You need to change the paths for `--with-google-test` to the install paths for these packages. If you did not install one or both of these packages, you need to remove the corresponding options.

Lion and later

$ ../src/configure \
--enable-debugging \
--disable-optimization \
--enable-warning \
--disable-optimal \
--with-google-test=/opt/local \
CPPFLAGS="-ansi" \
LDFLAGS="-framework Accelerate -Wl,-no_pie"

Snow Leopard and earlier

$ ../src/configure \
--enable-debugging \
--disable-optimization \
--enable-warning \
--disable-optimal \
--with-google-test=/opt/local \
CPPFLAGS="-ansi" \
LDFLAGS="-framework Accelerate"

Build

$ make -j

Information about Compiler

The following compiles have been tested with MADNESS on OS X and are known to work.

  • Apple's GCC 4.2.1
  • Apple's LLVM GCC 4.2.1
  • Apple's Clang 2.0 (svn 2.9) and later -- Preferred
  • LLVM Clang 2.9 and later (same as Apple's version)
  • Intel 11.x and 12.x
Note: Do not use GNU GCC compilers that you build yourself or those provided by MacPorts. They have significant compatibility issues on Macs and may result in strange runtime behavior.
Clone this wiki locally