Octopus
openblas_version.c
Go to the documentation of this file.
1#include <string.h>
2#include <stdio.h>
3
4#if defined(__APPLE__)
5extern char *openblas_get_config(void) __attribute__((weak_import));
6#else
7extern char *openblas_get_config(void) __attribute__((weak));
8#endif
9
16int openblas_get_version(int *major, int *minor, int *patch) {
17 // Permissive rather than defensive. Assume if openblas configuration
18 // cannot be retrieved, we are probably not using openblas as a backend
19 if (!openblas_get_config) {
20 return 1;
21 }
22 /* string guaranteed to start with OpenBLAS:
23 static char* openblas_config_str=""
24 "OpenBLAS "
25 VERSION
26 " "
27 See https://github.com/OpenMathLib/OpenBLAS/blob/develop/driver/others/openblas_get_config.c
28 */
29 if (sscanf(openblas_get_config(), "OpenBLAS %d.%d.%d", major, minor, patch) != 3) {
30 return 0;
31 }
32 return 1;
33}
void __leaf__ __attribute__((__nonnull__(1, 2)))