On Mon, Jun 22, 2020 at 1:47 PM Jakub Jelinek via Gcc <gcc@gcc.gnu.org> wrote:
>
> On Sat, Jun 20, 2020 at 01:26:59PM -0400, y2s1982 . via Gcc wrote:
> > I have a question on API version formatting.
> > I have been looking at the get_api_version() and get_api_version_string()
> > documentation:
> > https://www.openmp.org/spec-html/5.0/openmpsu213.html#x269-17920005.5.1.2
> > I also saw how LLVM implements it using macro to store the information:
> > https://github.com/OpenMPToolsInterface/LLVM-openmp/blob/3b6c06e354ef1e59da22778a9033d87ed0e3b19d/libompd/src/omp-debug.h#L22-L28
> > These values are then used here:
> > https://github.com/OpenMPToolsInterface/LLVM-openmp/blob/3b6c06e354ef1e59da22778a9033d87ed0e3b19d/libompd/src/omp-debug.cpp#L1344-L1358
>
> We don't support any TRs and I think we aren't going to, so just encoding
> there the 5.0 numbers should be good enough.
> If the 4 separate bytes of the version isn't something written somewhere in
> the standard, I'd use something along the lines of
> #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
> macro, so make it
> #define OMPD_VERSION (5 * 10000 + 0 * 100 + 0)
> so there is some room for minor revisions below that.

I may be mistaken, but I believe OpenMP version information is
provided in the OPENMP macro. It is a date,and it is used to detect
the conformance level of OpenMP.

For example, to avoid compile problems with code that can be compiled
with MSVC (Microsoft provides an ancient version of OpenMP):

inline void BlockCopy(byte* dest, byte* src, size_t len)
{
// OpenMP 4.0 released July 2013.
#if _OPENMP >= 201307
    #pragma omp simd
    for (size_t i = 0; i < len; ++i)
        dest[i] = src[i];
#else
    for (size_t i = 0; i < len; ++i)
        dest[i] = src[i];
#endif
}

Jeff

Reply via email to