Skip to content

Commit cc25dce

Browse files
committed
Add missing ompd.h file, add runtime version function
1 parent 5307609 commit cc25dce

File tree

3 files changed

+948
-9
lines changed

3 files changed

+948
-9
lines changed

libompd/src/omp-debug.cpp

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define NDEBUG 1
1515

1616
#include "omp-debug.h"
17+
#include "omp.h"
1718
#include "ompd.h"
1819
// #include <stdio.h>
1920
#include "TargetValue.h"
@@ -78,6 +79,37 @@ ompd_process_initialize(ompd_address_space_context_t
7879
return ompd_rc_ok;
7980
}
8081

82+
ompd_rc_t
83+
ompd_get_openmp_version(ompd_address_space_handle_t
84+
*addr_handle, /* IN: handle for the address space */
85+
ompd_word_t *version) {
86+
if (!addr_handle)
87+
return ompd_rc_stale_handle;
88+
ompd_address_space_context_t *context = addr_handle->context;
89+
ompd_rc_t ret;
90+
91+
if (!context)
92+
return ompd_rc_stale_handle;
93+
94+
assert(callbacks && "Callback table not initialized!");
95+
96+
ret = TValue(context, "__kmp_openmp_version")
97+
.castBase(ompd_type_int)
98+
.getValue(*version);
99+
return ret;
100+
}
101+
102+
ompd_rc_t ompd_get_openmp_version_string(
103+
ompd_address_space_handle_t
104+
*addr_handle, /* IN: handle for the address space */
105+
const char **string) {
106+
if (!addr_handle)
107+
return ompd_rc_bad_input;
108+
static const char *omp_version = "";
109+
*string = omp_version;
110+
return ompd_rc_ok;
111+
}
112+
81113
ompd_rc_t ompd_release_address_space_handle(
82114
ompd_address_space_handle_t
83115
*addr_handle /* IN: handle for the address space */
@@ -1424,24 +1456,18 @@ ompd_rc_t ompd_get_task_function(
14241456

14251457
/* --- 9 OMPD Version and Compatibility Information ------------------------- */
14261458

1427-
ompd_rc_t ompd_get_api_version(int *version) {
1459+
ompd_rc_t ompd_get_api_version(ompd_word_t *version) {
14281460
*version = OMPD_VERSION;
14291461
return ompd_rc_ok;
14301462
}
14311463

14321464
ompd_rc_t
14331465
ompd_get_api_version_string(const char **string /* OUT: OMPD version string */
14341466
) {
1435-
/* static char version_string[256]={0};
1436-
if(version_string[0]=='\0')
1437-
sprintf(version_string, "LLVM OpenMP %i.%i Debugging Library implemnting
1438-
TR %i%c",OMPD_IMPLEMENTS_OPENMP, OMPD_IMPLEMENTS_OPENMP_SUBVERSION,
1439-
OMPD_TR_VERSION, OMPD_TR_SUBVERSION);*/
14401467
static const char version_string[] =
14411468
"LLVM OpenMP " STR(OMPD_IMPLEMENTS_OPENMP) "." STR(
1442-
OMPD_IMPLEMENTS_OPENMP_SUBVERSION) " Debugging Library implemnting "
1443-
"TR " STR(OMPD_TR_VERSION) "" STR(
1444-
OMPD_TR_SUBVERSION);
1469+
OMPD_IMPLEMENTS_OPENMP_SUBVERSION) " Debugging Library implmenting "
1470+
"TR " STR(OMPD_TR_VERSION) "" STR(OMPD_TR_SUBVERSION);
14451471
*string = version_string;
14461472
return ompd_rc_ok;
14471473
}

libompd/src/omp-debug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <cstdlib>
1616
#include <new>
1717

18+
#define OMPD_DLL_VERSION 201811;
19+
1820
extern "C" {
1921
#endif
2022

0 commit comments

Comments
 (0)