Skip to content

Commit

Permalink
minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
slabasan committed Nov 15, 2023
1 parent 3b6c73b commit 1a8052d
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(BASIC_EXAMPLES
variorum-enable-turbo-example
variorum-get-node-power-json-example
variorum-get-node-power-domain-info-json-example
variorum-get-node-thermal-json-example
variorum-get-node-thermal-json-example
variorum-integration-using-json-example
variorum-get-topology-info-example
variorum-monitoring-to-file-example
Expand Down
2 changes: 0 additions & 2 deletions src/examples/variorum-get-node-power-json-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ int main(int argc, char **argv)
}

ret = variorum_get_node_power_json(&s);

if (ret != 0)
{
printf("First run: JSON get node power failed!\n");
Expand All @@ -65,7 +64,6 @@ int main(int argc, char **argv)
/* Print the entire JSON object */
puts(s);


#ifdef SECOND_RUN
for (i = 0; i < size; i++)
{
Expand Down
1 change: 0 additions & 1 deletion src/examples/variorum-get-node-thermal-json-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <variorum.h>
#include <variorum_topology.h>


int main(int argc, char **argv)
{
int ret;
Expand Down
17 changes: 7 additions & 10 deletions src/variorum/AMD_GPU/amd_gpu_power_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ void get_thermals_data(int chipid, int total_sockets, int verbose, FILE *output)
static int init = 0;
static struct timeval start;
struct timeval now;
int i;

gethostname(hostname, 1024);

Expand Down Expand Up @@ -316,8 +317,7 @@ void get_thermals_data(int chipid, int total_sockets, int verbose, FILE *output)

gettimeofday(&now, NULL);

for (int i = chipid * gpus_per_socket;
i < (chipid + 1) * gpus_per_socket; i++)
for (i = chipid * gpus_per_socket; i < (chipid + 1) * gpus_per_socket; i++)
{
int64_t temp_val = -1;
double temp_val_flt = -1.0;
Expand Down Expand Up @@ -381,7 +381,6 @@ void get_thermals_data(int chipid, int total_sockets, int verbose, FILE *output)

void get_thermals_json(int chipid, int total_sockets, json_t *output)
{

rsmi_status_t ret;
uint32_t num_devices;
int gpus_per_socket;
Expand Down Expand Up @@ -413,20 +412,20 @@ void get_thermals_json(int chipid, int total_sockets, json_t *output)
char socketid[12];
snprintf(socketid, 12, "socket_%d", chipid);

//check if socket object is in node object
// check if socket object is in node object
json_t *socket_obj = json_object_get(output, socketid);
if (socket_obj == NULL)
{
socket_obj = json_object();
json_object_set_new(output, socketid, socket_obj);
}

//gerneral gpu object
// general gpu object
json_t *gpu_obj = json_object();
json_object_set_new(socket_obj, "GPU", gpu_obj);

for (int i = chipid * gpus_per_socket;
i < (chipid + 1) * gpus_per_socket; i++)
int i;
for (i = chipid * gpus_per_socket; i < (chipid + 1) * gpus_per_socket; i++)
{
int64_t temp_val = -1;
double temp_val_flt = -1.0;
Expand All @@ -443,11 +442,10 @@ void get_thermals_json(int chipid, int total_sockets, json_t *output)

temp_val_flt = (double)(temp_val / (1000)); // Convert to Celcius.

//gpu entry
// gpu entry
char gpuid[32];
snprintf(gpuid, 32, "temp_celsius_gpu_%d", i);
json_object_set_new(gpu_obj, gpuid, json_real(temp_val_flt));

}

ret = rsmi_shut_down();
Expand All @@ -459,7 +457,6 @@ void get_thermals_json(int chipid, int total_sockets, json_t *output)
getenv("HOSTNAME"), __FILE__, __FUNCTION__,
__LINE__);
}

}

void get_clocks_data(int chipid, int total_sockets, int verbose, FILE *output)
Expand Down
2 changes: 0 additions & 2 deletions src/variorum/AMD_GPU/instinctGPU.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ int amd_gpu_instinct_get_thermals(int verbose)

int amd_gpu_instinct_get_thermals_json(json_t *get_thermal_obj)
{

char *val = getenv("VARIORUM_LOG");
if (val != NULL && atoi(val) == 1)
{
Expand All @@ -97,7 +96,6 @@ int amd_gpu_instinct_get_thermals_json(json_t *get_thermal_obj)
}

return 0;

}

int amd_gpu_instinct_get_clocks(int verbose)
Expand Down
2 changes: 0 additions & 2 deletions src/variorum/IBM/Power9.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ int ibm_cpu_p9_get_node_thermal_json(json_t *get_thermal_obj)
lseek(fd, iter * OCC_SENSOR_DATA_BLOCK_SIZE, SEEK_SET);

buf = malloc(OCC_SENSOR_DATA_BLOCK_SIZE);

if (!buf)
{
printf("Failed to allocate\n");
Expand Down Expand Up @@ -532,7 +531,6 @@ int ibm_cpu_p9_get_node_thermal_json(json_t *get_thermal_obj)

close(fd);
return 0;

}

int ibm_cpu_p9_get_node_power_domain_info_json(char **get_domain_obj_str)
Expand Down
7 changes: 2 additions & 5 deletions src/variorum/IBM/ibm_power_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ void json_get_thermal_sensors(int chipid, json_t *node_obj, const void *buf)
{
struct occ_sensor_data_header *hb;
struct occ_sensor_name *md;
int i;

hb = (struct occ_sensor_data_header *)(uint64_t)buf;
md = (struct occ_sensor_name *)((uint64_t)hb + be32toh(hb->names_offset));
Expand All @@ -483,9 +484,8 @@ void json_get_thermal_sensors(int chipid, json_t *node_obj, const void *buf)
json_t *mem_obj = json_object();
json_object_set_new(cpu_obj, "Mem", mem_obj);

for (int i = 0; i < be16toh(hb->nr_sensors); i++)
for (i = 0; i < be16toh(hb->nr_sensors); i++)
{

uint32_t offset = be32toh(md[i].reading_offset);
uint32_t scale = be32toh(md[i].scale_factor);
uint64_t sample = 0;
Expand Down Expand Up @@ -515,8 +515,5 @@ void json_get_thermal_sensors(int chipid, json_t *node_obj, const void *buf)

json_object_set_new(mem_obj, mem_temp, json_integer(sample * TO_FP(scale)));
}

}


}
1 change: 0 additions & 1 deletion src/variorum/Intel/Intel_06_3E.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ int intel_cpu_fm_06_3e_get_node_power_domain_info_json(char
*get_domain_obj_str = json_dumps(get_domain_obj, 0);
json_decref(get_domain_obj);
return 0;

}

int intel_cpu_fm_06_3e_get_thermals_json(json_t *get_thermal_obj)
Expand Down
1 change: 1 addition & 0 deletions src/variorum/Intel/Intel_06_9E.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ int intel_cpu_fm_06_9e_cap_best_effort_node_power_limit(int node_power_limit);
int intel_cpu_fm_06_9e_get_frequencies(void);

int intel_cpu_fm_06_9e_get_thermals_json(json_t *get_thermal_obj);

#endif
1 change: 0 additions & 1 deletion src/variorum/Intel/config_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ int set_intel_func_ptrs(int idx)
intel_cpu_fm_06_4f_get_frequencies;
g_platform[idx].variorum_get_thermals_json =
intel_cpu_fm_06_4f_get_thermals_json;

}
// Skylake 06_55
else if (*g_platform[idx].arch_id == FM_06_55)
Expand Down
4 changes: 2 additions & 2 deletions src/variorum/Intel/thermal_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>

