Skip to content
Snippets Groups Projects
Commit e84318c1 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Python/conf: fixed libraries loading and preloading (for newer machines)

parent 60f964ef
No related branches found
No related tags found
No related merge requests found
......@@ -70,15 +70,26 @@ class DCTLauncher(object):
# Adding runtime libraries
try:
env_initial = os.environ["LD_LIBRARY_PATH"]
env_initial_libs = os.environ["LD_LIBRARY_PATH"]
except KeyError:
env_initial = ""
libs = self.conf.getRuntimeLibraries()
env_initial_libs = ""
os.environ["LD_LIBRARY_PATH"] = ""
libs = self.conf.getMatlabRuntimeLibraries()
for lib in libs:
env_var = os.environ["LD_LIBRARY_PATH"]
os.environ["LD_LIBRARY_PATH"] = ":".join([env_var, lib])
# Adding preload libraries
try:
env_initial_preload = os.environ["LD_PRELOAD"]
except KeyError:
env_initial_preload = ""
os.environ["LD_PRELOAD"] = ""
libs = self.conf.getMatlabPreloadLibraries()
for lib in libs:
env_var = os.environ["LD_PRELOAD"]
os.environ["LD_PRELOAD"] = ":".join([env_var, lib])
cmd = [os.path.join(self.conf.getMatlabPath(), "bin", "matlab")]
for arg in self.args:
cmd.append(arg)
......@@ -94,7 +105,8 @@ class DCTLauncher(object):
subobj.wait()
except KeyboardInterrupt:
pass
os.environ["LD_LIBRARY_PATH"] = env_initial
os.environ["LD_LIBRARY_PATH"] = env_initial_libs
os.environ["LD_PRELOAD"] = env_initial_preload
def _launchUpdate(self):
util = dct.dct_utils_git.DCTGit(self.dct_dir)
......
<config>
<general>
<libraries>
<!-- Dynamic Libraries needed by ASTRA -->
<path>/usr/local/cuda-4.0.17/lib64</path>
<path>/scisoft/users/batenbur/gpu/lib</path>
<!-- If you want the latest version, substitute this
<path>/bliss/users/vigano/local/usr/src/astra/build/linux/.libs</path>
-->
</libraries>
</general>
<astra>
<mex>
<!-- Mex files needed in the matlab path by ASTRA -->
......@@ -34,11 +23,28 @@
<matlab>
<version>2012a</version>
<path>/sware/com/matlab_2012a/</path>
<!-- Additional options for matlab's start. Not handled, yet. -->
<options>
<opt>-nodesktop</opt>
<opt>-nosplash</opt>
</options>
<libraries>
<!-- Dynamic Libraries needed by ASTRA -->
<path>/usr/local/cuda-4.0.17/lib64</path>
<path>/scisoft/users/batenbur/gpu/lib</path>
<!-- If you want the latest version, substitute this
<path>/bliss/users/vigano/local/usr/src/astra/build/linux/.libs</path>
-->
</libraries>
<preload>
<!-- Needed for older versions of matlab, on newer systems -->
<!--
<path>/usr/lib/libstdc++.so.6</path>
-->
</preload>
</matlab>
<dct>
......
......@@ -91,8 +91,15 @@ class DCTConf(DCTXMLBase):
element = self.tree.find("dct/ignore_id19")
return element.get('value')
def getRuntimeLibraries(self):
elems = self.tree.findall("general/libraries/path")
def getMatlabRuntimeLibraries(self):
elems = self.tree.findall("matlab/libraries/path")
output = []
for elem in elems:
output.append(elem.text)
return output
def getMatlabPreloadLibraries(self):
elems = self.tree.findall("matlab/preload/path")
output = []
for elem in elems:
output.append(elem.text)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment