Mercurium is a C/C++/Fortran source-to-source compilation infrastructure aimed at fast prototyping developed by the Programming Models group at the Barcelona Supercomputing Center.
Mercurium is used, together with the Nanos++ Runtime Library, to implement the OmpSs programming model. Both tools provide also an implementation of OpenMP 3.1. More recently, Mercurium has been also used to implement the OmpSs-2 programming model together with the Nanos6 Runtime Library.
Apart from that, since Mercurium is quite extensible it has been used to implement other programming models or compiler transformations, examples include Cell Superscalar, Software Transactional Memory, Distributed Shared Memory or the ACOTES project, just to name a few.
Extending Mercurium is achieved using a plugin architecture, where plugins represent several phases of the compiler. These plugins are written in C++ and dynamically loaded by the compiler according to the chosen profile configuration. Code transformations can be implemented in terms of source code (there is no need to modify or know the internal syntactic representation of the compiler).
Download Mercurium's code
From our repo
Clone Mercurium's repository
From GitHub:
$ git clone https://github.com/bsc-pm/mcxx.git
From our internal GitLab repository (BSC users only):
$ git clone https://pm.bsc.es/gitlab/mercurium/mcxx.git
Run autoreconf
in the newly created mcxx
directory
$ cd mcxx
$ autoreconf -fiv
<<<autoreconf output>>>
From a distributed tarball
Go to OmpSs downloads and grab the latest version of the compiler. Unpack the file and enter in the directory
$ tar xvzf mcxx-<<version>>.tar.gz
$ cd mcxx-<<version>>
Run configure
. Check the configure flags to
enable more or less features in the compiler. By default the compiler does
not have anything enabled. Set the environment variable MERCURIUM
to the
directory where you want to install Mercurium
$ export MERCURIUM=/path/to/install/mercurium
$ ./configure --prefix=$MERCURIUM <<configure-flags>>
Build and install
$ make
<<<compilation output>>>
$ make install
Add the installed binaries to your PATH
$ export PATH=$MERCURIUM:$PATH
And that's all!
Depending on the configure flags used to configure Mercurium, you may have some Mercurium profiles or others. A Mercurium profile is basically a file with a predefined configuration that specifies the behavior of Mercurium. For example, a profile specifies which phases of Mercurium have to be executed or which backend compiler should be used.
Any installation of Mercurium has, at least, the plain
profiles (plaincc
,
plaincxx
and plainfc
for C, C++ and Fortran languages respectively). These
profiles do not transform any OpenMP/OmpSs pragma, they basically process your
code and generate it again.
For more information check our list of Mercurium's profiles.
For questions, suggestions and bug reports, you can contact us through the pm-tools@bsc.es