Exemplo n.º 1
0
def default_compilers():
    """Get the default installed compilers for the host.
    
    This is most likely the installation of the host's preferred compilers, 
    (see :any:`preferred_compilers`) but if those compilers are not installed
    then it will be an installation of any known compiler family. May 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.
    
    Raises:
        ConfigurationError: No recognized compilers are installed.
    
    Returns:
        InstalledCompilerFamily: The default compilers.
    """
    try:
        inst = default_compilers.inst
    except AttributeError:
        from tau.cf.compiler import CompilerFamily
        LOGGER.debug("Detecting default host compilers")
        # CompilerFamily.all() returns the host's preferred compilers as the first element
        for family in CompilerFamily.all():
            try:
                inst = InstalledCompilerFamily(family)
            except ConfigurationError as err:
                LOGGER.debug(err)
            else:
                LOGGER.debug("Found a %s compiler installation", family.name)
                default_compilers.inst = inst
                break
        else: 
            raise ConfigurationError("No recognized compilers installed.")
    return inst
Exemplo n.º 2
0
 def construct_parser(self):
     parser = super(TargetCreateCommand, self).construct_parser()
     group = parser.add_argument_group('host arguments')
     group.add_argument('--host-compilers',
                        help="select all host compilers automatically from the given family",
                        metavar='<family>',
                        dest='host_family',
                        default=host.preferred_compilers().name,
                        choices=CompilerFamily.family_names())
     group = parser.add_argument_group('Message Passing Interface (MPI) arguments')
     group.add_argument('--mpi-compilers', 
                        help="select all MPI compilers automatically from the given family",
                        metavar='<family>',
                        dest='mpi_family',
                        default=host.preferred_mpi_compilers().name,
                        choices=MpiCompilerFamily.family_names())
     return parser