OMPi @ ppg documentation

OMPi is a lightweight, open source OpenMP compiler and runtime system for C; it takes C source code with OpenMP #pragmas and produces transformed multithreaded C code, ready to be compiled by the native compiler of the system.

Here you can find short installation and usage guides, as well as some douments about OMPi internals. More documentation is provided within the source distribution, found in our download page.

If you want to cite OMPi in your work, please use the following publication:

V.V. Dimakopoulos, E. Leontiadis and G. Tzoumas, “A portable C compiler for OpenMP V.2.0”, in Proc. EWOMP 2003, 5th European Workshop on OpenMP, Aachen, Germany, Sept. 2003, pp. 5–11

You can also view all related publications.

Quick Installation Guide

  1. Extract the package
      gunzip zxvf ompi-X.Y.Z.tar.gz
    
  2. Configure the package (see below for advanced configuration options)
      ./configure --prefix=‹install-dir›
    
    Advanced configuration options

    If you want to enable debugging, give the --enable-debug option to ./configure (turned off by default).

    The compiler flags used to build the compiler & the libraries are just -O3. More often than not you may want to use different ones (such as -g). In such cases use:

      ./configure CFLAGS= CPPFLAGS= ... 
    

    The default compiler is determined by configure itself (and is usually gcc). If you want to use a different compiler (e.g. Intel icc), use:

      ./configure CC=icc ...
    

    The compiler & flags that OMPi will later use for compiling user programs are by default the ones used in ./configure time. If you want different ones, define OMPI_CC, OMPI_CPP, OMPI_CFLAGS and OMPI_CPPFLAGS environmental variables, before running ompicc, as described below.

    OMPi comes with multiple thread libraries, and can support even more (see the bundled doc/runtime.txt); “pthreads”, based on POSIX threads, is the default one. You can choose which one OMPi will be built with as follows:

      ./configure --with-ortlib=‹name› ...
    

    where ‹name› is any of the included libraries, or any other library you have developed.

    OMPi can support multiple OpenMP4 devices through device ‘modules’; by default, at configuration time it checks and builds all device modules that may be supported. You can choose which ones OMPi should be built with as follows:

      ./configure --with-modules="‹name› ‹name› ..." ...
    

    i.e. space-seperated module names, where each ‹name› is any of the modules OMPi ships with, or any other module you may have developed.

  3. Compile and install the package
      make
      make install
    
  4. Make sure ‹install-dir›/bin is in your PATH

For information about the configure script, see INSTALL in the bundled documentation.

Quick Usage Guide

Usage: ompicc [-k] [-v] [--ort=‹libname›] ‹cc-flags› files.c

Example:

  ompicc -o executable file1.c file2.c

Arguments:

  • all (g)cc flags
  • -k : the generated (transformed) file is kept after compilation
  • -K : all intermediate generated files are kept after compilation
  • -v : be verbose (shows all steps of the translation process)
  • --ort=‹libname› : use an alternative runtime library (see details below)
  • --devs="‹name› ‹name› ..." : target the given devices
  • --devinfo : show information about configured devices.
More usage details

OMPi is a source-to-source compiler, so after generating the multithreaded C program, it runs the system compiler — which by default is the one used during OMPi’s installation.

If you want to play with different system compilers, and different compilation flags, you can set three environmental variables to whatever you like: OMPI_CPP, OMPI_CC, OMPI_CPPFLAGS, OMPI_CFLAGS and OMPI_LDFLAGS. The first two specify the system preprocessor and compiler you like to use and the last three ones the particular flags you want. Make sure you set their values before running ompicc.

The --ort option lets you select any runtime library you might have built. For more information on this topic, please refer to the bundled doc/runtime.txt file.

Finally, based on OpenMP 4.0, OMPi supports attached devices that can execute offloaded code. Automatically configured devices are shown with the –devinfo flag.

Please, don’t forget to consult the implementation-specific OpenMP details for OMPi (HTML, PDF).

Internals

Below you can find documentation about the internal workings of OMPi. The guides are suitable for developers that want to modify OMPi in some way, e.g. its source-to-source translator and/or its runtime libraries.

Please notice that the documentation below is not quite up-to-date but should nevertheless be useful. You may contact the team for further inquiries.

  • » Information about the source-to-source translator of OMPi:
  • » Threading libraries in OMPi & how to write your own threading libraries:
  • » How OMPi runtime library handles worksharing regions:
  • » Details on the parts of the support for the OpenMP for-directive: