How to install/update MARS on a MAC. [OBSOLETE]

Frequently asked questions

How to install/update MARS on a MAC. [OBSOLETE]

Postby ES3 » Mon Sep 28, 2015 9:52 pm

This post is obsolete, to see the latest instructions, see here: viewtopic.php?f=28&t=194.

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.
Above files are packed in a compressed file which can be downloaded from http://mars.es3inc.com/protected/MARS/. Notice: only users who are registered with ES3 have access to this archive.

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.

  1. Under shell prompt, install Xcode components by running
    Code: Select all
    xcode-select --install
  2. [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/).
  3. [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 /
The compilers are installed under /usr/local/bin.

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

  1. 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.
  2. Under shell prompt, unzip the package to current folder:
    Code: Select all
    tar zxvf mars2015.0.53.MacOSX.tgz
  3. If you are developing user defined features with your own user.cpp, replace the one downloaded with your copy.
  4. 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
  5. 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).
  6. 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).
  7. Run
    Code: Select all
    source ~/.bash_profile
    in shell prompt to update PATH and MARS_LICENSE_PATH.
Now you should be able to run MARS executable under any folder. :D

Part III: Install MPI compiler (if needed)

  1. 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
  2. Unzip source code package using
    Code: Select all
    tar xzvf openmpi-1.10.4.tar.gz
  3. Go to unzipped folder
    Code: Select all
    cd openmpi-1.10.4
  4. Create a folder for compilation:
    Code: Select all
    mkdir build & cd build
  5. 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
  6. Compile source code (for a parallel compilation, change N to number of processors you have, e.g. 4)
    Code: Select all
    make -j N
  7. Install
    Code: Select all
    sudo make install
  8. 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
  9. Update PATH using
    Code: Select all
    source ~/.bash_profile
ES3
 
Posts: 42
Joined: Thu Jul 09, 2015 9:36 pm

Return to FAQs

Who is online

Users browsing this forum: No registered users and 3 guests

cron