#include <thermal_features.h>
#include <config_architecture.h>
#include <msr_core.h>
#include <variorum_error.h>
#include <string.h>

#ifdef LIBJUSTIFY_FOUND
#include <cprintf.h>
Expand Down
2 changes: 1 addition & 1 deletion src/variorum/Intel/thermal_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ int print_verbose_therm_temp_reading(FILE *writedest,
off_t msr_pkg_therm_stat,
off_t msr_temp_target);

/// #brief set json object string with temperature data
/// @brief set json object string with temperature data
int get_therm_temp_reading_json(json_t *get_thermal_object,
off_t msr_therm_stat,
off_t msr_pkg_therm_stat,
Expand Down
2 changes: 0 additions & 2 deletions src/variorum/Nvidia_GPU/Volta.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ int volta_get_thermals_json(json_t *get_thermal_obj)
}

return 0;


}

int volta_get_clocks(int long_ver)
Expand Down
3 changes: 2 additions & 1 deletion src/variorum/Nvidia_GPU/config_nvidia.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ int set_nvidia_func_ptrs(int idx)
/* Initialize control interfaces */
g_platform[idx].variorum_cap_each_gpu_power_limit =
volta_cap_each_gpu_power_limit;
g_platform[idx].variorum_get_thermals_json = volta_get_thermals_json;
g_platform[idx].variorum_get_thermals_json =
volta_get_thermals_json;
}
else
{
Expand Down
2 changes: 0 additions & 2 deletions src/variorum/Nvidia_GPU/nvidia_gpu_power_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ void nvidia_gpu_get_thermal_json(int chipid, json_t *output)
for (d = chipid * (int)m_gpus_per_socket;
d < (chipid + 1) * (int)m_gpus_per_socket; ++d)
{

nvmlDeviceGetTemperature(m_unit_devices_file_desc[d], NVML_TEMPERATURE_GPU,
&gpu_temp);

Expand All @@ -204,7 +203,6 @@ void nvidia_gpu_get_thermal_json(int chipid, json_t *output)
snprintf(device_id, 32, "temp_celsius_gpu_%d", d);
json_object_set_new(gpu_obj, device_id, json_integer(gpu_temp));
}

}

void nvidia_gpu_get_power_limits_data(int chipid, int verbose, FILE *output)
Expand Down
2 changes: 1 addition & 1 deletion src/variorum/variorum.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <stdlib.h>
#include <hwloc.h>
#include <jansson.h>
#include <unistd.h>
#include <sys/time.h>
#include <unistd.h>

#include <config_architecture.h>
#include <variorum.h>
Expand Down

0 comments on commit 1a8052d

Please sign in to comment.