-
Notifications
You must be signed in to change notification settings - Fork 58
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
cannot convert json_t*
to char**
in variorum connector, gcc 12.2.1
#273
Comments
Have you tried #265 with a recent |
This is likely wrong and according to the example in https://variorum.readthedocs.io/en/latest/VariorumTools.html diff --git a/profiling/variorum-connector/variorum-connector.cpp b/profiling/variorum-connector/variorum-connector.cpp
index 14c4431..5591800 100644
--- a/profiling/variorum-connector/variorum-connector.cpp
+++ b/profiling/variorum-connector/variorum-connector.cpp
@@ -89,15 +89,16 @@ bool mpiOutPut = false;
// value.
std::string variorum_print_power_call() {
std::string outputString;
- json_t* power_obj = json_object();
+ char* s = NULL;
double power_node, power_sock0, power_mem0, power_gpu0;
double power_sock1, power_mem1, power_gpu1;
int ret;
- ret = variorum_get_node_power_json(power_obj);
+ ret = variorum_get_node_power_json(&s);
if (ret != 0) {
return "Print power failed!\n";
}
// total node measurment
+ json_t * power_obj = json_loads(s, JSON_DECODE_ANY, NULL);
power_node = json_real_value(json_object_get(power_obj, "power_node"));
const char* hostnameChar =
json_string_value(json_object_get(power_obj, "hostname"));
@@ -142,14 +143,14 @@ std::string variorum_print_power_call() {
// print json fails. No return value.
char* variorum_json_call() {
int ret;
- json_t* my_power_obj = NULL;
- my_power_obj = json_object();
- ret = variorum_get_node_power_json(my_power_obj);
+ char* s = NULL;
+ ret = variorum_get_node_power_json(&s);
if (ret != 0) {
printf("First run: JSON get node power failed!\n");
}
- char* s = json_dumps(my_power_obj, 0);
- return s;
+ json_t* my_power_obj = json_loads(s, JSON_DECODE_ANY, NULL);
+ char* s_dump = json_dumps(my_power_obj, 0);
+ return s_dump;
}``` |
Again, we rewrote this tool in #265. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kokkos-tools/profiling/variorum-connector/variorum-connector.cpp
Line 96 in a9453b2
gcc 12.2.1 on rzadams
The text was updated successfully, but these errors were encountered: