Commit a14978f4 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Python: allow different matlab paths on different machines


Signed-off-by: Nicola Vigano's avatarNicola Vigano <nicola.vigano@esrf.fr>
parent 77d03e93
......@@ -115,14 +115,24 @@ class DCTConf(DCTXMLBase):
def getMatlabVersion(self):
return self.tree.findtext("matlab/version", "2013a")
def getMatlabPath(self):
return self.tree.findtext("matlab/path", os.path.join("/sware", "com", "matlab_2013a"))
def getMatlabPath(self, hostname=""):
items = self.tree.findall("matlab/path")
for item in items:
if (hostname != "") and ("hostname" in item.attrib.keys()):
hosts = item.attrib.get("hostname")
for pattern in hosts.split(","):
if fnmatch.fnmatch(hostname, pattern):
return item.text
else:
return item.text
else:
return os.path.join("/sware", "com", "matlab_2013a")
def getMatlabOptions(self):
elems = self.tree.findall("matlab/options/opt")
items = self.tree.findall("matlab/options/opt")
output = []
for elem in elems:
output.append(elem.text)
for item in items:
output.append(item.text)
return output
def getIgnoreID19(self):
......@@ -130,31 +140,31 @@ class DCTConf(DCTXMLBase):
return element.get("value")
def getMatlabRuntimeLibraries(self, hostname=""):
elems = self.tree.findall("matlab/libraries/path")
items = self.tree.findall("matlab/libraries/path")
output = []
for elem in elems:
if (hostname != "") and ("hostname" in elem.attrib.keys()):
hosts = elem.attrib.get("hostname")
for item in items:
if (hostname != "") and ("hostname" in item.attrib.keys()):
hosts = item.attrib.get("hostname")
for pattern in hosts.split(","):
if fnmatch.fnmatch(hostname, pattern):
output.append(elem.text)
output.append(item.text)
break
else:
output.append(elem.text)
output.append(item.text)
return output
def getMatlabPreloadLibraries(self, hostname=""):
elems = self.tree.findall("matlab/preload/path")
items = self.tree.findall("matlab/preload/path")
output = []
for elem in elems:
if (hostname != "") and ("hostname" in elem.attrib.keys()):
hosts = elem.attrib.get("hostname")
for item in items:
if (hostname != "") and ("hostname" in item.attrib.keys()):
hosts = item.attrib.get("hostname")
for pattern in hosts.split(","):
if fnmatch.fnmatch(hostname, pattern):
output.append(elem.text)
output.append(item.text)
break
else:
output.append(elem.text)
output.append(item.text)
return output
def getRootDir(self):
......
......@@ -88,7 +88,7 @@ class DCTMatlabInvocation(object):
cmd = cmd + ["/usr/local/cuda/bin/nvprof", "-f", "-o", "profile_cuda_matlab_script"] # , "--analysis-metrics"
elif profiler == "oprofile":
cmd = cmd + ["operf"]
cmd = cmd + [os.path.join(self.conf.getMatlabPath(), "bin", "matlab")]
cmd = cmd + [os.path.join(self.conf.getMatlabPath(self.utils.hostname), "bin", "matlab")]
cmd = cmd + self.conf.getMatlabOptions()
cmd = cmd + self.args
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment