OpenMP support
IBM® XL C/C++ for Linux®, V16.1.1 fully supports the OpenMP API V4.5 specification. Starting from V16.1.1.12, OpenMP 5.0 and 5.1 are partially supported.
The new OpenMP support falls into the following categories:
New directives
In addition to the existing OpenMP directives, IBM XL C/C++ for Linux 16.1.1 adds support for the following directives and their clauses.- omp declare reduction
- Use the omp declare reduction directive to define custom reductions. This directive declares a reduction-identifier that you can use in a reduction clause.
IBM XL C/C++ for Linux
16.1.1.12 adds
support for the following directives and their clauses.
- omp requires
- Use the omp requires directive with the unified_shared_memory clause to guarantee that the host and target devices use a unified address space.
New clauses
Updated clauses
The following clauses are updated in IBM XL C/C++ for Linux 16.1.1.- reduction_clause
- You can now specify array and array section list items in the reduction clause. To learn more about the array section, see "2.4 Array Sections" in the OpenMP 4.5 specifications.
New built-in functions
IBM XL C/C++ for Linux
16.1.1.12 adds
support for the following built-in
functions.
- omp_aligned_alloc
- Requests a memory allocation from a memory allocator with a specified alignment.
- omp_aligned_calloc
- Requests a zero initialized memory allocation from a memory allocator with a specified alignment.
- omp_alloc
- Requests a memory allocation from a memory allocator.
- omp_calloc
- Requests a zero initialized memory allocation from a memory allocator.
- omp_destroy_allocator
- Releases all resources used by the allocator handle.
- omp_free
- Deallocates previously allocated memory.
- omp_fulfill_event
- Fulfills and destroys an OpenMP allow-completion event.
- omp_get_default_allocator
- Returns a handle to the default memory allocator.
- omp_init_allocator
- Initializes an allocator and associates the allocator with a memory space.
- omp_realloc
- Deallocates previously allocated memory and requests a memory allocation from a memory allocator.
- omp_set_default_allocator
- Sets the default memory allocator to be used by OpenMP allocation calls that do not specify an allocator.
New environment variables
IBM XL C/C++ for
Linux
16.1.1 adds support for the following new environment variables for OpenMP.
- OMP_DEV_HEAPSIZE
- You can use the OMP_DEV_HEAPSIZE environment variable to control the size of the heap used by malloc() and free() device system calls for processes created by the OpenMP implementation to run on the device.
- OMP_DEV_STACKSIZE
- You can use the OMP_DEV_STACKSIZE environment variable to control the size of the stack for threads created by the OpenMP implementation to run on the device.
- OMP_NUM_TEAMS
- You can use the OMP_NUM_TEAMS environment variable to set the number of teams to use for the omp teams constructs on the device.
IBM XL C/C++ for Linux
16.1.1.12 adds
support for the following new environment variable for OpenMP.
- OMP_ALLOCATOR
- You can use the OMP_ALLOCATOR environment variable to set the initial default allocator to one of the predefined allocators for allocation calls that do not specify an allocator.
Updated environment variables
The following environment variable for OpenMP is updated in IBM XL C/C++ for
Linux
16.1.1.
- OMP_DISPLAY_ENV
- The new DEBUG value for OMP_DISPLAY_ENV displays the stack size and heap size that are in effect for a device. With OMP_DISPLAY_ENV=true, the values you specify for the OMP_DEV_HEAPSIZE and OMP_DEV_STACKSIZE environment variables are displayed in kilobytes. With OMP_DISPLAY_ENV=verbose, help information about the OMP_DEV_HEAPSIZE and OMP_DEV_STACKSIZE environment variables is displayed in addition to the information displayed in OMP_DISPLAY_ENV=true.
The following environment variable for OpenMP is updated in IBM XL C/C++ for Linux
16.1.1.12.
- XLSMPOPTS
- The targetmem option is added to specify the unified shared memory mode.
New compiler options
The following compiler option for OpenMP is added in IBM XL C/C++ for Linux
16.1.1.12.
- -qxflag=check_missing_requires
- This new option issues an informational message on the potentially missing omp requires directive in a program unit when the use of the omp requires directive is required.