Installation of LLVM-based compilerΒΆ

The LLVM website describes a list of build requirements of LLVM.

You should be able to compile and install the LLVM-based compiler with the following commands:

$ cmake -S llvm -B build \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$INSTALLATION_PREFIX \
        -DLLVM_ENABLE_PROJECTS=clang \
        -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
        -DCLANG_DEFAULT_OMPSS2_RUNTIME=libnodes \
        -DCLANG_DEFAULT_NANOS6_HOME=$INSTALLATION_PREFIX \
        -DCLANG_DEFAULT_NODES_HOME=$INSTALLATION_PREFIX \
        -DCLANG_DEFAULT_NOSV_HOME=$INSTALLATION_PREFIX
$ cd build
$ make
$ make install

The LLVM/Clang can compile OmpSs-2 code and generate the binaries for both Nanos6 and NODES runtime systems. The support for OmpSs-2 and their runtime systems is always enabled. Deciding whether an OmpSs-2 binary is generated for a specific runtime is done when compiling the user application with clang.

During the building stage, LLVM/Clang only needs to know where to find the runtime libraries. The following CMake options are available to specify the path to the runtime libraries and which is the default runtime for OmpSs-2 binaries:

  • CLANG_DEFAULT_NANOS6_HOME to specify the default path to the Nanos6 installation. If not provided, the default path is the installation prefix of LLVM/Clang. This Nanos6 path can be overriden when compiling OmpSs-2 applications by defining the NANOS6_HOME environment variable

  • CLANG_DEFAULT_NODES_HOME to specify the default path to the NODES installation. If not provided, the default path is the installation prefix of LLVM/Clang. This NODES path can be overriden when compiling OmpSs-2 applications by defining the NODES_HOME environment variable

  • CLANG_DEFAULT_NOSV_HOME to specify the default path to the nOS-V installation. If not provided, the default path is the installation prefix of LLVM/Clang. This nOS-V path can be overriden when compiling OmpSs-2 applications by defining the NOSV_HOME environment variable

  • CLANG_DEFAULT_OMPSS2_RUNTIME to specify which runtime library is targeted by default if the user did not specify which runtime when compiling an application. The accepted values are libnodes (default) and libnanos6

Important

nOS-V is a requirement for using NODES so we encourage you to specify its intallation path to avoid compilation errors.

More details about customizing the LLVM build can be found in the LLVM website