Mercurium C/C++/Fortran source-to-source compiler
Mercurium is mainly used together with the Nanos++ Runtime Library to implement the OmpSs programming model. Both tools also implement OpenMP 3.1. 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).
Make sure you fulfill the build requirements
Download Mercurium's code
- From our repo
Clone Mercurium's repository
$ 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
autoreconfin the newly created
$ 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>>
- From our repo
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
MERCURIUMto 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
$ 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 binary 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 will be used.
Any installation of Mercurium has, at least, the
plain profiles (
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. They may seem useless, but they are really useful
when debugging our compiler frontend.
For more information check our list of Mercurium's profiles.
For questions, suggestions and bug reports, you can contact us through the firstname.lastname@example.org