Wiki

Clone wiki

jCODE-public / GNU

GNU COMPILERS (Mac Os X)

Xcode

Before you can make available the external libraries that are required to run the code, you will need to make sure you have Xcode installed (for users with Mac Os X platform). A simple test is to open a terminal window (=>/Applications/Utilities/Terminal.app) and type make. If you see the message

make: * No targets specified and no makefile found. Stop.

then you can proceed to the next step. If the terminal tells you _command not found_, then you need to install Xcode. You can download it for free in the Mac App Store.

Compilers

Now that Xcode is working on your machine, you need to download and install the free, open source GNU compilers. These are available here, as well as other valuable information regarding high performance computing on Mac OS X.

Download the appropriate binaries for your version of OS X: _gcc-snwleo-intel-bin.tar.gz_ and _gfortran-snwleo-intel-bin.tar.gz_ for Snow Leopard, or _gcc-lion.tar.gz_ and _gfortran-lion.tar.gz_ for Lion. Once they have finished downloading, go to the directory where they have downloaded (this assumes that is the Downloads folder in your home directory). In the terminal window, type:

cd /Downloads

Now you need to unpack the file you just downloaded. Do this by typing (NOTE: if you downloaded the binaries using Safari, then this step will likely already be done for you)

gunzip gcc-lion.tar.gz

Now in the downloads folder you will see the same binary files, but now with the file extension .tar rather than .tar.gz. You want to install the contents of this tarball in your /usr/local directory. To do this, simply type

sudo tar -xvf gcc-lion.tar -C /

Now if you type

ls /usr/local/bin/

you should see the _gfortran_, _g++_, and _gcc_ executables.

OPENMPI

Download the file openmpi-2.0.0.tar.gz, unpack it, and go into the new folder. Installing OPENMPI involves four steps just like FFTW:

  • defining the compilers and the optimization flags
export CC=gcc
export CXX=g++
export F77=gfortran
export CFLAGS="-O3 -ftree-vectorize"
export CXXFLAGS="-O3 -ftree-vectorize"
export FFLAGS="-O3 -ftree-vectorize"
  • testing and configuring the system
./configure CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ F77=/usr/local/bin/gfortran FC=/usr/local/bin/gfortran --prefix=/Users/<username>/openmpi/
  • compiling the libraries

make

  • installing the libraries

make install

To make sure that the MPI compilers/libraries were created properly, look in the directory where you installed OPENMPI. In the _bin_ subdirectory, you should find

  • mpicc
  • mpicxx
  • mpif77
  • mpif90

If they are there then you are all set. If not, go back to the configure step and make sure no errors were detected.

Updated