Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int32_t GPUReconstructionCUDA::InitDevice_Runtime()
bestDeviceSpeed = deviceSpeed;
} else {
if (GetProcessingSettings().debugLevel >= 2 && GetProcessingSettings().deviceNum < 0) {
GPUInfo("Skipping: Speed %f < %f\n", deviceSpeed, bestDeviceSpeed);
GPUInfo("Skipping: Speed %f <= %f\n", deviceSpeed, bestDeviceSpeed);
}
}
}
Expand Down
46 changes: 46 additions & 0 deletions GPU/GPUTracking/Definitions/Parameters/csv_to_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

[[ -z $1 ]] && { echo "Usage: csv_to_json.sh CSV_FILE"; exit 1; }

awk -vFPAT='([^,]*)|(\"([^\"]|\"\")*\")' \
'BEGIN {
print "{"
} {
if (count == 0) {
for (i = 1; i <= NF; i++) {
names[i] = $i
}
} else if ($1 == "CORE:" || $1 == "LB:" || $1 == "PAR:") {
if (paramprinted) print "\n }"
else if (lineprinted) print ""
if (catprinted) print " },"
lineprinted = 0
paramprinted = 0
catprinted = 1
gsub(/:$/, "", $1)
print " \""$1"\": {";
} else if ($1 != "") {
if (lineprinted) print ""
if (paramprinted) print " },"
lineprinted = 0
paramprinted = 1
print " \""$1"\": {";
lineprinted = 0
for (i=2; i<=NF; i++) {
if ($i != "") {
gsub(/^"/, "", $i)
gsub(/"$/, "", $i)
gsub(/""/, "\"", $i)
if (lineprinted) print ","
lineprinted = 1
printf(" \"%s\": %s", names[i], $i)
}
}
}
count++;
} END {
if (paramprinted) print "\n }"
if (catprinted) print " }"
print "}"
}' \
$1
50 changes: 50 additions & 0 deletions GPU/GPUTracking/Definitions/Parameters/json_to_csv.python
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env python3
import sys, json, csv, string

if len(sys.argv) != 3:
sys.exit("usage: json2csv.py input.json output.csv")

try:
data = json.load(open(sys.argv[1]))
except Exception:
sys.exit("invalid json")

if set(data) != {"CORE", "LB", "PAR"}:
sys.exit("invalid categories")

arches = []
seen = set()
for cat in data.values():
if not isinstance(cat, dict):
sys.exit("data not 2-dimensional")
for param in cat.values():
if not isinstance(param, dict):
sys.exit("data not 2-dimensional")
for a in param.keys():
if a not in seen:
seen.add(a)
arches.append(a)

cols = 1 + len(arches)
empty = [""] * cols

with open(sys.argv[2], "w", newline="") as f:
w = csv.writer(f, lineterminator="\n")
w.writerow(["Architecture", *arches])
w.writerow(empty)
cats = list(data.items())
for ci, (cname, cat) in enumerate(cats):
w.writerow([f"{cname}:"] + [""] * (cols - 1))
for pname, param in cat.items():
row = [pname]
for a in arches:
v = param.get(a, "")
if isinstance(v, list):
row.append(json.dumps(v))
elif isinstance(v, str) and not v == "":
row.append('"' + v + '"')
else:
row.append(v)
w.writerow(row)
if ci != len(cats) - 1:
w.writerow(empty)