ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
python.trfEnv.environmentUpdate Class Reference

Class holding the update to an environment that will be passed on to an executor. More...

Inheritance diagram for python.trfEnv.environmentUpdate:
Collaboration diagram for python.trfEnv.environmentUpdate:

Public Member Functions

def __init__ (self)
 
def setStandardEnvironment (self, argdict, name='all', substep='')
 Setup the standard execution environment according to the switches in the transform configuration. More...
 
def probeIMFSettings (self, argdict, name='all', substep='')
 Add the libimf maths library to the setup. More...
 
def probeTcmallocSettings (self, argdict, name='all', substep='')
 Add TCMALLOC to the setup. More...
 
def probeOtherSettings (self, argdict, name='all', substep='')
 Add other settings. More...
 
def value (self, key)
 Return the value for a key, string converted. More...
 
def values (self)
 Return a list of KEY=VALUE pairs for this environment. More...
 
def len (self)
 Count the number of environment items that need to be updated. More...
 

Private Member Functions

def _addIMFSettings (self)
 

Private Attributes

 _envdict
 

Detailed Description

Class holding the update to an environment that will be passed on to an executor.

Definition at line 15 of file trfEnv.py.

Constructor & Destructor Documentation

◆ __init__()

def python.trfEnv.environmentUpdate.__init__ (   self)

Definition at line 17 of file trfEnv.py.

17  def __init__(self):
18  self._envdict = {}
19 

Member Function Documentation

◆ _addIMFSettings()

def python.trfEnv.environmentUpdate._addIMFSettings (   self)
private

Definition at line 42 of file trfEnv.py.

42  def _addIMFSettings(self):
43  if 'ATLASMKLLIBDIR_PRELOAD' not in os.environ:
44  msg.warning('"ATLASMKLLIBDIR_PRELOAD" not found in the current environment'
45  ' - no setup of MKL is possible')
46  return
47 
48  if 'ATLASMKLLIBDIR_PRELOAD' in os.environ:
49  if "LD_PRELOAD" not in self._envdict:
50  self._envdict["LD_PRELOAD"] = pathVar("LD_PRELOAD")
51  self._envdict["LD_PRELOAD"].add(path.join("$ATLASMKLLIBDIR_PRELOAD", "libimf.so"))
52  self._envdict["LD_PRELOAD"].add(path.join("$ATLASMKLLIBDIR_PRELOAD", "libintlc.so.5"))
53 
54 

◆ len()

def python.trfEnv.environmentUpdate.len (   self)

Count the number of environment items that need to be updated.

Definition at line 100 of file trfEnv.py.

100  def len(self):
101  return len(self._envdict)
102 
103 

◆ probeIMFSettings()

def python.trfEnv.environmentUpdate.probeIMFSettings (   self,
  argdict,
  name = 'all',
  substep = '' 
)

Add the libimf maths library to the setup.

Definition at line 28 of file trfEnv.py.

28  def probeIMFSettings(self, argdict, name='all', substep=''):
29  # If imf=True/False then follow its lead, but otherwise try to detect the release
30  # and enable if we have a release >= 17.7
31  if 'imf' in argdict:
32  if argdict['imf'].returnMyValue(name=name, substep=substep) is False:
33  msg.info('Skipping inclusion of imf libraries: --imf is set to False')
34  else:
35  msg.info('Enabling inclusion of imf libraries: --imf is set to True')
36  self._addIMFSettings()
37  return
38 
39  self._addIMFSettings()
40 
41 

◆ probeOtherSettings()

def python.trfEnv.environmentUpdate.probeOtherSettings (   self,
  argdict,
  name = 'all',
  substep = '' 
)

Add other settings.

Definition at line 74 of file trfEnv.py.

74  def probeOtherSettings(self, argdict, name='all', substep=''):
75  if 'env' not in argdict:
76  return
77 
78  myEnv = argdict['env'].returnMyValue(name=name, substep=substep)
79  if myEnv is None:
80  return
81 
82  for setting in myEnv:
83  try:
84  k, v = setting.split('=', 1)
85  self._envdict[k] = v
86  except ValueError:
87  msg.warning('Environment setting "{0}" seems to be invalid (must be KEY=VALUE)')
88 

◆ probeTcmallocSettings()

def python.trfEnv.environmentUpdate.probeTcmallocSettings (   self,
  argdict,
  name = 'all',
  substep = '' 
)

Add TCMALLOC to the setup.

Definition at line 56 of file trfEnv.py.

56  def probeTcmallocSettings(self, argdict, name='all', substep=''):
57  # We only do this if tcmalloc=True in atgdict
58  if 'tcmalloc' not in argdict or argdict['tcmalloc'].returnMyValue(name=name, substep=substep) is False:
59  msg.info('Skipping inclusion of tcmalloc')
60  return
61 
62  if 'TCMALLOCDIR' not in os.environ:
63  msg.warning('"TCMALLOCDIR" not found in the current environment'
64  ' - no setup of tcmalloc is possible')
65  return
66 
67  # For now we support the minimal version (it's the default)
68  if "LD_PRELOAD" not in self._envdict:
69  self._envdict["LD_PRELOAD"] = pathVar("LD_PRELOAD")
70  self._envdict["LD_PRELOAD"].add(path.join("$TCMALLOCDIR", "libtcmalloc_minimal.so"))
71 
72 

◆ setStandardEnvironment()

def python.trfEnv.environmentUpdate.setStandardEnvironment (   self,
  argdict,
  name = 'all',
  substep = '' 
)

Setup the standard execution environment according to the switches in the transform configuration.

Definition at line 22 of file trfEnv.py.

22  def setStandardEnvironment(self, argdict, name='all', substep=''):
23  self.probeIMFSettings(argdict, name=name, substep=substep)
24  self.probeTcmallocSettings(argdict, name=name, substep=substep)
25  self.probeOtherSettings(argdict, name=name, substep=substep)
26 

◆ value()

def python.trfEnv.environmentUpdate.value (   self,
  key 
)

Return the value for a key, string converted.

Definition at line 90 of file trfEnv.py.

90  def value(self, key):
91  return str(self._envdict[key])
92 

◆ values()

def python.trfEnv.environmentUpdate.values (   self)

Return a list of KEY=VALUE pairs for this environment.

Definition at line 95 of file trfEnv.py.

95  def values(self):
96  return [ "{0}={1}".format(k, v) for k, v in self._envdict.items() ]
97 

Member Data Documentation

◆ _envdict

python.trfEnv.environmentUpdate._envdict
private

Definition at line 18 of file trfEnv.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
athena.value
value
Definition: athena.py:122
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:797
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11