-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add json output for thermal data (#461)
- add variorum_get_thermal_json function interfaces - add docs - supports AMD GPUs, nVidia GPUs, Intel CPUs, IBM Power9 CPUs
- Loading branch information
Showing
40 changed files
with
714 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.. # Copyright 2019-2023 Lawrence Livermore National Security, LLC and other | ||
# Variorum Project Developers. See the top-level LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: MIT | ||
########## | ||
JSON API | ||
########## | ||
|
||
******************************* | ||
Obtaining Thermal Information | ||
******************************* | ||
|
||
The API to obtain node thermal has the following format. It takes a string | ||
(``char**``) by reference as input, and populates this string with a nested | ||
JSON object with hostname, followed by socket_{number}, followed by CPU and or | ||
GPU (depending on the platform, may contain only one or both), followed by Core | ||
and Mem for CPU. | ||
|
||
The ``variorum_get_thermals_json(char **)`` function returns a string type | ||
nested JSON object. An example is provided below:: | ||
|
||
{ | ||
"hostname": { | ||
"Socket_0": { | ||
"CPU": { | ||
"Core": { | ||
"temp_celsius_core_0": (Integer), | ||
... | ||
"temp_celsius_core_i": (Integer), | ||
}, | ||
"Mem": { | ||
"temp_celsius_dimm_0": (Integer), | ||
... | ||
:temp_celsius_dimm_i": (Integer), | ||
}, | ||
}, | ||
"GPU": { | ||
"temp_celsius_gpu_0": (Integer), | ||
... | ||
"temp_celsius_gpu_i": (Integer), | ||
} | ||
}, | ||
"timestamp" : (Integer) | ||
} | ||
} | ||
|
||
Here, ``i`` is the index of the core or GPU and ``0 <= i < num_cores/GPUs``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2019-2023 Lawrence Livermore National Security, LLC and other | ||
// Variorum Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include <getopt.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include <variorum.h> | ||
#include <variorum_topology.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
int ret; | ||
char *s = NULL; | ||
|
||
const char *usage = "Usage: %s [-h] [-v]\n"; | ||
int opt; | ||
while ((opt = getopt(argc, argv, "hv")) != -1) | ||
{ | ||
switch (opt) | ||
{ | ||
case 'h': | ||
printf(usage, argv[0]); | ||
return 0; | ||
case 'v': | ||
printf("%s\n", variorum_get_current_version()); | ||
return 0; | ||
default: | ||
fprintf(stderr, usage, argv[0]); | ||
return -1; | ||
} | ||
} | ||
|
||
ret = variorum_get_thermals_json(&s); | ||
if (ret != 0) | ||
{ | ||
printf("First run: JSON get thermals failed!\n"); | ||
free(s); | ||
exit(-1); | ||
} | ||
|
||
/* Print the entire JSON object */ | ||
puts(s); | ||
|
||
/* Deallocate the string */ | ||
free(s); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.