Skip to content

Commit

Permalink
Fix linking with APMIDG for Intel GPUs (#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad authored Jun 27, 2024
1 parent bdd3a81 commit 87d3861
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/variorum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ if(LIBJUSTIFY_FOUND)
endif()

if(VARIORUM_WITH_INTEL_GPU)
target_link_libraries(variorum PUBLIC ${APMIDG_HEADER})
target_link_libraries(variorum PUBLIC ${APMIDG_LIBRARY})
endif()
if(VARIORUM_WITH_NVIDIA_GPU)
target_link_libraries(variorum PUBLIC ${NVML_HEADER})
Expand Down
12 changes: 6 additions & 6 deletions src/variorum/Intel_GPU/intel_gpu_power_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ void get_clocks_data(int chipid, int verbose, FILE *output)
if (verbose)
{
#ifdef LIBJUSTIFY_FOUND
cfprintf(output, "%s: %s, %s: %d, %s: %d, %s: %d %s\n"
"_INTEL_GPU_CLOCKS Host", m_hostname, "Socket", chipid, "DeviceID", d,
"GPU_Clock", (int)freq_MHz, "MHz");
cfprintf(output,
"_INTEL_GPU_CLOCKS Host: %s, Socket: %d, DeviceID: %d, GPU_Clock: %d MHz\n",
m_hostname, chipid, d, (int)freq_MHz);
#else
fprintf(output, "%s: %s, %s: %d, %s: %d, %s: %d %s\n"
"_INTEL_GPU_CLOCKS Host", m_hostname, "Socket", chipid, "DeviceID", d,
"GPU_Clock", (int)freq_MHz, "MHz");
fprintf(output,
"_INTEL_GPU_CLOCKS Host: %s, Socket: %d, DeviceID: %d, GPU_Clock: %d MHz\n",
m_hostname, chipid, d, (int)freq_MHz);
#endif
}
else
Expand Down
59 changes: 28 additions & 31 deletions src/variorum/variorum.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,41 +1202,38 @@ int variorum_get_utilization_json(char **get_util_obj_str)
{
return -1;
}
if (str != NULL)
token = strtok(str, d);
sum = 0;
// get required values to compute cpu utilizations
while (token != NULL)
{
token = strtok(str, d);
sum = 0;
// get required values to compute cpu utilizations
while (token != NULL)
token = strtok(NULL, d);
if (token != NULL)
{
token = strtok(NULL, d);
if (token != NULL)
sum += strtol(token, &p, 10);
if (i == 3)
{
sum += strtol(token, &p, 10);
if (i == 3)
{
idle = strtol(token, &p, 10);
}
if (i == 0)
{
user_time = strtol(token, &p, 10);
}
if (i == 1)
{
nice_time = strtol(token, &p, 10);
}
if (i == 2)
{
sys_time = strtol(token, &p, 10);
}
if (i == 4)
{
iowait = strtol(token, &p, 10);
}
sum_idle = idle + iowait;
sum_user_time = user_time + nice_time;
i++;
idle = strtol(token, &p, 10);
}
if (i == 0)
{
user_time = strtol(token, &p, 10);
}
if (i == 1)
{
nice_time = strtol(token, &p, 10);
}
if (i == 2)
{
sys_time = strtol(token, &p, 10);
}
if (i == 4)
{
iowait = strtol(token, &p, 10);
}
sum_idle = idle + iowait;
sum_user_time = user_time + nice_time;
i++;
}
}

Expand Down

0 comments on commit 87d3861

Please sign in to comment.