Last active
February 1, 2018 09:09
-
-
Save eriktorsner/ac2306b08de26484300649be1c8d15d6 to your computer and use it in GitHub Desktop.
Small script to display AMD GPU ordering in xmr-stak vs OverdriveNTool.
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
/******************************************************** | |
* | |
* Small script to display AMD GPU ordering in xmr-stak vs OverdriveNTool. | |
* | |
* To run this script, you first need to create a correctly named | |
* textfile with clinfo output. Use this command to create the file: | |
* | |
* C:\some\folder> clinfo | findstr "Device Topology" > clinfo_topology.txt | |
* | |
* TIP: Add the above command to your windows startup script, that way you | |
* ensure that this script always works as intended regardless of any | |
* recent hardware changes. | |
* | |
* NOTE: Avoid running the above command while xmr-stak is working, if | |
* your cards are at or near the limit, clinfo can trigger a crash. | |
* | |
* When you have created the text file., run this script to see | |
* how card order in xmr-stak relates to OverdriveNTool: | |
* | |
* C:\some\folder> cscript cardMap.js | |
* | |
**********************************************************/ | |
/********************************* | |
* | |
* Initialize | |
* | |
**********************************/ | |
oShell = WScript.CreateObject("Wscript.Shell"); | |
oFso = WScript.CreateObject("Scripting.FileSystemObject"); | |
/********************************* | |
* | |
* Get clinfo topology | |
* | |
**********************************/ | |
file = oFso.OpenTextFile('clinfo_topology.txt', 1); | |
output = file.ReadAll(); | |
file.close(); | |
/********************************* | |
* | |
* Parse | |
* | |
**********************************/ | |
rows = output.split("\r\n"); | |
cards = []; | |
for(i=0;i<rows.length;i++) { | |
row = rows[i]; | |
cols = row.split(" "); | |
if (cols.length == 9) { | |
bus = cleanPCIPart(cols[5]); | |
dev = cleanPCIPart(cols[6]); | |
fun = cleanPCIPart(cols[7]); | |
card = {xmr: i, bus: bus, dev: dev, fun: fun}; | |
cards[cards.length] = card; | |
} | |
} | |
/********************************* | |
* | |
* Figure out OD order | |
* | |
**********************************/ | |
cards.sort(function(a, b) { | |
return a.bus - b.bus; | |
}); | |
for(i=0;i<cards.length;i++) { | |
card = cards[i]; | |
card.odntOrder = i + 1; | |
} | |
cards.sort(function(a, b) { | |
return a.xmr - b.xmr; | |
}); | |
/********************************* | |
* | |
* Report | |
* | |
**********************************/ | |
for(i=0;i<cards.length;i++) { | |
card = cards[i]; | |
WScript.Echo("xmr-stak: " + card.xmr + " OverdriveNTool: " + card.odntOrder); | |
} | |
function cleanPCIPart(part) { | |
part = part.replace("B#", ""); | |
part = part.replace("D#", ""); | |
part = part.replace("F#", ""); | |
part = part.replace(",", ""); | |
return parseInt(part); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment