Skip to content

Commit

Permalink
Add event lists to perfctr
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTheBear committed Oct 22, 2019
1 parent 2aecf57 commit 2189749
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
47 changes: 40 additions & 7 deletions src/applications/likwid-perfctr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,23 @@ if print_events == true then
end
print_stdout(outstr)
end
---------------------------
if gputopo then
tab = likwid.getGpuEventsAndCounters()
print_stdout("\n\n")
print_stdout(string.format("The GPUs have %d events.",#tab["Events"]))
for _, eventTab in pairs(tab["Events"]) do
print_stdout(eventTab)
for d=0,tab["numDevices"]-1,1 do
if tab["devices"][d] then
print_stdout("\n\n")
print_stdout(string.format("The GPUs %d provides %d events.", d, #tab["devices"][d]))
print_stdout("You can use as many GPUx counters until you get an error.")
print_stdout("Event tags (tag, counters)")
for _,e in pairs(tab["devices"][d]) do
outstr = string.format("%s, %s", e["Name"], e["Limit"])
print_stdout(outstr)
end
end
end
end
---------------------------
os.exit(0)
end

Expand Down Expand Up @@ -518,20 +527,44 @@ if print_event ~= nil then
end
end
end
---------------------------
if gputopo then
tab = likwid.getGpuEventsAndCounters()
for d=0,tab["numDevices"]-1,1 do
for _,e in pairs(tab["devices"][d]) do
if e["Name"]:match(case_insensitive_pattern(print_event)) then
local f = false
for _,x in pairs(events) do
if e["Name"] == x["Name"] then
f = true
break
end
end
if not f then
table.insert(events, e)
counters["GPU"] = {["Name"] = "GPU", ["TypeName"] = "Nvidia GPU counters"}
end
end
end
end
end
---------------------------
print_stdout(string.format("Found %d event(s) with search key %s:", #events, print_event))
for _, eventTab in pairs(events) do
outstr = eventTab["Name"] .. ", "
outstr = outstr .. string.format("0x%X, 0x%X, ",eventTab["ID"],eventTab["UMask"])
if (eventTab["ID"] and eventTab["UMask"]) then
outstr = outstr .. string.format("0x%X, 0x%X, ",eventTab["ID"],eventTab["UMask"])
end
outstr = outstr .. eventTab["Limit"]
if #eventTab["Options"] > 0 then
if eventTab["Options"] and #eventTab["Options"] > 0 then
outstr = outstr .. string.format(", %s",eventTab["Options"])
end
print_stdout(outstr)
end
print_stdout("\nUsable counter(s) for above event(s):")
for i, counter in pairs(counters) do
outstr = string.format("%s, %s", counter["Name"], counter["TypeName"]);
if counter["Options"]:len() > 0 then
if counter["Options"] and counter["Options"]:len() > 0 then
outstr = outstr .. string.format(", %s",counter["Options"])
end
print_stdout(outstr)
Expand Down
9 changes: 5 additions & 4 deletions src/applications/likwid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ likwid.setresuser = likwid_setresuser

likwid.getGpuTopology = likwid_getGpuTopology
likwid.putGpuTopology = likwid_putGpuTopology
--likwid.getGpuEventsAndCounters = likwid_getGpuEventsAndCounters
likwid.getGpuEventsAndCounters = likwid_getGpuEventsAndCounters
likwid.getGpuGroups = likwid_getGpuGroups
likwid.gpustr_to_gpulist = likwid_gpustr_to_gpulist
likwid.gpuGetNameOfGroup = likwid_gpuGetNameOfGroup
Expand Down Expand Up @@ -1397,11 +1397,12 @@ local function printGpuOutput(results, metrics, gpulist, region, stats)
secondtab[1] = {"Metric"}
secondtab_combined[1] = {"Metric"}
for m=1, likwid.gpuMarkerRegionMetrics(g) do
table.insert(secondtab[1], likwid.getNameOfMetric(g, m))
table.insert(secondtab_combined[1], likwid.getNameOfMetric(g, m).." STAT" )
local mname = likwid.gpuGetNameOfMetric(g, m)
table.insert(secondtab[1], mname)
table.insert(secondtab_combined[1], mname .." STAT" )
end
for c, gpu in pairs(cur_gpulist) do
local tmpList = {"GPU "..tostring(cpu)}
local tmpList = {"GPU "..tostring(gpu)}
for m=1, likwid.gpuMarkerRegionMetrics(g) do
local tmp = tostring(likwid.num2str(metrics[g][m][c]))
table.insert(tmpList, tmp)
Expand Down

0 comments on commit 2189749

Please sign in to comment.