How to install/update MARS on a MAC. [last update: 20180125]

Frequently asked questions

How to install/update MARS on a MAC. [last update: 20180125]

Postby zhouxinwei » Thu Jan 25, 2018 6:48 pm

Prerequisite 1: Install the command line tool component of Xcode.

If you don't want to install the full Xcode software (the size is usually several Gigabytes), you can only install the command line tool component (which provides necessary header files and libraries to compile a c/c++ program) in Terminal App:
Code: Select all
xcode-select --install

When you do a major macOS upgrade, e.g. from macOS 10.10 to macOS 10.11, you need to redo this step because a major macOS upgrade will erase the Xcode components installed before. In case of a minor upgrade, e.g. from 10.12.0 to 10.12.2, you don't need to redo this part.

Prerequisite 2: Install HomeBrew.

HomeBrew (https://brew.sh/) is a very popular package management system for macOS. It can be used to install many useful tools (e.g. GCC 7) which Apple does not provide. To install HomeBrew, open Terminal App and run
Code: Select all
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


Part 1: Install a recent C++ commpiler (e.g. GNU g++) using HomeBrew

Install GNU GCC by running
Code: Select all
brew install gcc

The installed c++ compiler is /usr/local/bin/g++-N, where N is the version number of the latest stable release. Note: make sure to replace N with the actual number.

Part 2: Build or update MARS

  1. Download the latest package from http://mars.es3inc.com/protected/MARS/ (e.g. mars2018.01.00.MacOSX.zip) to a local folder where you want to build the MARS executables.
  2. Unzip the package, among other files, you will find two files: user.cpp and Makefile.
  3. If you are developing user-defined features with your own user.cpp, replace the one within our package with your copy.
  4. Open Makefile, make necessary changes to specify CXX to the c++ compiler we have install in Part 1.
  5. Compile debug version of MARS (marsD) using
    Code: Select all
    make V=D
    or, compile OpenMP version (marsO) using
    Code: Select all
    make V=O
    or, compile MPI version (marsM) using
    Code: Select all
    make V=M
  6. Add
    Code: Select all
    export PATH=[path_to_mars_folder]:$PATH
    to ~/.bash_profile (be sure to replace [path_to_mars_folder] with the real path which includes the MARS executable you just compiled).
  7. Add
    Code: Select all
    export MARS_LICENSE_PATH=[file_name]
    to ~/.bash_profile (replace [file_name] to the absolute path of the license file you received from ES3 (contact us if you don't have one).
  8. Run
    Code: Select all
    source ~/.bash_profile
    in shell prompt to update PATH and MARS_LICENSE_PATH.
Now you should be able to run the MARS executable under any folder. :D

Part 3: Install MPI compiler using HomeBrew (optional)

Install Open MPI by running
Code: Select all
brew install open-mpi

The executables (e.g. mpic++, mpirun) are installed under /usr/local/bin by default.
The MPI c++ compiler (actually a wrapper) is mpic++. To invoke the c++ compiler installed in Part 1, in the Makefile we can use:
Code: Select all
OMPI_CXX=/usr/local/bin/g++-N mpic++
instead of
Code: Select all
mpic++
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm

Return to FAQs

Who is online

Users browsing this forum: No registered users and 1 guest

cron