Skip to content

Commit

Permalink
Merge pull request #132 from guacamoleo/develop
Browse files Browse the repository at this point in the history
fixing logic and hardcoded paths
  • Loading branch information
guacamoleo authored Nov 20, 2017
2 parents f972ec8 + 24d2338 commit 2a7284f
Show file tree
Hide file tree
Showing 12 changed files with 237 additions and 134 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ def docker_build_inside_image( def build_image, compiler_data compiler_args, doc
tensile ${rel_path_to_src}/Tensile/Configs/test_sgemm_vectors.yaml sgemm_vectors
# tensor contractions
tensile ${rel_path_to_src}/Tensile/Configs/tensor_contraction.yaml tensor_contraction
tensile ${rel_path_to_src}/Tensile/Configs/test_tensor_contraction.yaml tensor_contraction
# assembly
tensile ${rel_path_to_src}/Tensile/Configs/sgemm_asm.yaml sgemm_asm
tensile ${rel_path_to_src}/Tensile/Configs/test_sgemm_asm.yaml sgemm_asm
"""

// TODO re-enable when jenkins supports opencl
Expand Down
12 changes: 6 additions & 6 deletions Tensile/ClientWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def writeRunScript(path, libraryLogicPath, forBenchmark):
runScriptFile.write(os.path.join(globalParameters["CMakeBuildType"], \
"client.exe") )
else:
if globalParameters["PinClocks"]:
runScriptFile.write("/opt/rocm/bin/rocm-smi -d 0 --setfan 255 --setsclk 7\n")
if globalParameters["PinClocks"] and globalParameters["ROCmSMIPath"]:
runScriptFile.write("%s -d 0 --setfan 255 --setsclk 7\n" % globalParameters["ROCmSMIPath"])
runScriptFile.write("sleep 1\n")
runScriptFile.write("/opt/rocm/bin/rocm-smi -d 0 -a\n")
runScriptFile.write("%s -d 0 -a\n" % globalParameters["ROCmSMIPath"])
runScriptFile.write("./client")
clp = ""
clp += " --platform-idx %u" % globalParameters["Platform"]
Expand All @@ -206,9 +206,9 @@ def writeRunScript(path, libraryLogicPath, forBenchmark):
runScriptFile.write(clp)
runScriptFile.write("\n")
if os.name != "nt":
if globalParameters["PinClocks"]:
runScriptFile.write("/opt/rocm/bin/rocm-smi -d 0 --resetclocks\n")
runScriptFile.write("/opt/rocm/bin/rocm-smi -d 0 --setfan 255\n")
if globalParameters["PinClocks"] and globalParameters["ROCmSMIPath"]:
runScriptFile.write("%s -d 0 --resetclocks\n" % globalParameters["ROCmSMIPath"])
runScriptFile.write("%s -d 0 --setfan 255\n" % globalParameters["ROCmSMIPath"])
else:
executablePath = os.path.join(globalParameters["WorkingPath"])
if os.name == "nt":
Expand Down
65 changes: 44 additions & 21 deletions Tensile/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
globalParameters["NumBenchmarks"] = 1
globalParameters["PinClocks"] = False
globalParameters["KernelTime"] = False
globalParameters["AssemblerPath"] = "/opt/rocm/bin/hcc"
globalParameters["AssemblerPath"] = None # /opt/rocm/bin/hcc
globalParameters["ROCmAgentEnumeratorPath"] = None # /opt/rocm/bin/rocm_agent_enumerator
globalParameters["ROCmSMIPath"] = None # /opt/rocm/bin/rocm-smi

# file heirarchy
globalParameters["ShortNames"] = False
Expand Down Expand Up @@ -318,33 +320,29 @@ def printExit(message):
sys.stdout.flush()
sys.exit(-1)


################################################################################
# Locate Executables
################################################################################
def isExe( filePath ):
return os.path.isfile(filePath) and os.access(filePath, os.X_OK)
def locateExe( defaultPath, exeName ): # /opt/rocm/bin, hcc
# look in path first
for path in os.environ["PATH"].split(os.pathsep):
exePath = os.path.join(path, exeName)
if isExe(exePath):
return exePath
# look in default path second
exePath = os.path.join(defaultPath, exeName)
if isExe(exePath):
return exePath
return None

################################################################################
# Assign Global Parameters
################################################################################
def assignGlobalParameters( config ):
global globalParameters

# read current gfx version
if os.name != "nt":
process = Popen(["/opt/rocm/bin/rocm_agent_enumerator", "-t", "GPU"], stdout=PIPE)
line = process.stdout.readline()
while line != "":
gfxIdx = line.find("gfx")
if gfxIdx >= 0:
major = int(line[gfxIdx+3:gfxIdx+4])
minor = int(line[gfxIdx+4:gfxIdx+5])
step = int(line[gfxIdx+5:gfxIdx+6])
if (major,minor,step) in globalParameters["SupportedISA"]:
print1("# Host-Detected: gfx%u%u%u"%(major, minor, step))
globalParameters["CurrentISA"] = (major, minor, step)
line = process.stdout.readline()
if globalParameters["CurrentISA"] == (0,0,0):
printWarning("Did not detected ISA: %s" % globalParameters["SupportedISA"])
if process.returncode:
printWarning("rocm_agen_enumerator exited with code %u" % process.returncode)

# Minimum Required Version
if "MinimumRequiredVersion" in config:
if not versionIsCompatible(config["MinimumRequiredVersion"]):
Expand All @@ -364,6 +362,31 @@ def assignGlobalParameters( config ):
else:
print2(" %24s: %8s (unspecified)" % (key, defaultValue))

# ROCm Agent Enumerator Path
globalParameters["ROCmAgentEnumeratorPath"] = locateExe("/opt/rocm/bin", "rocm_agent_enumerator")
globalParameters["AssemblerPath"] = locateExe("/opt/rocm/bin", "hcc")
globalParameters["ROCmSMIPath"] = locateExe("/opt/rocm/bin", "rocm-smi")

# read current gfx version
if os.name != "nt" and globalParameters["CurrentISA"] == (0,0,0) and globalParameters["ROCmAgentEnumeratorPath"]:
process = Popen([globalParameters["ROCmAgentEnumeratorPath"], "-t", "GPU"], stdout=PIPE)
line = process.stdout.readline()
while line != "":
gfxIdx = line.find("gfx")
if gfxIdx >= 0:
major = int(line[gfxIdx+3:gfxIdx+4])
minor = int(line[gfxIdx+4:gfxIdx+5])
step = int(line[gfxIdx+5:gfxIdx+6])
if (major,minor,step) in globalParameters["SupportedISA"]:
print1("# Detected ISA: gfx%u%u%u"%(major, minor, step))
globalParameters["CurrentISA"] = (major, minor, step)
line = process.stdout.readline()
if globalParameters["CurrentISA"] == (0,0,0):
printWarning("Did not detect SupportedISA: %s; cannot benchmark assembly kernels." % globalParameters["SupportedISA"])
if process.returncode:
printWarning("%s exited with code %u" % (globalParameters["ROCmAgentEnumeratorPath"], process.returncode))


for key in config:
value = config[key]
if key not in globalParameters:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down Expand Up @@ -698,6 +699,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down Expand Up @@ -825,6 +827,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down Expand Up @@ -942,6 +945,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down Expand Up @@ -161,6 +162,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down Expand Up @@ -233,6 +235,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down Expand Up @@ -305,6 +308,7 @@ BenchmarkProblems:
BenchmarkJoinParameters:
BenchmarkFinalParameters:
- ProblemSizes:
- Range: [ [4], [4], [1], [3104] ] # corner
- Range: [ [4], [64, 64, 64, 7000], [1], [3104] ] # skinny-0
- Range: [ [64, 64, 64, 7000], [4], [1], [3104] ] # skinny-1

Expand Down
Loading

0 comments on commit 2a7284f

Please sign in to comment.