Is it possible to use C ++ attributes to replace OpenMP pragmas?

C ++ attributes provide a convenient and standardized way to mark up code with additional information provided to the compiler and / or other tools.

Using OpenMP involves adding a large number of #pragma omp... lines to the source (for example, to mark a loop for parallel processing). These #pragma lines seem like great candidates for an object, such as generic attributes.

For example, #pragma omp parallel for can become [[omp::parallel(for)]] .

Often inaccurate cppreference.com uses an attribute like the example here , which confirms that it has at least been reviewed (by someone).

Is there a mapping of OpenMP pragmas to C ++ attributes currently available and supported by any / all major compilers? If not, are there any plans to create one?

+6
source share

All Articles