To simplify the deployment of MARS and accomodate the individual environment of specific platforms, ES3 no longer provide pre-compiled MARS exectuables. Instead, we provide:
- 1. the MARS library, which includes all core functionalities of MARS: libmars.a is optimized with OpenMP support, libmarsD.a is for debugging.
2. MPI function files, mpi-O.cpp for non-MPI compilation and mpi-M.cpp for MPI compilation.
3. template of user.cpp, where user can add user defined features. Notice: If you are writing your own user.cpp, be careful NOT to replace it with the one provided by ES3.
Part I: Install GCC compiler
Usually you only need to do this once. However, if you do a major OS upgrade, e.g. from Mac OS 10.8 to Mac OS 10.9, you need to redo step 1 because a major OS upgrade will erase the Xcode components installed before. In case of minor upgrade, e.g. from 10.8.0 to 10.8.2, you don't need to redo anything in this part.
- Under shell prompt, install Xcode components by running
- Code: Select all
xcode-select --install
- [Obsolete, see Notice below]Download gnu gcc compiler set with OpenMP support from http://mars.es3inc.com/protected/MARS/MacOSX/gcc-4.9-bin.tar.gz (credit to http://hpc.sourceforge.net/).
- [Obsolete, see Notice below]Under shell prompt, install the downloaded package using (replace [gcc-4.9-bin.tar.gz] with the actual packaged you downloaded)
- Code: Select all
sudo tar zxvf [gcc-4.9-bin.tar.gz] -C /
Notice:
- Since macOS Sierra (10.12), gcc 4.9 will give some annoying warnings similar to
- Code: Select all
.section __TEXT,__textcoal_nt, ...
The workaround is to install a newer version of gcc, which is recommended for all Mac users. - We can use HomeBrew (https://brew.sh/, a popular package management system for macOS) to install gcc. First, install HomeBrew by running
- Code: Select all
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then, install gcc (e.g. GCC 7) by running- Code: Select all
brew install gcc@7
The c++ compiler can be invoked using g++-7.
Part II: Build or update MARS
- Download the latest package from http://mars.es3inc.com/protected/MARS/ (e.g. mars2015.0.53.MacOSX.tgz) to a local folder where you want to build the MARS executables.
- Under shell prompt, unzip the package to current folder:
- Code: Select all
tar zxvf mars2015.0.53.MacOSX.tgz
- If you are developing user defined features with your own user.cpp, replace the one downloaded with your copy.
- Compile debug version of MARS (marsD) using
- Code: Select all
make V=D
- Code: Select all
make V=O
- Code: Select all
make V=M
- Add
- Code: Select all
export PATH=[path_to_mars_folder]:$PATH
- Add
- Code: Select all
export MARS_LICENSE_PATH=[file_name]
- Run
- Code: Select all
source ~/.bash_profile
Part III: Install MPI compiler (if needed)
- Download Open MPI source code from Official website, e.g. https://www.open-mpi.org/software/ompi/v1.10/, choose a stable release, e.g. openmpi-1.10.4.tar.gz
- Unzip source code package using
- Code: Select all
tar xzvf openmpi-1.10.4.tar.gz
- Go to unzipped folder
- Code: Select all
cd openmpi-1.10.4
- Create a folder for compilation:
- Code: Select all
mkdir build & cd build
- Choose the compiler installed in Part I, the Open MPI files will be installed under /opt/openmpi
- Code: Select all
../configure CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ --prefix=/opt/openmpi
- Compile source code (for a parallel compilation, change N to number of processors you have, e.g. 4)
- Code: Select all
make -j N
- Install
- Code: Select all
sudo make install
- Similar to Part II, add following into ~/.bash_profile so you can find MPI executables (mpic++, mpirun) under any folder in a shell prompt
- Code: Select all
export PATH=/opt/openmpi/bin:$PATH
- Update PATH using
- Code: Select all
source ~/.bash_profile