Esempio n. 1
0
def get():
    launcher_val = overrides.get('CHPL_LAUNCHER')
    if not launcher_val:
        comm_val = chpl_comm.get()
        platform_val = chpl_platform.get('target')
        compiler_val = chpl_compiler.get('target')

        if platform_val.startswith('cray-x') or chpl_platform.is_cross_compiling():
            has_aprun = find_executable('aprun')
            has_slurm = find_executable('srun')
            if has_aprun and has_slurm:
                launcher_val = 'none'
            elif has_aprun:
                launcher_val = 'aprun'
            elif has_slurm or platform_val == 'aarch64':
                launcher_val = 'slurm-srun'
            else:
                # FIXME: Need to detect aprun/srun differently. On a cray
                #        system with an eslogin node, it is possible that aprun
                #        will not be available on the eslogin node (only on the
                #        login node).
                #
                #        has_aprun and has_slurm should look other places
                #        (maybe the modules?) to decide.
                #        (thomasvandoren, 2014-08-12)
                sys.stderr.write(
                    'Warning: Cannot detect launcher on this system. Please '
                    'set CHPL_LAUNCHER in the environment.\n')
        elif platform_val == 'marenostrum':
            launcher_val = 'marenostrum'
        elif comm_val == 'gasnet':
            substrate_val = chpl_comm_substrate.get()
            if substrate_val == 'udp':
                launcher_val = 'amudprun'
            elif substrate_val == 'mpi':
                launcher_val = 'gasnetrun_mpi'
            elif substrate_val == 'ibv':
                if platform_val == 'pwr6':
                    # our loadleveler launcher is not yet portable/stable/
                    # flexible enough to serve as a good default
                    #launcher_val = 'loadleveler'
                    launcher_val = 'none'
                else:
                    launcher_val = 'gasnetrun_ibv'
            elif substrate_val == 'mxm':
                launcher_val = 'gasnetrun_ibv'
            elif substrate_val == 'lapi':
                # our loadleveler launcher is not yet portable/stable/flexible
                # enough to serve as a good default
                #launcher_val = 'loadleveler'
                launcher_val = 'none'
        elif comm_val == 'mpi':
            launcher_val = 'mpirun'
        else:
            launcher_val = 'none'

    if launcher_val is None:
        launcher_val = 'none'

    return launcher_val
Esempio n. 2
0
def get():
    launcher_val = overrides.get('CHPL_LAUNCHER')
    if not launcher_val:
        comm_val = chpl_comm.get()
        platform_val = chpl_platform.get('target')
        compiler_val = chpl_compiler.get('target')

        if platform_val.startswith(
                'cray-x') or chpl_platform.is_cross_compiling():
            has_aprun = find_executable('aprun')
            has_slurm = find_executable('srun')
            if has_aprun and has_slurm:
                launcher_val = 'none'
            elif has_aprun:
                launcher_val = 'aprun'
            elif has_slurm or platform_val == 'aarch64':
                launcher_val = 'slurm-srun'
            else:
                # FIXME: Need to detect aprun/srun differently. On a cray
                #        system with an eslogin node, it is possible that aprun
                #        will not be available on the eslogin node (only on the
                #        login node).
                #
                #        has_aprun and has_slurm should look other places
                #        (maybe the modules?) to decide.
                #        (thomasvandoren, 2014-08-12)
                sys.stderr.write(
                    'Warning: Cannot detect launcher on this system. Please '
                    'set CHPL_LAUNCHER in the environment.\n')
        elif comm_val == 'gasnet':
            substrate_val = chpl_comm_substrate.get()
            if substrate_val == 'smp':
                launcher_val = 'smp'
            elif substrate_val == 'udp':
                launcher_val = 'amudprun'
            elif substrate_val == 'mpi':
                launcher_val = 'gasnetrun_mpi'
            elif substrate_val == 'ibv':
                if platform_val == 'pwr6':
                    # our loadleveler launcher is not yet portable/stable/
                    # flexible enough to serve as a good default
                    #launcher_val = 'loadleveler'
                    launcher_val = 'none'
                else:
                    launcher_val = 'gasnetrun_ibv'
            elif substrate_val == 'mxm':
                launcher_val = 'gasnetrun_ibv'
            elif substrate_val == 'ofi':
                launcher_val = 'gasnetrun_ofi'
            elif substrate_val == 'psm':
                launcher_val = 'gasnetrun_psm'
        elif comm_val == 'mpi':
            launcher_val = 'mpirun'
        else:
            launcher_val = 'none'

    if launcher_val is None:
        launcher_val = 'none'

    return launcher_val
Esempio n. 3
0
def get(flag='host', llvm_mode='default'):

    if flag == 'host':
        compiler_val = overrides.get('CHPL_HOST_COMPILER', '')
    elif flag == 'target':
        compiler_val = overrides.get('CHPL_TARGET_COMPILER', '')

        if llvm_mode == 'llvm':
            compiler_val = 'clang-included'
        elif llvm_mode == 'default':
            if ("CHPL_LLVM_CODEGEN" in os.environ and
                os.environ["CHPL_LLVM_CODEGEN"] != "0"):
                compiler_val = 'clang-included'

    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    if compiler_val:
        return compiler_val

    platform_val = chpl_platform.get(flag)
    # The cray platforms are a special case in that we want to "cross-compile"
    # by default. (the compiler is different between host and target, but the
    # platform is the same)
    if platform_val.startswith('cray-x'):
        if flag == 'host':
            compiler_val = 'gnu'
        else:
            subcompiler = os.environ.get('PE_ENV', 'none')
            if subcompiler == 'none':
                sys.stderr.write("Warning: Compiling on {0} without a PrgEnv loaded\n".format(platform_val))
            compiler_val = "cray-prgenv-{0}".format(subcompiler.lower())
    elif chpl_platform.is_cross_compiling():
        if flag == 'host':
            compiler_val = 'gnu'
        else:
            compiler_val = platform_val + '-gnu'
    else:
        # Normal compilation (not "cross-compiling")
        # inherit the host compiler if the target compiler is not set and
        # the host and target platforms are the same
        if flag == 'target':
            if chpl_platform.get('host') == platform_val:
                compiler_val = get('host')
        elif platform_val.startswith('pwr'):
            compiler_val = 'ibm'
        elif platform_val == 'darwin' or platform_val == 'freebsd':
            if find_executable('clang'):
                compiler_val = 'clang'
            else:
                compiler_val = 'gnu'
        else:
            compiler_val = 'gnu'
    return compiler_val
Esempio n. 4
0
def get(flag='host', llvm_mode='default'):

    if flag == 'host':
        compiler_val = overrides.get('CHPL_HOST_COMPILER', '')
    elif flag == 'target':
        compiler_val = overrides.get('CHPL_TARGET_COMPILER', '')

        if llvm_mode == 'llvm':
            compiler_val = 'clang-included'
        elif llvm_mode == 'default' and "CHPL_LLVM_CODEGEN" in os.environ:
            compiler_val = 'clang-included'

    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    if compiler_val:
        return compiler_val

    platform_val = chpl_platform.get(flag)
    # The cray platforms are a special case in that we want to "cross-compile"
    # by default. (the compiler is different between host and target, but the
    # platform is the same)
    if platform_val.startswith('cray-x'):
        if flag == 'host':
            compiler_val = 'gnu'
        else:
            subcompiler = os.environ.get('PE_ENV', 'none')
            if subcompiler == 'none':
                stderr.write(
                    "Warning: Compiling on {0} without a PrgEnv loaded\n".
                    format(platform_val))
            compiler_val = "cray-prgenv-{0}".format(subcompiler.lower())
    elif chpl_platform.is_cross_compiling():
        if flag == 'host':
            compiler_val = 'gnu'
        else:
            compiler_val = platform_val + '-gnu'
    else:
        # Normal compilation (not "cross-compiling")
        # inherit the host compiler if the target compiler is not set and
        # the host and target platforms are the same
        if flag == 'target':
            if chpl_platform.get('host') == platform_val:
                compiler_val = get('host')
        elif platform_val.startswith('pwr'):
            compiler_val = 'ibm'
        elif platform_val == 'darwin' or platform_val == 'freebsd':
            if find_executable('clang'):
                compiler_val = 'clang'
            else:
                compiler_val = 'gnu'
        else:
            compiler_val = 'gnu'
    return compiler_val
Esempio n. 5
0
def get(flag="host"):
    if flag == "host":
        compiler_val = overrides.get("CHPL_HOST_COMPILER", "")
    elif flag == "target":
        compiler_val = overrides.get("CHPL_TARGET_COMPILER", "")
    else:
        raise ValueError("Invalid flag: '{0}'".format(flag))

    if compiler_val:
        return compiler_val

    platform_val = chpl_platform.get(flag)
    # The cray platforms are a special case in that we want to "cross-compile"
    # by default. (the compiler is different between host and target, but the
    # platform is the same)
    if platform_val.startswith("cray-x"):
        if flag == "host":
            compiler_val = "gnu"
        else:
            subcompiler = os.environ.get("PE_ENV", "none")
            if subcompiler == "none":
                stderr.write("Warning: Compiling on {0} without a PrgEnv loaded\n".format(platform_val))
            compiler_val = "cray-prgenv-{0}".format(subcompiler.lower())
    elif chpl_platform.is_cross_compiling():
        if flag == "host":
            compiler_val = "gnu"
        else:
            compiler_val = platform_val + "-gnu"
    else:
        # Normal compilation (not "cross-compiling")
        # inherit the host compiler if the target compiler is not set and
        # the host and target platforms are the same
        if flag == "target":
            if chpl_platform.get("host") == platform_val:
                compiler_val = get("host")
        elif platform_val.startswith("pwr"):
            compiler_val = "ibm"
        elif platform_val == "marenostrum":
            compiler_val = "ibm"
        elif platform_val == "darwin":
            if find_executable("clang"):
                compiler_val = "clang"
            else:
                compiler_val = "gnu"
        else:
            compiler_val = "gnu"
    return compiler_val
def get(flag='host', llvm_mode='default'):

    if flag == 'host':
        compiler_val = overrides.get('CHPL_HOST_COMPILER', '')

        if llvm_mode != 'default':
            error("bad call to chpl_compiler.get('host', llvm_mode!=default)")

    elif flag == 'target':
        compiler_val = overrides.get('CHPL_TARGET_COMPILER', '')

        if llvm_mode == 'llvm':
            compiler_val = 'clang-included'
        elif llvm_mode == 'default':
            if ("CHPL_LLVM_CODEGEN" in os.environ
                    and os.environ["CHPL_LLVM_CODEGEN"] != "0"):
                compiler_val = 'clang-included'
        elif llvm_mode == 'orig':
            # If we're in the middle of a chpl --llvm call,
            # CHPL_TARGET_COMPILER is already clang-included, but
            # the original target compiler is saved in an environment variable.
            # (otherwise, use compiler_val set above with CHPL_TARGET_COMPILER)
            if "CHPL_ORIG_TARGET_COMPILER" in os.environ:
                compiler_val = os.environ["CHPL_ORIG_TARGET_COMPILER"]

    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    if compiler_val:
        validate(compiler_val)
        return compiler_val

    platform_val = chpl_platform.get(flag)
    # The cray platforms are a special case in that we want to "cross-compile"
    # by default. (the compiler is different between host and target, but the
    # platform is the same)
    if platform_val.startswith('cray-x'):
        if flag == 'host':
            compiler_val = 'gnu'
        else:
            subcompiler = os.environ.get('PE_ENV', 'none')
            if subcompiler == 'none':
                sys.stderr.write(
                    "Warning: Compiling on {0} without a PrgEnv loaded\n".
                    format(platform_val))
            compiler_val = "cray-prgenv-{0}".format(subcompiler.lower())
    elif chpl_platform.is_cross_compiling():
        if flag == 'host':
            compiler_val = 'gnu'
        else:
            compiler_val = platform_val + '-gnu'
    else:
        # Normal compilation (not "cross-compiling")
        # inherit the host compiler if the target compiler is not set and
        # the host and target platforms are the same
        if flag == 'target':
            if chpl_platform.get('host') == platform_val:
                compiler_val = get('host')
        elif platform_val.startswith('pwr'):
            compiler_val = 'ibm'
        elif platform_val == 'darwin' or platform_val == 'freebsd':
            if find_executable('clang'):
                compiler_val = 'clang'
            else:
                compiler_val = 'gnu'
        else:
            compiler_val = 'gnu'

    validate(compiler_val)
    return compiler_val