Skip to content

[CMake] oneMKL version macros #538

@hjabird

Description

@hjabird

Summary

There is currently no way to find the version of oneMKL interfaces from the headers. oneMKL interfaces should provide version macros.

This suggestion comes from a GROMACS PR - https://gitlab.com/gromacs/gromacs/-/merge_requests/4252#note_2000153975

Problem statement

The behaviour and features of oneMKL change depending on version. Whilst the version of oneMKL is discoverable from the CMake, it is not discoverable from source including oneMKL Interfaces. Consequently, it is difficult to enable or disable code according to version.

Preferred solution

@al42and suggests:

diff --git src/config.hpp.in src/config.hpp.in
index 5698abf..8c295d2 100644
--- src/config.hpp.in
+++ src/config.hpp.in
@@ -40,5 +40,9 @@
 #cmakedefine BUILD_SHARED_LIBS
 #cmakedefine REF_BLAS_LIBNAME "@REF_BLAS_LIBNAME@"
 #cmakedefine REF_CBLAS_LIBNAME "@REF_CBLAS_LIBNAME@"
+#define ONEMKL_VERSION "@PROJECT_VERSION@"
+#define ONEMKL_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
+#define ONEMKL_VERSION_MINOR @PROJECT_VERSION_MINOR@
+#define ONEMKL_VERSION_PATCH @PROJECT_VERSION_PATCH@

This is (helpfully) different from the macros exported by Intel oneMKL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIA request to add/change/fix/improve the API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions