Skip to content
Thomas Naughton edited this page Dec 6, 2017 · 4 revisions

Welcome to the libomp wiki!

You can find here all that is required to install and used an OpenMP runtime for LLVM that is PMIx aware. By having a PMIx-aware runtime, it is possible to have communications between the OpenMP, MPI runtimes and the resource manager.

Configuration

At minimum, please get a checkout of LLVM, CLANG and this repository. You can add more LLVM components but these 3 are required here. Please configure all components following the LLVM documentation.

To build the code, you will need a build script such as:

#!/bin/bash

INSTALL_PATH=$HOME/projects/OMPIX/install/llvm

PATH_TO_PMIX=<path/to/pmix/install/dir>
PATH_TO_LLVM=<path/to/llvm/src>

rm -f  CMakeCache.txt
rm -rf CMakeFiles
EXTRA_ARGS=$@
ARGS=(
    -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH
    -DCMAKE_C_COMPILER=gcc
    -DCMAKE_CXX_COMPILER=g++
    -DPMIX_LIBRARY_DIR:PATH=$PATH_TO_PMIX/lib
    -DPMIX_INCLUDE_DIR:PATH=$PATH_TO_PMIX/include
)

cmake $PATH_TO_LLVM "${ARGS[@]}"

Once LLVM compiled and installed, you can compile OpenMP code with a Makefile similar to:

all: omp_hello

omp_hello: omp_hello.c
    clang -I<path/to/llvm/install/dir>/include -L<path/to/pmix/install>/lib -fopenmp omp_hello.c -lpmix

To compile MPI+OpenMP code, the Makefile should look like:

CC=clang
CFLAGS=-fopenmp
MPI_COMPILE_FLAGS=$(shell mpicc --showme:compile)
MPI_LINK_FLAGS=$(shell mpicc --showme:link)

all: mpi_omp_hello

mpi_omp_hello: mpi_omp_hello.c
    $(CC) -I<path/to/llvm/install>/include \
        -I<path/to/pmix/install>/include \
        -L<path/to/pmix/install>/lib \
        $(MPI_COMPILE_FLAGS) $(CFLAGS) $(MPI_LINK_FLAGS) \
        -o mpi_omp_hello mpi_omp_hello.c -lpmix

clean:
    rm -f mpi_omp_hello

See also:

Clone this wiki locally