Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] oneMKL version macros #538

Open
hjabird opened this issue Jul 15, 2024 · 2 comments
Open

[CMake] oneMKL version macros #538

hjabird opened this issue Jul 15, 2024 · 2 comments
Labels
API A request to add/change/fix/improve the API

Comments

@hjabird
Copy link
Contributor

hjabird commented Jul 15, 2024

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.

@hjabird
Copy link
Contributor Author

hjabird commented Jul 15, 2024

My only thought is that we might follow Intel MKL with the version being a number:

+#define ONEMKL_VERSION (@PROJECT_VERSION_MAJOR@*100+@PROJECT_VERSION_MINOR@)*100+@PROJECT_VERSION_PATCH@

@hjabird hjabird changed the title oneMKL version macros [CMake] oneMKL version macros Jul 15, 2024
@Rbiessy
Copy link
Contributor

Rbiessy commented Aug 28, 2024

This is being discussed in uxlfoundation/oneAPI-spec#561

@Rbiessy Rbiessy added the API A request to add/change/fix/improve the API label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API A request to add/change/fix/improve the API
Projects
None yet
Development

No branches or pull requests

2 participants