This page contains instructions for installing various scientific computing libraries
and software packages on Mac OS X with the IBM xlf compiler.

1) MPICH-2

2) PETSc

3) ARPACK

4) SLEPc

5) NCO

6) SUNDIALS

7) Python

Installing mpich-2

Download from here: http://www-unix.mcs.anl.gov/mpi/mpich2/

setenv FC /opt/ibmcmp/xlf/8.1/bin/xlf
setenv FFLAGS "-qextname -g"

tar -xvzf mpich2-1.0.2p1.tar.gz
cd mpich2-1.0.2p1
./configure -prefix=/usr/local/mpich2 --with-comm=shared | & tee configure.log
make | & tee make.log
sudo make install | & tee install.log

Note: to disable C++ bindings, configure with:
./configure -prefix=/usr/local/mpich2 --with-comm=shared --disable-cxx | & tee configure.log

This may be necessary when building the Common Component Architecture (CCA) package.

Installing PETSc

Download from here: http://www-unix.mcs.anl.gov/petsc/petsc-2/download/index.html

tar -xvzf petsc.tar.gz
cd petsc-2.3.0
setenv PETSC_DIR `pwd`
setenv PETSC_ARCH darwin-mpich-g
./config/configure.py --with-mpi-dir=/usr/local/mpich2 --with-shared=0
make all
make test

Note: to build a uniprocessor version
./config/configure.py --with-mpi=0 --with-shared=0
make all
make test

MATLAB Support:
Shared library support does not work on Mac OS X due to issues with dynamic libraries. Thus,
one cannot use the python bindings or compile the Matlab interface. It is however possible to compile
partial support for Matlab as follows:

1) cd $PETSC_DIR/src/sys/src/viewer/impls/socket/matlab
2) add the following lines to makefile:
    MATLAB_MEX = /usr/local/bin/mex    # or your path to the mex compiler
    MATLAB_CC = ${CC}
3) make

This will install several mex functions in $PETSC_DIR/bin/matlab that provide an interface to
the sockets library. (You must add this directory to your matlab path.) By using PETSc's sockets
functions (PetscViewerSocketOpen, etc) you can
use this interface to SEND data (Vecs, Mats, arrays)
from PETSc to a running Matlab process. You
can also use it to launch a PETSc job. See
$PETSC_DIR/src/dm/da/examples/tests/ex12* for an
example of how to use this facility. Note: As
written, ex12.c did not work for me. Add the lines:


#if defined(PETSC_USE_SOCKET_VIEWER)
    ierr = PetscViewerSocketOpen(PETSC_COMM_WORLD,PETSC_NULL,5005,&socketviewer);CHKERRQ(ierr);
#endif

just before the line:

  for (j=0; j<time_steps; j++) { 


ARPACK (for use with SLEPc)

Download the following files from here: http://www.caam.rice.edu/software/ARPACK/
zcat arpack96.tar.Z | tar -xvf -
zcat patch.tar.Z | tar -xvf -
zcat parpack96.tar.Z | tar -xvf -
zcat ppatch.tar.Z | tar -xvf -

cd ARPACK

Use 'ARMAKES/ARmake.MPI-SP2' as a template:
cp -p ARMAKES/ARmake.MPI-SP2 ARmake.inc
% Fix paths etc in ARmake.inc
Note: to use the frameworks BLAS and LAPACK (vecLib) make sure LAPACKdir and BLASdir
are not in the path.
Mac OS X 10.3: 'lsame' and 'lsamen' (in LAPACK) are not in vecLib but are needed by

                            ARPACK. To fix this, copy LAPACK/lsame.f and LAPACK/lsamen.f to UTIL,
                            and add lsame.o
and lsamen.o to OBJS in UTIL/Makefile
Mac OS X 10.4: This above problem is fixed, but now the
routine 'second' is present in vecLib! This
                            may generate a warning when linking to the arpack libraries, but these appear to be
                            harmless. (To avoid these warning, delete 'second.o' from UTIL/Makefile.)

Get rid of mpif.h according to SLEPc instructions
mv PARPACK/UTIL/MPI/mpif.h .
make lib
make plib

SLEPc

Download from here: http://www.grycap.upv.es/slepc/

gunzip slepc.tgz
tar -xvf slepc.tar
cd slepc-2.3.0

setenv SLEPC_DIR `pwd`
./config/configure.py--with-arpack-dir=/data2/spk/ARPACK-mpich --with-arpack-flags=-lparpack_MPI_darwin,-larpack_darwin
make
make testexamples

NCO

1) First upgrade bison (version shipped with Mac OS is ancient and broken)

Download from here: http://ftp.gnu.org/gnu/bison/bison-2.1.tar.gz
tar -xvzf bison-2.1.tar.gz
cd bison-2.1
./configure --prefix=/usr/local
make
make check
sudo make install

2) Now install NCO

Download from here: http://nco.sourceforge.net/nco.tar.gz

tar -xvzf nco.tar.gz
cd nco-3.1.0
setenv NETCDF_INC /usr/local/netcdf/include
setenv NETCDF_LIB /usr/local/netcdf/lib
./configure --disable-regex --disable-shared
make
sudo make install

SUNDIALS

Download from here: http://www.llnl.gov/CASC/sundials/

setenv F77 /opt/ibmcmp/xlf/8.1/bin/xlf
setenv FFLAGS "-qextname"
./configure --with-mpi-root=/usr/local/mpich2
make
make install
make examples

To install the matlab toolbox, also download sundialsTB
Modify the variable 'SUNDIALS' in mex/Makefile to point to the sundials installation
Copy mexopts.sh from your local matlab installation

make

Python

1) Download and install MacPython 2.4.1 from: http://undefined.org/python/MacPython-OSX-2.4.1-1.dmg

2) Download and install tiger fix: http://pythonmac.org/packages/TigerPython24Fix-r2.zip

3) Launch /Applications/MacPython-2.4/PackageManager
    Install: Numeric-23.8-binary
            numarray-1.2.3-binary
            PIL-1.1.5-binary
            PyOpenGL-2.0.1.09-binary
            Documentation-2.4-binary

4) Download and install wxPython from:
     http://prdownloads.sourceforge.net/wxpython/wxPython2.6-osx-unicode-2.6.1.0-macosx10.3-py2.4.dmg
      
5) Download and install TclTk Aqua (TclTkAquaBI-8.4.10.0.dmg) from:
     http://tcltkaqua.sourceforge.net/

6) Download and install matplotlib from: http://pythonmac.org/packages/matplotlib-0.82-py2.4-macosx10.3.zip

7) Download SciPy from: http://www.scipy.org

    See detailed installation instructions at: http://www.scipy.org/documentation/Members/fonnesbeck/osx_build.txt   
     
    Following these, first install:

    FFTW: http://www.fftw.org/fftw-2.1.5.tar.gz
    ./configure
    make
    sudo make install

    F2PY: http://cens.ioc.ee/projects/f2py2e/2.x/F2PY-2-latest.tar.gz
    tar -xvzf F2PY-2-latest.tar.gz
    sudo python setup.py install
    This gets installed in: /Library/Frameworks/Python.framework/Versions/2.4/bin

    Now install SciPy:
    python setup.py build config_fc --fcompi-fcompiler=ibm
    sudo python setup.py install config_fc --fcompiler=ibm

8) netcdf: http://dirac.cnrs-orleans.fr/MacPackages/netcdf-3.6.0-p1-macosx10.3.zip

9) ScientificPython: http://dirac.cnrs-orleans.fr/MacPackages/ScientificPython-2.4.9-py2.4-macosx10.3.zip

    (See also: http://starship.python.net/~hinsen/ScientificPython/)

10) gnuplot

First install gnuplot: ftp://ftp.gnuplot.info/pub/gnuplot/gnuplot-4.0.0.tar.gz
tar -xvzf gnuplot-4.0.0.tar.gz
cd gnuplot-4.0.0
./configure
make
sudo make install

Now install gnuplot-py: http://gnuplot-py.sourceforge.net/
cd gnuplot-py-1.7

The default display is set to 'aqua'. This must be changed in gp_macosx.py:

  Change
    default_term = 'aqua' to
    default_term = 'x11'

python setup.py install

11) Python Scripting for Computational Science: http://folk.uio.no/hpl/scripting/