# 1. Installation of OmpSs¶

## 1.1. Preparation¶

You must first choose a directory where you will install OmpSs. In this document this directory will be referred to as TARGET. We recommend you to set an environment variable TARGET with the desired installation directory. For instance:

$export TARGET=$HOME/ompss


## 1.2. Installation of Extrae (optional)¶

This is just a quick summary of the installation of Extrae. For a more detailed information check Extrae Homepage

1. Get Extrae from https://tools.bsc.es/downloads (choose Source tarball of Extrae tool).

2. Unpack the tarball and enter the just created directory:

$tar xfz extrae-xxx.tar.gz$ cd extrae-xxx

3. Configure it:

$./configure --prefix=$TARGET


Note

Extrae may have a number of dependences. Do not hesitate to check the Extrae User’s Manual

4. Build and install:

$make$ make install


Now you can proceed to the Installation of Nanos++. Do not forget to pass --with-extrae=$TARGET to Nanos++ configure. ## 1.3. Installation of Nanos++¶ 1. First, make sure that you fulfill all the Nanos++ build requirements. 2. Get the latest Nanos++ tarball (nanox-version-yyyy-mm-dd.tar.gz) from https://pm.bsc.es/ompss-downloads Unpack the file and enter the just created directory: $ tar xfz nanox-version-yyyy-mm-dd.tar.gz
$cd nanox-version  3. Run configure. There are a number of flags that enable or disable different features of Nanos++. Make sure you pass --prefix with the destination directory of your OmpSs installation (in our case TARGET). Important If you want instrumentation support, you must add --with-extrae=dir to your configure-flags (see below), where dir is the directory where you installed Extrae (usually TARGET). Check Nanos++ configure flags for more information about configure-flags. $ ./configure --prefix=$TARGET configure-flags  Note You can pass an empty set of configure-flags. Hint configure prints lots of output, but a small summary of enabled features is printed at the end. You may want to check it to ensure you are correctly passing all the flags 4. Build $ make


This may take some time. You may build in parallel using make -jN where N is the maximum number of threads you want to use for parallel compilation.

5. Install

$make install  This will install Nanos++ in TARGET. Now you can proceed to Installation of Mercurium C/C++ compiler. ### 1.3.1. Nanos++ build requirements¶ There are a number of software requirements to successfully build Nanos++ from the source code. Important Additional software is needed if you compile from the git repository. This section details the requirements when building from a tarball (a tar.gz file). • A supported platform running Linux (i386, x86-64, ARM, PowerPC or IA64). • GNU C/C++ compiler versions 4.4 or better. If you want CUDA support: • CUDA 5.0 or better. If you want to enable the cluster support in Nanos++ you will need: • GASNet 1.14.2 or better ### 1.3.2. Nanos++ configure flags¶ By default Nanos++ compiles three versions: performance, debug and instrumentation. Which one is used is usually governed by flags to the Mercurium compiler. You can speedup the build of the library by selectively disabling these versions. You can also enable a fourth version: instrumentation-debug. That one is probably of little interest to regular users of Nanos++ as it enables debug and instrumentation at the same time.  --disable-instrumentation Disables generation of instrumentation version --disable-debug Disables generation of debug version --disable-performance Disables generation of performance version --enable-instrumentation-debug Enables generation of instrumentation-debug version Besides the usual shared memory environment (which is called the SMP device), Nanos++ supports several devices. Such devices are automatically enabled if enough support is detected at the host. You can disable them with the following flags.  --disable-gpu-arch Disables CUDA support --disable-opencl-arch Disables OpenCL support Nanos++ includes several plugins that are able to use other software packages. You can enable them using the following flags.  --with-cuda=dir Directory of CUDA installation. By default it checks /usr/local/cuda. If a suitable installation of CUDA is found, CUDA support is enabled in Nanos++ (unless you disable it) --with-opencl=dir Directory of OpenCL installation. By default it checks /usr. If a suitable installation of OpenCL is found, OpenCL support is enabled in Nanos++ (unless you disable it) --with-opencl-include=dir If you use –with-opencl=dir, configure assumes that dir/include contains the headers. Use this flag to override this assumption. --with-opencl-lib=dir If you use –with-opencl=dir, configure assumes that dir/lib contains the libraries. Use this flag to override this assumption. --with-extrae=dir Directory of Extrae installation. This is mandatory if you want instrumentation. Make sure you have already installed Extrae first. See Installation of Extrae (optional) --with-mpitrace=dir This is a deprecated name for --with-extrae --with-nextsim=dir Directory of NextSim installation --with-ayudame=dir Directory of Ayudame installation --with-hwloc=dir Directory of Portable Hardware Locality (hwloc) installation. This is highly recommended for NUMA setups --with-chapel=dir Directory of Chapel installation --with-mcc=dir Directory of Mercurium compiler. This is only for testing Nanos++ itself and only useful to Nanos++ developers. ## 1.4. Installation of Mercurium C/C++ compiler¶ 1. First, make sure you fulfill all the Mercurium build requirements. 2. Get the latest Mercurium tarball (mcxx-version-yyyy-mm-dd.tar.gz) from https://pm.bsc.es/ompss-downloads Unpack it and enter the newly created directory: $ tar xfz mcxx-version-yyyy-mm-dd.tar.gz
$cd mcxx-version  3. Run configure. Like in Nanos++, there are a number of flags to enable and disable different features of Mercurium. Make sure you pass --prefix=$TARGET --enable-ompss --with-nanox=$TARGET (failing to do this will result in a Mercurium without OmpSs support). Check Mercurium configure flags for more information about configure-flags. $ ./configure --prefix=$TARGET --enable-ompss --with-nanox=$TARGET configure-flags


Note

You can pass an empty set of configure-flags.

Hint

configure prints lots of output, but a small summary of enabled features is printed at the end. You may want to check it to ensure you are correctly passing all the flags

4. Build

$make  This may take some time. You may build in parallel using make -jN where N is the maximum number of threads you want to use for parallel compilation. 5. Install $ make install


This will install Mercurium in TARGET.

6. Make sure you add $TARGET/bin to your $PATH

export PATH=$TARGET/bin:$PATH


Hint

You may want to add the above command to your ~/.bashrc (or ~/.login, or ~/.profile or ~/.bash_profile depending on your environment).

7. Make a minimal check to verify you can run mcc

$mcc mcc: you must specify an input file  Now you are ready to Compile OmpSs programs. ### 1.4.1. Mercurium build requirements¶ There are a number of requirements to successfully build Mercurium from the source code. Important Additional software is needed if you compile from the git repository. This section details the requirements when building from a tarball (a tar.gz file). Hint Most of the time there is no need to install this software manually. Chances are that your Linux environment already provides them. If you installed Linux by your own check the provided package managers (apt-get, yum or zipper tools), otherwise ask your system administrator. Note GNU bison, flex and GNU gperf are not strictly needed when building from a tarball. Mercurium configure will warn you that modifying some files will cause the compilation fail (due to these tools missing). Compilation will be feasible as long as you do not modify any of these files (which is unlikely unless you are going to modify Mercurium itself). • A supported platform running Linux (i386, x86-64, ARM, PowerPC or IA64). • GNU C/C++ compiler versions 4.4 or better. • GNU bison 2.3 or better. Get it at http://ftp.gnu.org/gnu/bison Note Bison 2.4 is known to fail, use 2.4.1 instead Note Bison may generate code that emits warnings related to yydummy variables. You can safely disregard them. • GNU flex 2.5.4 or 2.5.33 or better. Get it at http://flex.sourceforge.net/ Note Avoid versions 2.5.31 and 2.5.34 of flex as they are known to fail. Use 2.5.33 at least. • GNU gperf 3.0.0 or better. Get it at http://ftp.gnu.org/gnu/gperf • Python 2.4 or better • SQLite 3.6.16 or better. Get it at http://www.sqlite.org/download.html (use the sqlite-autoconf-xxxx.tar.gz) Hint It is likely that your Linux distribution already provides SQLite. Make sure you install the development package usually named sqlite3-dev, sqlite3-devel or libsqlite3-dev. You may need to ask your system administrator to install it. Note If you choose to manually intall SQLite3 say in SQLITEDIR (it can be TARGET if you want), make sure the environment variable PKG_CONFIG_PATH contains SQLITEDIR/lib/pkconfig before running configure (that directory should contain a file called sqlite3.pc). configure will fail otherwise. Mercurium configure checks that you fulfill the requirements above (except for the version of GCC). Make sure you check the summary at the end. ### 1.4.2. Mercurium configure flags¶ For OmpSs, Mercurium needs at least configure flags --enable-ompss and --with-nanox=$TARGET. Some other flags may be needed to suit your environment.

 --enable-ompss Enables support of OpenMPSs. This is mandatory for OmpSs support --enable-tl-openmp-nanox Enables support of Nanos++ lowering. This is enabled by --enable-ompss --disable-nanox-gpu-device Disables GPU support in the compiler. If CUDA is detected this support is enabled automatically. Use this to disable it. --enable-nanox-fpga-device Enable FPGA support in the compiler. --disable-xlc If IBM XL C/C++ is detected, some extra configurations are enabled. Use this flag to disable them. --disable-xlf If IBM XL Fortran is detected, some extra configurations are enabled. Use this flag to disable them. --disable-icc If Intel C/C++ is detected, some extra configurations are enabled. Use this flag to disable them. --disable-ifort If Intel Fortran is detected, some extra configurations are enabled. Use this flag to disable them. --enable-tl-examples Build and install TL example phases. Only enable this if you are going to write TL compiler phases and want the examples built as well. --with-nanox=dir Directory of Nanos++ installation. This is mandatory for OmpSs support --with-cuda=dir Directory of CUDA installation. By default configure checks /usr/local/cuda. If found the CUDA device will be enabled. --with-mpi=dir Directory of MPI installation --with-type-environment=type_environment Mercurium tries to detect the environment. Should this detection fail you can override it. Valid values are linux-i386, linux-ppc32, linux-ppc64, linux-x86_64, linux-arm, linux-arm64, linux-ia64, linux-spu and solaris-sparcv9.