ConfiguringMacOSX

From Einstein Toolkit Documentation
Revision as of 22:53, 23 September 2010 by 68.105.150.101 (talk)
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 9: Install a good compiler

sudo port install gcc45

Step 10: 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 = 2009-11-25

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

# -fmudflapth does not work with current gcc 4.2.0
# -march=prescott and -march=core2 lead to an ICE
# -march=native prevents undefined references to ___sync_fetch_and_add_4
# -malign-double may lead to crashes in Fortran I/O
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 -I/opt/local/include
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/gcc43 -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

# Changing ANSI C semantics:
# -funsafe-loop-optimizations -ffast-math-errno -fassociative-math
# Graphite optimisations are not implemented:
# -floop-interchange -floop-strip-mine -floop-block
OPTIMISE           = yes
CPP_OPTIMISE_FLAGS = # -DCARPET_OPTIMISE -DNDEBUG
FPP_OPTIMISE_FLAGS = # -DCARPET_OPTIMISE -DNDEBUG
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

# -Wuninitialized is not supported without -O
WARN           = no
#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

FFTW_DIR  = /opt/local
FFTW_LIBS = drfftw dfftw m

#CURL_DIR = /opt/local

#FLICKCURL_DIR = /Users/eschnett/flickcurl-1.10

GSL     = yes
GSL_DIR = /opt/local

HDF5      = yes
HDF5_DIR  = /opt/local
LIBSZ_DIR = /opt/local

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

MPI              = OpenMPI
MPI_LIBS         = mpi
#OPENMPI_DIR      = /opt/local/lib/openmpi
#OPENMPI_INC_DIR  = /opt/local/include
#OPENMPI_LIB_DIR  = /opt/local/lib

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

#PETSC           = yes
#PETSC_DIR       = /opt/local/lib/petsc 
#PETSC_ARCH      = macx
#PETSC_ARCH_LIBS = X11   mpich   gfortran   dl   pthread

PTHREADS = yes

SSL_DIR = /opt/local

X_LIB_DIR = /usr/X11R6/lib

Step 4: Install gnuplot

gnuplot can be easily installed using MacPorts:

sudo port install gnuplot

Step 5: 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 6: 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 CVS repository (using password 'anon'):

cvs -d :pserver:cvs_anon@cvs.cactuscode.org:/cactus login
cvs -d :pserver:cvs_anon@cvs.cactuscode.org:/cactus checkout VizTools/visitCarpetHDF5

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 VizTools/visitCarpetHDF5
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 11: 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:

  • Download the source package.
  • Extract the files:
tar zxvf 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