Exemplo n.º 1
0
    def find_compiler(self, cmp_cls, *paths):
        compilers = []
        if cmp_cls.PrgEnv:
            if not cmp_cls.PrgEnv_compiler:
                tty.die('Must supply PrgEnv_compiler with PrgEnv')

            modulecmd = which('modulecmd')
            modulecmd.add_default_arg('python')

            # Save the environment variable to restore later
            old_modulepath = os.environ['MODULEPATH']
            # if given any explicit paths, search them for module files too
            if paths:
                module_paths = ':' + ':'.join(p for p in paths)
                os.environ['MODULEPATH'] = module_paths

            output = modulecmd('avail',
                               cmp_cls.PrgEnv_compiler,
                               output=str,
                               error=str)
            matches = re.findall(
                r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler, output)
            for name, version in matches:
                v = version
                comp = cmp_cls(spack.spec.CompilerSpec(name + '@' + v), self,
                               ['cc', 'CC', 'ftn'],
                               [cmp_cls.PrgEnv, name + '/' + v])

                compilers.append(comp)

            # Restore modulepath environment variable
            if paths:
                os.environ['MODULEPATH'] = old_modulepath

        return compilers
Exemplo n.º 2
0
    def find_compiler(self, cmp_cls, *paths):
        # function-local so that cnl doesn't depend on spack.config
        import spack.spec

        compilers = []
        if cmp_cls.PrgEnv:
            if not cmp_cls.PrgEnv_compiler:
                tty.die('Must supply PrgEnv_compiler with PrgEnv')

            modulecmd = get_module_cmd()

            output = modulecmd('avail',
                               cmp_cls.PrgEnv_compiler,
                               output=str,
                               error=str)
            version_regex = r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler
            matches = re.findall(version_regex, output)
            for name, version in matches:
                v = version
                comp = cmp_cls(spack.spec.CompilerSpec(name + '@' + v), self,
                               "any", ['cc', 'CC', 'ftn'],
                               [cmp_cls.PrgEnv, name + '/' + v])

                compilers.append(comp)

        return compilers
Exemplo n.º 3
0
Arquivo: cnl.py Projeto: LLNL/spack
    def find_compiler(self, cmp_cls, *paths):
        # function-local so that cnl doesn't depend on spack.config
        import spack.spec

        compilers = []
        if cmp_cls.PrgEnv:
            if not cmp_cls.PrgEnv_compiler:
                tty.die('Must supply PrgEnv_compiler with PrgEnv')

            modulecmd = get_module_cmd()

            output = modulecmd(
                'avail', cmp_cls.PrgEnv_compiler, output=str, error=str)
            version_regex = r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler
            matches = re.findall(version_regex, output)
            for name, version in matches:
                v = version
                comp = cmp_cls(
                    spack.spec.CompilerSpec(name + '@' + v),
                    self, "any",
                    ['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name + '/' + v])

                compilers.append(comp)

        return compilers
Exemplo n.º 4
0
    def make_compilers(self, compiler_id, paths):
        import spack.spec
        name = compiler_id.compiler_name
        cmp_cls = spack.compilers.class_for_compiler_name(name)
        compilers = []
        for v in compiler_id.version:
            comp = cmp_cls(spack.spec.CompilerSpec(name + '@' + v), self,
                           "any", ['cc', 'CC', 'ftn'],
                           [cmp_cls.PrgEnv, name + '/' + v])

            compilers.append(comp)
        return compilers
Exemplo n.º 5
0
    def find_compiler(self, cmp_cls, *paths):
        compilers = []
        if cmp_cls.PrgEnv:
            if not cmp_cls.PrgEnv_compiler:
                tty.die('Must supply PrgEnv_compiler with PrgEnv')

            modulecmd = which('modulecmd')
            modulecmd.add_default_arg('python')

            output = modulecmd(
                'avail', cmp_cls.PrgEnv_compiler, output=str, error=str)
            version_regex = r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler
            matches = re.findall(version_regex, output)
            for name, version in matches:
                v = version
                comp = cmp_cls(
                    spack.spec.CompilerSpec(name + '@' + v),
                    self, "any",
                    ['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name + '/' + v])

                compilers.append(comp)

        return compilers
Exemplo n.º 6
0
    def find_compiler(self, cmp_cls, *paths):
        compilers = []
        if cmp_cls.PrgEnv:
            if not cmp_cls.PrgEnv_compiler:
                tty.die('Must supply PrgEnv_compiler with PrgEnv')

            modulecmd = which('modulecmd')
            modulecmd.add_default_arg('python')

            output = modulecmd(
                'avail', cmp_cls.PrgEnv_compiler, output=str, error=str)
            version_regex = r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler
            matches = re.findall(version_regex, output)
            for name, version in matches:
                v = version
                comp = cmp_cls(
                    spack.spec.CompilerSpec(name + '@' + v),
                    self, "any",
                    ['cc', 'CC', 'ftn'], [cmp_cls.PrgEnv, name + '/' + v])

                compilers.append(comp)

        return compilers