In this section we asume a clean MacPorts installation. The MacPorts build system will build every package from source so installation will be slow. The packages in MacPorts support different variants, each variant is build differently. The default variant of most packages does not support fortran and AMUSE needs fortran and fortran enabled packages. Below, with all installation commands we will specify the variant. AMUSE is tested with the gcc45 variant, gcc43 and gcc44 have been known to work also. Below, we will use gcc45.
If you want to use a different fortran compiler (ifort), you are better of using the install.py script in the doc/install directory.
Make sure you have a recent MacPorts installation. You need at least an up to date MacPorts 1.8.6 or later.
If you are unsure of your installation you can uninstall and clear the packages with:
port uninstall py26-docutils py26-nose py26-mpi4py py26-h5py py26-numpy hdf5-18 fftw-3 gsl openmpi python26
or, for python 2.7:
port uninstall py27-docutils py27-nose py27-mpi4py py27-h5py py27-numpy hdf5-18 fftw-3 gsl openmpi python27
To make a clean install of MacPorts, please remove the MacPorts directory and read the guide at: http://guide.macports.org/
You can install all the packages described below in one go with:
> sudo port install gcc45 > sudo port install python27 > sudo port install openmpi +gcc45 > sudo port install fftw-3 +gcc45 > sudo port install hdf5-18 gsl cmake gmp mpfr > sudo port install py27-numpy py27-h5py py27-nose py27-docutils +gcc45 > sudo port install py27-mpi4py +openmpi > sudo port install py27-matplotlib +gcc45
After installing you will need to configure the code with the following line:
> ./configure --with-fftw=/opt/local \ MPICXX=mpicxx-openmpi-mp MPICC=mpicc-openmpi-mp MPIFC=mpif90-openmpi-mp \ FC=gfortran-mp-4.5 PYTHON=python2.7 \ PREFIX=/opt/local
The --with-fftw option will ensure that fftw is found in /opt/local and not in any other location on OS X. Often, incompatible versions of fftw will be installed in /usr/include or /usr/local/inlude. These versions may have the wrong processor type (32 vs 64bits) or not contain a fortran API. For both cases compiling Fi will fail. In case the configure script does not pick the wanted fftw directories, you can edit the config.mk file to point to the right version.
The PREFIX variable will make sure some support libraries for community codes (gsl, gmp and mpfr) are found in /opt/local.
Please, make sure you have no other compile variables specified (like CC or CXX or CFLAGS), unless you have customized MacPorts in any way. Some variable settings will likely give compile errors for the community codes.
For example, BHTree is compiled with openmpicxx and $CXX. The command in the CXX variable must be compatible with openmpicxx (you can do openmpicxx --show to get the command openmpicxx is using)
The version of openmpi in macports (1.5.5 and before) does not handle MPI_IN_PLACE calls correctly for Fortran codes. Unfortunately, this means that Capreole, PhiGrape and Mocassin will not work with more than one worker on the mac. Also, MpiAmrVac, will give incorrect results in any case.
If you want to run these codes on OS X, please use the amuse install scripts and make sure macports is not on your path.
With macports, the nose package will not install nosetests under it’s standard name. It will be named nosetests-<python-version>. So for python2.7 you’ll need to use nosetests-2.7
> nosetests-2.7 ............................................ OK
By default MacPorts uses the XCode compilers, these compilers have no support for fortran, a MacPorts gcc compiler set needs to be installed. We suggest installing gcc 4.5:
> sudo port install gcc45
If you have installed a different version of gcc, you need to select a different variant of the packages below. To select a different variant replace +gcc44 with +gcc43, +gcc42 or any other version matching your gcc installation. Note, apple-gcc versions will not work, these do not support fortran.
MacPorts supports several python versions in different variants, we will install the python27 versions
> sudo port install python27 +gcc45
MacPorts provides packages for mpich2 and openmpi. Although you can probably install both, this is not recommended. We suggest you install openmpi.
To install openmpi, do:
> sudo port install openmpi +gcc45
Amuse can work with HDF5 versions 1.6.* and 1.8.3. MacPorts comes with HDF5 version 1.8.*. To install it, do:
> sudo port install hdf5-18 +gcc45
MacPorts comes with a FFTW and FFTW-3 package, for AMUSE we need FFTW-3. FFTW-3 can be installed with:
> sudo port install fftw-3 +gcc45
GSL is used to build Gadget2, GSL can be installed with:
> sudo port install gsl +gcc45
CMake is used to build EVTwin, CMake can be installed with:
> sudo port install cmake
GMP is required for Adaptb. With MacPorts, GMP can be installed with:
> sudo port install gmp
MPFR is required for Adaptb. With MacPorts, MPFR can be installed with:
> sudo port install mpfr
By this point all libraries and frameworks are installed. We can now install python packages (some depend on the installed libraries):
> sudo port install py27-numpy py27-h5py py27-nose py27-docutils +gcc45
If you installed openmpi in the MPI2 step you need to set the “openmpi” variant for “py27-mpi4py”:
> sudo port install py27-mpi4py +openmpi
Matplotlib is not required but is very useful for creating graphics, you can install it with:
> sudo port install py27-matplotlib +gcc45
Macports will install the compilers under non standard names. To use the right compilers you need to specify these during the configure stage of AMUSE.
See the output for configure --help for a list of all environment variables you can set.
If you installed openmpi you need to specify the mpi compilers like so:
./configure MPICXX=openmpicxx MPICC=openmpicc MPIFC=openmpif90