2.3. Compile OmpSs-2 programs

For OmpSs-2 programs that run in SMP or NUMA systems, you do not have to do anything. Just pick one of the drivers above.

Following is a very simple OmpSs-2 program in C:

/* test.c */
#include <stdio.h>

int main(int argc, char *argv[])
{
  int x = argc;
  #pragma oss task inout(x)
  {
    x++;
  }
  #pragma oss task in(x)
  {
    printf("argc + 1 == %d\n", x);
  }
  #pragma oss taskwait
  return 0;
}

Compile it using mcc:

$ mcc -o test --ompss-2 test.c
Nanos++ prerun
Nanos++ phase

Important

Do not forget the flag --ompss-2 otherwise your program will be compiled without parallel support.

And run it:

$ ./test
argc + 1 == 2

2.3.1. Compile OpenMP programs with OmpSs-2 support

Warning

Experimental flag. There are no guarantees the generated code behaves as the OpenMP program.

--openmp-compatibility
will support some constructs of OpenMP (e.g. taskloop, parallel for, etc.)