ConfiguringMacOSX

From Einstein Toolkit Documentation
Jump to: navigation, search

Configuring Mac OS X for Cactus

This document explains how to set up a computer running Mac OS X for compiling and running Cactus simulations. These instructions specifically apply to OS X 10.6 (Snow Leopard). Other versions should be similar.

Step 1: Install Xcode

Download and install the latest version of Xcode from Apple. The version"Xcode for Mac-only Development" is sufficient.

Step 2: Install MacPorts

MacPorts allows you to install extra libraries and tools not included with OS X. Download and install the version for your version of OS X.

Step 3: Install git

git can be easily installed using MacPorts:

sudo port install git-core

Step 4: Install a good compiler

sudo port install gcc45

Step 5: Configure Cactus

In order for Cactus to find all of the installed libraries, make sure the your optionlist looks like the following (this is based off the version included in simfactory):

# macbook-gcc

# Whenever this version string changes, the application is configured
# and rebuilt from scratch
VERSION = 2010-09-23

CPP = cpp
FPP = cpp
CC  = gcc-mp-4.5
CXX = g++-mp-4.5
F77 = gfortran-mp-4.5
F90 = gfortran-mp-4.5

CPPFLAGS = -DMPICH_IGNORE_CXX_SEEK
FPPFLAGS = -traditional
CFLAGS   = -g3 -fshow-column -mmacosx-version-min=10.5 -m128bit-long-double -std=gnu99
CXXFLAGS = -g3 -fshow-column -mmacosx-version-min=10.5 -m128bit-long-double -std=gnu++0x
F77FLAGS = -g3 -fshow-column -mmacosx-version-min=10.5 -m128bit-long-double -fcray-pointer
F90FLAGS = -g3 -fshow-column -mmacosx-version-min=10.5 -m128bit-long-double -fcray-pointer

LDFLAGS = /System/Library/Frameworks/vecLib.framework/vecLib -L/opt/local/lib/gcc45 -lgfortran

C_LINE_DIRECTIVES = yes
F_LINE_DIRECTIVES = yes

REAL16_KIND = 10

DEBUG           = no
CPP_DEBUG_FLAGS = -DCARPET_DEBUG
FPP_DEBUG_FLAGS = -DCARPET_DEBUG
C_DEBUG_FLAGS   = -fbounds-check -ftrapv -fstack-protector-all
CXX_DEBUG_FLAGS = -fbounds-check -ftrapv -fstack-protector-all
F77_DEBUG_FLAGS = -fbounds-check -ftrapv -fstack-protector-all
F90_DEBUG_FLAGS = -fbounds-check -ftrapv -fstack-protector-all

OPTIMISE           = yes
CPP_OPTIMISE_FLAGS =
FPP_OPTIMISE_FLAGS = 
C_OPTIMISE_FLAGS   = -O2
CXX_OPTIMISE_FLAGS = -O2
F77_OPTIMISE_FLAGS = -O2
F90_OPTIMISE_FLAGS = -O2

PROFILE           = no
CPP_PROFILE_FLAGS =
FPP_PROFILE_FLAGS =
C_PROFILE_FLAGS   = -pg
CXX_PROFILE_FLAGS = -pg
F77_PROFILE_FLAGS = -pg
F90_PROFILE_FLAGS = -pg

OPENMP           = yes
CPP_OPENMP_FLAGS = -fopenmp
FPP_OPENMP_FLAGS = -fopenmp
C_OPENMP_FLAGS   = -fopenmp
CXX_OPENMP_FLAGS = -fopenmp
F77_OPENMP_FLAGS = -fopenmp
F90_OPENMP_FLAGS = -fopenmp

WARN           = yes
CPP_WARN_FLAGS = -Wall
FPP_WARN_FLAGS = -Wall
C_WARN_FLAGS   = -Wall
CXX_WARN_FLAGS = -Wall
F77_WARN_FLAGS = -Wall
F90_WARN_FLAGS = -Wall



BLAS_DIR  = /System/Library/Frameworks/vecLib.framework
BLAS_LIBS = gfortran

LAPACK_DIR  = /System/Library/Frameworks/vecLib.framework
LAPACK_LIBS =

MPI              = OpenMPI
MPI_LIBS         = mpi

PTHREADS = yes

X_LIB_DIR = /usr/X11R6/lib


Congratulations, you can now build and run Cactus. To visualise output and to access other machines, continue.

Step 6: Install gnuplot

gnuplot can be easily installed using MacPorts:

sudo port install gnuplot

Step 7: Install Visit

Visit is used for visualizing the 3D data produced in simulations. Download the "Mac OS X - Intel" executable and "Visit install script" from here. Make the install script executable:

chmod +x visit-install

then execute it to install visit

sudo ./visit-install 1.12.1 darwin-i386 /usr/local/visit

where 1.12.1 is the version of Visit you downloaded. Add /usr/local/visit/bin to your $PATH so that you can run Visit by just typing visit on the command line.

Step 8: Install Visit Carpet plugin

To effectively read the data output by Carpet, Visit requires a plugin. The source code for the plugin may be checked out from the Cactus SVN repository

svn co http://svn.cactuscode.org/VizTools/CarpetHDF5/trunk/

The plugin requires the HDF5 library, but cannot use the previously installed version for two reasons:

  • It must be the same version of the HDF5 library that is used by Visit. In the case of Visit version 1.12.x, HDF5 library version 1.8.1 is required.
  • The current version of Visit is compiled as 32-bit (i386). However, Snow Leopard compiles as 64-bit by default (x86_64).

For this reason, it is best to compile a usable version of HDF5 by hand:

  • Download the source for HDF5 1.8.1 into VizTools/visitCarpetHDF5.
  • Extract the source
cd CarpetHDF5
tar zxvf hdf5-1.8.1.tar.gz
  • Compile this version of HDF5:
cd hdf5-1.8.1
CFLAGS="-arch i386" CXXFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --host=i386 --enable-cxx --enable-production --enable-static
make
make install
cd ../

We can now compile the Visit plugin using this version of the hdf5 library. Before doing so, we need to make a small change to one of the files installed by Visit. Edit /usr/local/visit/1.12.1/darwin-i386/include/make-variables and remove the -Wno-long-double from the line starting with PY_CXXFLAGS. Now, compile and install the plugin:

./install

In the window that appears, select the Makefile tab. Ensure the CXXFLAGS includes -I./hdf5-1.8.1/hdf5/include -arch i386 and the LDFLAGS include -L./hdf5-1.8.1/hdf5/lib -arch i386, then save and quit. The plugin should now compile and install a location where it can be found by Visit.

Step 9: Install Globus Tools (gsissh, GridFTP, myproxy, etc.)

In order to access any of the TeraGrid machines (eg. Kraken), you will need to first install the Global Tools. These must currently be compiled from source as follows:

tar xjvf gt5.0.0-all-source-installer.tar.bz2
  • cd to the directory where you extract the files and build gsi-ssh, GridFTP, myproxy
./configure --prefix=/usr/local
sudo make gsi-myproxy gsi-openssh gridftp
sudo make install
  • Add the the following lines your ~/.bash_profile and then run source ~/.bash_profile:
export GLOBUS_LOCATION=/usr/local
export MYPROXY_SERVER=myproxy.teragrid.org
export MYPROXY_SERVER_PORT=7514
source $GLOBUS_LOCATION/etc/globus-user-env.sh