Example #1
0
def operating_system():
    """Detect the host's operating system.
    
    Mostly relies on Python's platform module but may also probe 
    environment variables and file systems in cases where the arch
    isn't immediately known to Python.  These tests may be expensive
    so the detected value is cached to improve performance.
    
    Returns:
        OperatingSystem: The matching operating system description.
        
    Raises:
        ConfigurationError: Host operating system not supported.
    """
    try:
        inst = operating_system.inst
    except AttributeError:
        arch = architecture()
        if 'CRAYOS_VERSION' in os.environ or 'PE_ENV' in os.environ:
            inst = CRAY_CNL_OS
        elif arch in [IBM_BGP_ARCH, IBM_BGQ_ARCH]:
            inst = IBM_CNK_OS
        else:
            python_os = platform.system()
            try:
                inst = OperatingSystem.find(python_os)
            except KeyError:
                raise ConfigurationError("Host operating system '%s' is not yet supported" % python_os)
        operating_system.inst = inst
    return inst
Example #2
0
 def uses_libunwind(self):
     populated = self.populate()
     host_os = OperatingSystem.find(populated['target']['host_os'])
     return (host_os is not DARWIN_OS and
             (populated['measurement']['sample'] or 
              populated['measurement']['compiler_inst'] != 'never' or 
              populated['application']['openmp']))
Example #3
0
 def __init__(self, name, prefix, src, dst, target_arch, target_os, compilers, 
              sources, commands, libraries):
     """Initializes the installation object.
     
     To set up a new installation, pass `src` as a URL, file path, or the special keyword 'download'.
     Attributes `src` and `src_prefix` will be set to the appropriate paths.
     
     To set up an interface to an existing installation, pass ``src=/path/to/existing/installation``. 
     Attributes `src` and `src_prefix` will be set to None.
     
     Args:
         name (str): Human readable name of the software package, e.g. 'TAU'.
         prefix (str): Path to a directory to contain subdirectories for 
                       installation files, source file, and compilation files.
         src (str): Path to a directory where the software has already been 
                    installed, or a path to a source archive file, or the special
                    keyword 'download'.
         dst (str): Installation destination to be created below `prefix`.
         target_arch (str): Target architecture name.
         target_os (str): Target operating system name.
         compilers (InstalledCompilerSet): Compilers to use if software must be compiled.
         sources (dict): Dictionary of URLs for source code archives indexed by architecture and OS.  
                         `None` specifies the default (i.e. universal) source.
         commands (dict): Dictionary of commands that must be installed indexed by architecture and OS.
                          `None` specifies the universal commands.
         libraries (dict): Dictionary of libraries that must be installed indexed by architecture and OS.
                           `None` specifies the universal libraries.
     """
     self.name = name
     self.prefix = prefix
     self.target_arch = Architecture.find(target_arch)
     self.target_os = OperatingSystem.find(target_os)
     self.compilers = compilers
     self.archive_prefix = os.path.join(prefix, 'src')
     self.src_prefix = None
     if os.path.isdir(src):
         self.src = None
         self.install_prefix = src
     else:
         if src.lower() == 'download':
             self.src = self._lookup_target_os_list(sources)
         else:
             self.src = src
         md5sum = hashlib.md5()
         md5sum.update(self.src)
         self.install_prefix = os.path.join(prefix, dst, name, md5sum.hexdigest())
     self.commands = self._lookup_target_os_list(commands)
     self.libraries = self._lookup_target_os_list(libraries)
     self.include_path = os.path.join(self.install_prefix, 'include')
     self.bin_path = os.path.join(self.install_prefix, 'bin')
     self.lib_path = os.path.join(self.install_prefix, 'lib')
     self._lockfile = LockFile(os.path.join(self.install_prefix, '.tau_lock'))
     LOGGER.debug("%s installation prefix is %s", self.name, self.install_prefix)