Skip to content

Commit 954a40b

Browse files
danbevggerganov
authored andcommitted
ggml : add version function to get lib version (ggml/1286)
* ggml : add version function to get lib version This commit adds a function `ggml_version()` to the ggml library that returns the version of the library as a string. The motivation for this is that it can be useful to be able to programmatically check the version of the ggml library being used. Usage: ```c printf("GGML version: %s\n", ggml_version()); ``` Output: ```console GGML version: 0.0.2219 ``` * ggml : add ggml_commit() --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 280cfd9 commit 954a40b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ggml/include/ggml.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,9 @@ extern "C" {
646646

647647
// misc
648648

649+
GGML_API const char * ggml_version(void);
650+
GGML_API const char * ggml_commit(void);
651+
649652
GGML_API void ggml_time_init(void); // call this once at the beginning of the program
650653
GGML_API int64_t ggml_time_ms(void);
651654
GGML_API int64_t ggml_time_us(void);

ggml/src/ggml.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,14 @@ bool ggml_guid_matches(ggml_guid_t guid_a, ggml_guid_t guid_b) {
473473
return memcmp(guid_a, guid_b, sizeof(ggml_guid)) == 0;
474474
}
475475

476+
const char * ggml_version(void) {
477+
return GGML_VERSION;
478+
}
479+
480+
const char * ggml_commit(void) {
481+
return GGML_COMMIT;
482+
}
483+
476484
//
477485
// timing
478486
//

0 commit comments

Comments
 (0)