예제 #1
0
def get(flag='host'):
    arch_val = chpl_arch.get(flag)
    platform_val = chpl_platform.get(flag)
    cygwin = platform_val.startswith('cygwin')
    mac_arm = platform_val == 'darwin' and arch_val == 'arm64'
    chpl_host_mem = overrides.get('CHPL_HOST_MEM')
    chpl_target_mem = overrides.get('CHPL_TARGET_MEM')
    chpl_mem = overrides.get('CHPL_MEM')

    if flag == 'target':
        if cygwin or mac_arm:
            mem_val = 'cstdlib'
        elif chpl_target_mem:
            mem_val = chpl_target_mem
            if chpl_mem and chpl_target_mem != chpl_mem:
                warning("CHPL_MEM and CHPL_TARGET_MEM are both set, "
                        "taking value from CHPL_TARGET_MEM")
        elif chpl_mem:
            mem_val = chpl_mem
        else:
            mem_val = 'jemalloc'
    elif flag == 'host':
        if cygwin:
            mem_val = 'cstdlib'
        elif chpl_host_mem:
            mem_val = chpl_host_mem
        else:
            mem_val = 'cstdlib'
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)
    return mem_val
예제 #2
0
def get(flag='host'):

    if flag == 'host':
        arch_val = overrides.get('CHPL_HOST_ARCH', '')
    elif flag == 'target':
        arch_val = overrides.get('CHPL_TARGET_ARCH', '')
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    arch_flag = "CHPL_TARGET_ARCH"
    cpu_flag = "CHPL_TARGET_CPU"
    if flag == 'host':
        arch_flag = "CHPL_HOST_ARCH"
        cpu_flag = "CHPL_HOST_CPU"

    if arch_val:
        return arch_val

    # compute the default
    cpu_val = chpl_cpu.get(flag).cpu
    cpuarch = chpl_cpu.arch_for_cpu(cpu_val, flag)
    machine = chpl_cpu.get_default_machine(flag)
    if cpuarch:
        if cpuarch != machine:
            sys.stderr.write('Warning: Cross compilation not yet supported. '
                             'Inferred {0}={1} based upon {2}={3} '
                             'but running on {4}.\n'.format(
                                 arch_flag, cpuarch, cpu_flag, cpu_val,
                                 machine))

    return chpl_cpu.get_default_machine(flag)
예제 #3
0
def get(flag, map_to_compiler=False, get_lcd=False):

    cpu_tuple = collections.namedtuple('cpu_tuple', ['flag', 'cpu'])

    if not flag or flag == 'host':
        cpu = overrides.get('CHPL_HOST_CPU', '')
    elif flag == 'target':
        cpu = overrides.get('CHPL_TARGET_CPU', '')
    else:
        raise InvalidLocationError(flag)

    # fast path out for when the user has set arch=none
    if cpu == 'none' or (flag == 'host' and not cpu):
        return cpu_tuple('none', 'none')


    # Handle backwards compatability - CHPL_TARGET_ARCH might be
    # set instead of the currently preferred CHPL_TARGET_CPU.
    if not cpu:
        oldarch = None
        if not flag or flag == 'host':
            oldarch = overrides.get('CHPL_HOST_ARCH', '')
        elif flag == 'target':
            oldarch = overrides.get('CHPL_TARGET_ARCH', '')
        else:
            raise InvalidLocationError(flag)

        # If the oldarch indicates a CPU, use it
        if arch_for_cpu(oldarch, flag):
            cpu = oldarch


    # Adjust arch for compiler (not all compilers support all arch
    # settings; PrgEnv might override arch, etc)
    cpu = adjust_cpu_for_compiler (cpu, flag, get_lcd)

    # Now, if is not yet set, we should set the default.
    if not cpu:
        cpu = default_cpu(flag)

    verify_cpu(cpu, flag)

    compiler_val = chpl_compiler.get(flag)
    isprgenv = compiler_is_prgenv(compiler_val)
    if map_to_compiler and not isprgenv:
        # Map cpu to compiler argument
        # Don't do this for PrgEnv compiles since the compiler driver
        # handles specialization.
        version = get_compiler_version(compiler_val)
        cpu = argument_map.find(cpu, compiler_val, version)
    if cpu and cpu != 'none' and cpu != 'unknown':
        # x86 uses -march= where the others use -mcpu=
        if is_x86_variant(get_native_machine()):
            flag = 'arch'
        else:
            flag = 'cpu'
    else:
        flag = 'none'

    return cpu_tuple(flag or 'none', cpu or 'unknown')
예제 #4
0
def get(flag=''):
    sanitizers_val = None
    if flag == 'exe':
        sanitizers_val = overrides.get('CHPL_SANITIZE_EXE', get(''))
    if not sanitizers_val:
        sanitizers_val = overrides.get('CHPL_SANITIZE', 'none')
    return sanitizers_val
예제 #5
0
def get_compiler_command(flag, lang):

    flag_upper = flag.upper()
    lang_upper = lang.upper()

    if lang_upper == 'C++':
        lang_upper = 'CXX'
    elif lang_upper == 'C':
        lang_upper = 'CC'

    if flag_upper == 'HOST' or flag_upper == 'TARGET':
        pass
    else:
        error('unknown flag {0}'.format(flag))

    if lang_upper == 'CC' or lang_upper == 'CXX':
        pass
    else:
        error('unknown lang {0}'.format(lang))

    # construct CHPL_HOST_CC / CHPL_TARGET_CXX etc
    varname = 'CHPL_' + flag_upper + '_' + lang_upper

    command = overrides.get(varname, '')
    if command:
        return command.split()

    compiler_val = get(flag=flag)

    # If other settings allow it, look also at CC/CXX.
    if should_consider_cc_cxx(flag):
        cc_cxx_val = overrides.get(lang_upper, '')
        if cc_cxx_val:
            return cc_cxx_val.split()

    if lang_upper == 'CC':
        command = [get_compiler_name_c(compiler_val)]
    elif lang_upper == 'CXX':
        command = [get_compiler_name_cxx(compiler_val)]

    # Adjust the path in two situations:
    #  CHPL_TARGET_COMPILER=llvm -- means use the selected llvm/clang
    #  CHPL_TARGET_COMPILER=clang with CHPL_LLVM=bundled -- use bundled clang
    if compiler_val == 'clang' or compiler_val == 'llvm':
        import chpl_llvm
        llvm_val = chpl_llvm.get()
        if llvm_val == 'none' and compiler_val == 'llvm':
            error("Cannot use CHPL_TARGET_COMPILER=llvm when CHPL_LLVM=none")
        if llvm_val == 'bundled' or compiler_val == 'llvm':
            if (flag == 'host' and llvm_val == 'bundled'
                    and compiler_val == 'clang'):
                # don't change the prefix in this setting
                # (bundled LLVM might not be built yet)
                pass

            else:
                command = chpl_llvm.get_llvm_clang(lang_upper)

    return command
예제 #6
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:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    # If compiler_val was not set, look at CC/CXX
    if not compiler_val:
        compiler_val = get_compiler_from_cc_cxx()

    if compiler_val:
        validate(compiler_val)
        return compiler_val

    prgenv_compiler = get_prgenv_compiler()
    has_llvm = 'unset'

    if flag == 'target':
        import chpl_llvm
        has_llvm = chpl_llvm.get()

    if flag == 'target' and (has_llvm == 'bundled' or has_llvm == 'system'):
        # Default to CHPL_TARGET_COMPILER=llvm when CHPL_LLVM!=none
        compiler_val = 'llvm'

    elif prgenv_compiler != 'none':
        # 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 flag == 'host':
            compiler_val = 'gnu'
        else:
            compiler_val = prgenv_compiler

    else:
        platform_val = chpl_platform.get(flag)
        # 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
예제 #7
0
def is_overridden():
    re2 = overrides.get('CHPL_RE2')
    regexp = overrides.get('CHPL_REGEXP')

    if re2 or regexp:
        return True

    return False
예제 #8
0
def get():
    re2 = overrides.get('CHPL_RE2')
    regexp = overrides.get('CHPL_REGEXP')
    if not re2:
        re2_header = os.path.join(get_chpl_third_party(), 're2', 'install',
                                  get_uniq_cfg_path(), 'include', 're2',
                                  're2.h')
        re2 = 'bundled' if os.path.exists(re2_header) else 'none'
    return re2
예제 #9
0
def get(flag='host'):
    if flag == 'host':
        platform_val = overrides.get('CHPL_HOST_PLATFORM')
    elif flag == 'target':
        platform_val = overrides.get('CHPL_TARGET_PLATFORM')
        if not platform_val:
            platform_val = get('host')
    else:
        raise ValueError("Invalid flag: '{0}'".format(flag))

    if not platform_val:
        # Check for cray platform. It is a cray platform if there is an CLEinfo
        # config file and it has a known network value in it.
        cle_info_file = os.path.abspath('/etc/opt/cray/release/CLEinfo')
        if not os.path.exists(cle_info_file):
            cle_info_file = os.path.abspath(
                '/etc/opt/cray/release/cle-release')

        if os.path.exists(cle_info_file):
            with open(cle_info_file, 'r') as fp:
                cle_info = fp.read()
            net_pattern = re.compile('^NETWORK=(?P<net>[a-zA-Z]+)$',
                                     re.MULTILINE)
            net_match = net_pattern.search(cle_info)
            if net_match is not None and len(net_match.groups()) == 1:
                net = net_match.group('net')
                if net.lower() == 'gem':
                    platform_val = 'cray-xe'
                elif net.lower() == 'ari':
                    platform_val = 'cray-xc'

    if not platform_val:
        # uname() -> (system, node, release, version, machine, processor)
        uname = platform.uname()
        platform_val = uname[0].lower().replace('_', '')
        machine = uname[4]
        if platform_val == 'linux':
            if machine == 'x86_64':
                build_64_as_32 = os.environ.get('CHPL_BUILD_X86_64_AS_32')
                if build_64_as_32 == "1":
                    platform_val = "linux64_32"
                else:
                    platform_val = "linux64"
            else:
                platform_val = "linux32"
        elif platform_val.startswith("cygwin"):
            if machine == 'x86_64':
                platform_val = "cygwin64"
            else:
                platform_val = "cygwin32"
        elif platform_val.startswith('netbsd'):
            if machine == 'amd64':
                platform_val = 'netbsd64'
            else:
                platform_val = 'netbsd32'

    return platform_val
예제 #10
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:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    default_llvm = False
    if not compiler_val:
        default_llvm = default_to_llvm(flag)

        # If allowable, look at CC/CXX
        if should_consider_cc_cxx(flag):
            compiler_val = get_compiler_from_cc_cxx()

    if compiler_val:
        validate_compiler(compiler_val)
        return compiler_val

    prgenv_compiler = get_prgenv_compiler()

    if default_llvm:
        compiler_val = 'llvm'

    elif prgenv_compiler != 'none':
        # 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 flag == 'host':
            compiler_val = 'gnu'
        else:
            compiler_val = prgenv_compiler

    else:
        platform_val = chpl_platform.get(flag)
        # 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(compiler_val)
    return compiler_val
예제 #11
0
def get(flag='host'):
    if flag == 'host':
        platform_val = overrides.get('CHPL_HOST_PLATFORM')
    elif flag == 'target':
        platform_val = overrides.get('CHPL_TARGET_PLATFORM')
        if not platform_val:
            platform_val = get('host')
    else:
        raise error("Invalid flag: '{0}'".format(flag), ValueError)

    if not platform_val:
        # Check for cray platform. It is a cray platform if there is an CLEinfo
        # config file and it has a known network value in it.
        cle_info_file = os.path.abspath('/etc/opt/cray/release/CLEinfo')
        if not os.path.exists(cle_info_file):
            cle_info_file = os.path.abspath(
                '/etc/opt/cray/release/cle-release')

        if os.path.exists(cle_info_file):
            with open(cle_info_file, 'r') as fp:
                cle_info = fp.read()
            net_pattern = re.compile('^NETWORK=(?P<net>[a-zA-Z]+)$',
                                     re.MULTILINE)
            net_match = net_pattern.search(cle_info)
            if net_match is not None and len(net_match.groups()) == 1:
                net = net_match.group('net')
                if net.lower() == 'gem':
                    platform_val = 'cray-xe'
                elif net.lower() == 'ari':
                    platform_val = 'cray-xc'

    if not platform_val:
        # uname() -> (system, node, release, version, machine, processor)
        uname = platform.uname()
        platform_val = uname[0].lower().replace('_', '')
        machine = uname[4]
        if platform_val == 'linux':
            if machine == 'x86_64':
                build_64_as_32 = os.environ.get('CHPL_BUILD_X86_64_AS_32')
                if build_64_as_32 == "1":
                    platform_val = "linux64_32"
                else:
                    platform_val = "linux64"
            else:
                platform_val = "linux32"
        elif platform_val.startswith("cygwin"):
            if machine == 'x86_64':
                platform_val = "cygwin64"
            else:
                platform_val = "cygwin32"
        elif platform_val.startswith('netbsd'):
            if machine == 'amd64':
                platform_val = 'netbsd64'
            else:
                platform_val = 'netbsd32'

    return platform_val
예제 #12
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
예제 #13
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
예제 #14
0
def get(flag='target'):
    chpl_jemalloc = overrides.get('CHPL_JEMALLOC')
    chpl_host_jemalloc = overrides.get('CHPL_HOST_JEMALLOC')
    chpl_target_jemalloc = overrides.get('CHPL_TARGET_JEMALLOC')

    mem_val = chpl_mem.get(flag)
    platform_val = chpl_platform.get(flag)

    darwin = platform_val.startswith('darwin')
    cygwin = platform_val.startswith('cygwin')
    linux = not darwin and not cygwin

    if flag == 'target':
        if chpl_target_jemalloc:
            jemalloc_val = chpl_target_jemalloc
            if chpl_jemalloc:
                warning("CHPL_JEMALLOC and CHPL_TARGET_JEMALLOC are both set, "
                        "taking value from CHPL_TARGET_JEMALLOC")
        elif chpl_jemalloc:
            jemalloc_val = chpl_jemalloc
        elif mem_val == 'jemalloc':
            jemalloc_val = 'bundled'
        else:
            jemalloc_val = 'none'
    elif flag == 'host':
        if chpl_host_jemalloc:
            jemalloc_val = chpl_host_jemalloc
        elif linux and mem_val == 'jemalloc':
            jemalloc_val = 'bundled'
        elif darwin and mem_val == 'jemalloc':
            jemalloc_val = 'system'
        else:
            jemalloc_val = 'none'
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    if flag == 'host':
        if linux and mem_val == 'jemalloc' and jemalloc_val == 'system':
            error(
                "CHPL_HOST_JEMALLOC=system is not supported on Linux for host builds"
            )

        if darwin and mem_val == 'jemalloc' and jemalloc_val == 'bundled':
            error(
                "CHPL_HOST_JEMALLOC=bundled is not supported on Mac for host builds"
            )

    if mem_val == 'jemalloc' and jemalloc_val == 'none':
        error("CHPL_JEMALLOC must not be 'none' when CHPL_MEM is jemalloc")

    if mem_val != 'jemalloc' and jemalloc_val != 'none':
        error("CHPL_JEMALLOC must be 'none' when CHPL_MEM is not jemalloc")

    return jemalloc_val
예제 #15
0
def get_compiler_from_cc_cxx():
    cc_compiler = 'unknown'
    cxx_compiler = 'unknown'
    warn = False
    compiler_val = 'unknown'
    cc_val = overrides.get('CC', '')
    cxx_val = overrides.get('CXX', '')

    if cc_val == '' and cxx_val == '':
        return ''

    if cc_val:
        cc_compiler = get_compiler_from_command(cc_val)
    if cxx_val:
        cxx_compiler = get_compiler_from_command(cxx_val)

    if cc_val and cxx_val:
        if cc_compiler == cxx_compiler:
            compiler_val = cc_compiler
        else:
            error("Conflicting compiler families for CC and CXX settings\n"
                  "  {0} -> {1}\n"
                  "  {2} -> {3}\n"
                  "Set CHPL_HOST_COMPILER and CHPL_TARGET_COMPILER to the "
                  "desired compiler family".format(cc_val, cc_compiler,
                                                   cxx_val, cxx_compiler))
            compiler_val = 'unknown'

    else:
        # if we get here, CC or CXX is provided, but not both.
        # Usually we warn in that case.
        # Check to see if the command name matches the default
        # for the compiler family.
        # In that event, omit the warning.
        if cc_val:
            compiler_val = cc_compiler
            warn = (get_compiler_name_c(compiler_val) != cc_val)
        if cxx_val:
            compiler_val = cxx_compiler
            warn = (get_compiler_name_cxx(compiler_val) != cxx_val)

    if compiler_val == 'unknown':
        error("Could not infer CHPL_TARGET_COMPILER from "
              "CC={0} CXX={1}".format(cc_val, cxx_val))
    else:
        if warn and cc_val:
            error('CC is set but not CXX -- please set both\n')
        if warn and cxx_val:
            error('CXX is set but not CC -- please set both\n')

    return compiler_val
예제 #16
0
def get(flag='host'):

    if flag == 'host':
        machine_val = overrides.get('CHPL_HOST_MACHINE', '')
    elif flag == 'target':
        machine_val = overrides.get('CHPL_TARGET_MACHINE', '')
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    if machine_val:
        return machine_val

    # compute the default
    return chpl_arch.get_default_machine(flag)
예제 #17
0
def get_compile_args(libfabric=get()):
    flags = []
    if libfabric == 'bundled':
        flags = third_party_utils.default_get_compile_args('libfabric',
                                                           ucp=get_uniq_cfg_path())
    elif libfabric == 'system':
        # Allow overriding pkg-config via LIBFABRIC_DIR, for platforms
        # without pkg-config.
        libfab_dir_val = overrides.get('LIBFABRIC_DIR')
        if libfab_dir_val:
            flags.append('-I' + libfab_dir_val + '/include')
        else:
            # Try using pkg-config to get the compile-time flags.
            pcflags = third_party_utils.pkgconfig_get_compile_args('libfabric',
                                                                   system=True)
            for pcl in pcflags:
                flags.append(pcl)

    launcher_val = chpl_launcher.get()
    ofi_oob_val = overrides.get_environ('CHPL_RT_COMM_OFI_OOB')
    if 'mpi' in launcher_val or ( ofi_oob_val and 'mpi' in ofi_oob_val ):
        mpi_dir_val = overrides.get_environ('MPI_DIR')
        if mpi_dir_val:
            flags.append('-I' + mpi_dir_val + '/include')

    return flags
예제 #18
0
def get():
    aux_fs = overrides.get('CHPL_AUX_FILESYS', 'none')

    if aux_fs == 'hdfs':
        java_subdir = os.environ.get('JAVA_INSTALL', '')
        aux_fs_subdir = os.environ.get('HADOOP_INSTALL', '')

        # This will not check that all dependencies are satisfied..
        found_java = os.path.isdir(os.path.join(java_subdir, 'include'))
        found_hdfs = os.path.exists(os.path.join(aux_fs_subdir, 'src', 'c++',
                                                 'libhdfs', 'hdfs.h'))
        if not found_java:
            stderr.write("Warning: Can't find your Java installation\n")
        if not found_hdfs:
            stderr.write("Warning: Can't find your Hadoop installation\n")

    elif aux_fs == 'hdfs3':
        def fetchInfo(env, envtype, filename, err):
            directories = map(lambda z: z.lstrip(envtype), os.environ.get(env, '').split())
            res = sum([ os.path.exists(os.path.join(d, filename)) for d in directories ])

            if res < 1:
                stderr.write(err)
                return False

            return True

        fetchInfo('CHPL_AUXIO_INCLUDE', '-I', 'hdfs.h', "Warning: Can't find your HDFS3 header file installation\n")
        fetchInfo('CHPL_AUXIO_LIBS', '-L', 'libhdfs3.a', "Warning: Can't find your HDFS3 static library installation\n")

    return aux_fs
예제 #19
0
def get():
    debug_val = overrides.get('CHPL_COMM_DEBUG')
    if not debug_val:
        debug_val = 'nodbg'
    else:
        debug_val = 'debug'
    return debug_val
예제 #20
0
def get(flag='wide'):
    wide_val = overrides.get('CHPL_WIDE_POINTERS', 'struct')
    define = ''

    if wide_val == 'struct':
        define = '-DCHPL_WIDE_POINTER_STRUCT'
    else:
        match = re.match(r'node(\d+)', wide_val)
        if match:
            node_bits = int(match.group(1))
            if node_bits < 2 or node_bits > 60:
                sys.stderr.write(
                    "Error: Bad wide pointer node bit width: {0}\n".format(
                        node_bits))
            else:
                define = "-DCHPL_WIDE_POINTER_PACKED " \
                         "-DCHPL_WIDE_POINTER_NODE_BITS={0}".format(node_bits)
        else:
            sys.stderr.write(
                "Error: Unknown wide pointer format: {0}\n".format(wide_val))

    if flag == 'wide':
        return wide_val
    elif flag == 'define':
        return define
    else:
        raise ValueError("Invalid flag: '{0}'".format(flag))
예제 #21
0
def get():
    substrate_val = overrides.get('CHPL_COMM_SUBSTRATE')
    if not substrate_val:
        comm_val = chpl_comm.get()
        platform_val = chpl_platform.get('target')
        arch_val = chpl_arch.get('target', get_lcd=True)

        if comm_val == 'gasnet':
            if platform_val == 'cray-xe':
                substrate_val = 'gemini'
            elif platform_val == 'cray-xk':
                substrate_val = 'gemini'
            elif platform_val == 'cray-xc':
                    substrate_val = 'aries'
            elif platform_val == 'marenostrum':
                substrate_val = 'udp'
            elif platform_val == 'pwr5':
                substrate_val = 'lapi'
            elif platform_val == 'pwr6':
                substrate_val = 'ibv'
            else:
                substrate_val = 'udp'
        else:
            substrate_val = 'none'
    return substrate_val
def get():
    substrate_val = overrides.get('CHPL_COMM_SUBSTRATE')
    if not substrate_val:
        comm_val = chpl_comm.get()
        platform_val = chpl_platform.get('target')

        if comm_val == 'gasnet':
            if platform_val == 'cray-xe':
                substrate_val = 'gemini'
            elif platform_val == 'cray-xk':
                substrate_val = 'gemini'
            elif platform_val == 'cray-xc':
                substrate_val = 'aries'
            elif platform_val == 'cray-cs':
                substrate_val = 'ibv'
            elif platform_val == 'pwr6':
                substrate_val = 'ibv'
            else:
                substrate_val = 'udp'
        elif comm_val == 'ofi':
            if platform_val == 'cray-xc':
                substrate_val = 'sockets'
                # substrate_val = 'gni'
            else:
                substrate_val = 'sockets'
        else:
            substrate_val = 'none'
    return substrate_val
예제 #23
0
def get():
    comm_val = chpl_comm.get()
    if comm_val == 'ofi':
        libfabric_val = overrides.get('CHPL_LIBFABRIC')
        platform_val = chpl_platform.get('target')
        if not libfabric_val:
            cmd_exists, returncode = try_run_command(
                ['pkg-config', '--exists', 'libfabric'])[0:2]
            if cmd_exists and returncode == 0:
                libfabric_val = 'system'
            else:
                libfabric_val = 'bundled'
        if libfabric_val == 'none':
            error("CHPL_LIBFABRIC must not be 'none' when CHPL_COMM is ofi")
        if platform_val == 'hpe-cray-ex' and libfabric_val != 'system':
            sys.stderr.write('Warning: CHPL_LIBFABRIC!=system is discouraged '
                             'on HPE Cray EX\n')
    else:
        libfabric_val = 'none'

    if libfabric_val == 'libfabric':
        sys.stderr.write("Warning: CHPL_LIBFABRIC=libfabric is deprecated. "
                         "Use CHPL_LIBFABRIC=bundled instead.\n")
        libfabric_val = 'bundled'

    return libfabric_val
예제 #24
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
예제 #25
0
def get():
    aux_fs = overrides.get('CHPL_AUX_FILESYS', 'none')

    if aux_fs == 'hdfs':
        java_subdir = os.environ.get('JAVA_INSTALL', '')
        aux_fs_subdir = os.environ.get('HADOOP_INSTALL', '')

        # This will not check that all dependencies are satisfied..
        found_java = os.path.isdir(os.path.join(java_subdir, 'include'))
        found_hdfs = os.path.exists(os.path.join(aux_fs_subdir, 
                                                 'include', 'hdfs.h'))
        found_hdfs_lib = os.path.exists(os.path.join(aux_fs_subdir, 'lib',
                                                 'native', 'libhdfs.a'))
        if not found_java:
            stderr.write("Warning: Can't find your Java installation\n")
        if not found_hdfs or not found_hdfs_lib:
            stderr.write("Warning: Can't find your Hadoop installation\n")

    elif aux_fs == 'hdfs3':
        def fetchInfo(env, envtype, filename, err):
            directories = map(lambda z: z.lstrip(envtype), os.environ.get(env, '').split())
            res = sum([ os.path.exists(os.path.join(d, filename)) for d in directories ])

            if res < 1:
                stderr.write(err)
                return False

            return True

        fetchInfo('CHPL_AUXIO_INCLUDE', '-I', 'hdfs.h', "Warning: Can't find your HDFS3 header file installation\n")
        fetchInfo('CHPL_AUXIO_LIBS', '-L', 'libhdfs3.a', "Warning: Can't find your HDFS3 static library installation\n")

    return aux_fs
예제 #26
0
def get_gcc_prefix():
    gcc_prefix = overrides.get('CHPL_LLVM_GCC_PREFIX', '')

    # allow CHPL_LLVM_GCC_PREFIX=none to disable inferring it
    if gcc_prefix == 'none':
        return ''

    if not gcc_prefix:
        # darwin and FreeBSD default to clang
        # so shouldn't need GCC prefix
        host_platform = chpl_platform.get('host')
        if host_platform == "darwin" or host_platform == "freebsd":
            return ''

        # When 'gcc' is a command other than '/usr/bin/gcc',
        # compute the 'gcc' prefix that LLVM should use.
        gcc_path = which('gcc')
        if gcc_path == '/usr/bin/gcc':
            # In this common case, nothing else needs to be done,
            # because we can assume that clang can find this gcc.
            pass
        elif gcc_path is None:
            # Nothing else we can do here
            pass
        else:
            # Try to figure out the GCC prefix by running gcc
            out, err = run_command(['gcc', '-v'], stdout=True, stderr=True)
            out = out + err

            # look for the --prefix= specified when GCC was configured
            words = out.split()
            for word in words:
                if word.startswith('--prefix='):
                    gcc_prefix = word[len('--prefix='):]
                    break
            # check that directory exists.
            if gcc_prefix and os.path.isdir(gcc_prefix):
                # if so, we are done.
                pass
            else:
                # We didn't find a --prefix= flag, so fall back on a heuristic.
                # try removing bin/gcc from the end
                mydir = os.path.dirname(os.path.dirname(gcc_path))
                if mydir and os.path.isdir(mydir):
                    # then check for mydir/include
                    inc = os.path.join(mydir, "include")
                    if os.path.isdir(inc):
                        gcc_prefix = mydir
                    else:
                        inc = os.path.join(mydir, "snos", "include")
                        if os.path.isdir(inc):
                            gcc_prefix = mydir

        gcc_prefix = gcc_prefix.strip()
        if gcc_prefix == '/usr':
            # clang will be able to figure this out so don't
            # bother with the argument here.
            gcc_prefix = ''

    return gcc_prefix
예제 #27
0
def is_overridden():
    gmp_val = overrides.get('CHPL_GMP')

    if gmp_val:
        return True

    return False
예제 #28
0
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_compiler = chpl_compiler.get('target')
        if target_compiler == 'cray-prgenv-cray':
            gmp_val = 'system'
        else:
            target_platform = chpl_platform.get('target')

            # Detect if gmp has been built for this configuration.
            third_party = get_chpl_third_party()
            uniq_cfg_path = get_uniq_cfg_path()
            gmp_subdir = os.path.join(third_party, 'gmp', 'install',
                                      uniq_cfg_path)

            if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
                gmp_val = 'bundled'
            elif target_platform.startswith('cray-x'):
                gmp_val = 'system'
            elif target_platform == 'aarch64':
                gmp_val = 'system'
            else:
                gmp_val = 'none'
    elif gmp_val == 'gmp':
        sys.stderr.write("Warning: CHPL_GMP=gmp is deprecated. "
                         "Use CHPL_GMP=bundled instead.\n")
        gmp_val = 'bundled'

    return gmp_val
예제 #29
0
def get_link_args(libfabric=get()):
    libs = []
    if libfabric == 'bundled':
        return third_party_utils.default_get_link_args('libfabric',
                                                       ucp=get_uniq_cfg_path(),
                                                       libs=['libfabric.la'],
                                                       add_L_opt=True)
    elif libfabric == 'system':
        # Allow overriding pkg-config via LIBFABRIC_DIR, for platforms
        # without pkg-config.
        libfab_dir_val = overrides.get('LIBFABRIC_DIR')
        if libfab_dir_val:
            libs.extend(['-L' + libfab_dir_val + '/lib',
                         '-Wl,-rpath,' + libfab_dir_val + '/lib',
                         '-lfabric'])
        else:
            # Try using pkg-config to get the libraries to link
            # libfabric with.
            pclibs = third_party_utils.pkgconfig_get_link_args('libfabric',
                                                               system=True)
            for pcl in pclibs:
                libs.append(pcl)
                if pcl.startswith('-L'):
                    libs.append(pcl.replace('-L', '-Wl,-rpath,', 1))

    return libs
예제 #30
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
예제 #31
0
def get_compile_args():
    args = ([], [])
    libfabric_val = get()
    if libfabric_val == 'bundled':
        ucp_val = get_uniq_cfg_path()
        args = third_party_utils.get_bundled_compile_args('libfabric',
                                                          ucp=ucp_val)
    elif libfabric_val == 'system':
        flags = []

        # Allow overriding pkg-config via LIBFABRIC_DIR, for platforms
        # without pkg-config.
        libfab_dir_val = overrides.get('LIBFABRIC_DIR')
        if libfab_dir_val:
            args[1].append('-I' + libfab_dir_val + '/include')
        else:
            # Try using pkg-config to get the compile-time flags.
            x = third_party_utils.pkgconfig_get_system_compile_args(
                'libfabric')
            args = x

    if libfabric_val == 'system' or libfabric_val == 'bundled':
        flags = []
        launcher_val = chpl_launcher.get()
        ofi_oob_val = overrides.get_environ('CHPL_COMM_OFI_OOB')
        if 'mpi' in launcher_val or (ofi_oob_val and 'mpi' in ofi_oob_val):
            mpi_dir_val = overrides.get_environ('MPI_DIR')
            if mpi_dir_val:
                flags.append('-I' + mpi_dir_val + '/include')

        args[1].extend(flags)

    return args
예제 #32
0
def is_overridden():
    re2 = overrides.get('CHPL_RE2')

    if re2:
        return True

    return False
예제 #33
0
def using_chapel_module():
    chpl_home = overrides.get('CHPL_HOME', None)
    chpl_module_home = os.environ.get('CHPL_MODULE_HOME', None)
    if chpl_home and chpl_module_home:
        return os.path.normpath(chpl_home) == os.path.normpath(
            chpl_module_home)
    return False
예제 #34
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        llvm_val = 'unset'

        if compatible_platform_for_llvm():
            if is_included_llvm_built():
                llvm_val = 'bundled'
            elif has_compatible_installed_llvm():
                llvm_val = 'system'

        else:
            # This platform doesn't work with the LLVM backend
            # for one reason or another. So default to CHPL_LLVM=none.
            llvm_val = 'none'

    if llvm_val == 'llvm':
        warning("CHPL_LLVM=llvm is deprecated. Use CHPL_LLVM=bundled instead")
        llvm_val = 'bundled'

    if not compatible_platform_for_llvm():
        if llvm_val != 'none' and llvm_val != 'unset':
            warning("CHPL_LLVM={0} is not compatible with this "
                    "platform".format(llvm_val))

    return llvm_val
예제 #35
0
def get():
    substrate_val = overrides.get('CHPL_COMM_SUBSTRATE')
    if not substrate_val:
        comm_val = chpl_comm.get()
        platform_val = chpl_platform.get('target')
        arch_val = chpl_arch.get('target', get_lcd=True)

        if comm_val == 'gasnet':
            if platform_val == 'cray-xt':
                substrate_val = 'mpi'
            elif platform_val == 'cray-xe':
                substrate_val = 'gemini'
            elif platform_val == 'cray-xk':
                substrate_val = 'gemini'
            elif platform_val == 'cray-xc':
                substrate_val = 'aries'
            elif platform_val == 'marenostrum':
                substrate_val = 'udp'
            elif platform_val == 'pwr5':
                substrate_val = 'lapi'
            elif platform_val == 'pwr6':
                substrate_val = 'ibv'
            else:
                substrate_val = 'udp'
        else:
            substrate_val = 'none'
    return substrate_val
예제 #36
0
def get(flag='target'):
    if flag == 'network':
        atomics_val = overrides.get('CHPL_NETWORK_ATOMICS')
        if not atomics_val:
            comm_val = chpl_comm.get()
            if comm_val in ['ofi', 'ugni'] and get('target') != 'locks':
                atomics_val = comm_val
            else:
                atomics_val = 'none'
    elif flag == 'target':
        atomics_val = overrides.get('CHPL_ATOMICS')
        if not atomics_val:
            compiler_val = chpl_compiler.get('target')
            platform_val = chpl_platform.get('target')

            # we currently support intrinsics for gcc, intel, cray and clang.
            # gcc added initial support in 4.1, and added support for 64 bit
            # atomics on 32 bit platforms with 4.8. clang and intel also
            # support 64 bit atomics on 32 bit platforms and the cray compiler
            # will never run on a 32 bit machine. For pgi or 32 bit platforms
            # with an older gcc, we fall back to locks
            if compiler_val in [
                    'gnu', 'cray-prgenv-gnu', 'mpi-gnu', 'aarch64-gnu'
            ]:
                version = get_compiler_version('gnu')
                if version >= CompVersion('4.8'):
                    atomics_val = 'intrinsics'
                elif version >= CompVersion(
                        '4.1') and not platform_val.endswith('32'):
                    atomics_val = 'intrinsics'
            elif compiler_val == 'intel' or compiler_val == 'cray-prgenv-intel':
                atomics_val = 'intrinsics'
            elif compiler_val == 'cray-prgenv-cray':
                atomics_val = 'intrinsics'
            elif compiler_val in ['allinea', 'cray-prgenv-allinea']:
                atomics_val = 'cstdlib'
            elif compiler_val == 'clang':
                atomics_val = 'intrinsics'
            elif compiler_val == 'clang-included':
                atomics_val = 'intrinsics'

            # we can't use intrinsics, fall back to locks
            if not atomics_val:
                atomics_val = 'locks'
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)
    return atomics_val
예제 #37
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
예제 #38
0
def get():
    hwloc_val = overrides.get('CHPL_HWLOC')
    if not hwloc_val:
        tasks_val = chpl_tasks.get()
        if tasks_val == 'qthreads':
            hwloc_val = 'hwloc'
        else:
            hwloc_val = 'none'
    return hwloc_val
예제 #39
0
def get(flag='target'):
    if flag == 'network':
        atomics_val = overrides.get('CHPL_NETWORK_ATOMICS')
        if not atomics_val:
            if chpl_comm.get() == 'ugni':
                atomics_val = 'ugni'
            else:
                atomics_val = 'none'
    elif flag == 'target':
        atomics_val = overrides.get('CHPL_ATOMICS')
        if not atomics_val:
            compiler_val = chpl_compiler.get('target')
            platform_val = chpl_platform.get('target')

            # we currently support intrinsics for gcc, intel, cray and clang.
            # gcc added initial support in 4.1, and added support for 64 bit
            # atomics on 32 bit platforms with 4.8. clang and intel also
            # support 64 bit atomics on 32 bit platforms and the cray compiler
            # will never run on a 32 bit machine. For pgi or 32 bit platforms
            # with an older gcc, we fall back to locks
            if compiler_val in ['gnu', 'cray-prgenv-gnu', 'mpi-gnu']:
                version = get_compiler_version('gnu')
                if version >= CompVersion('4.8'):
                    atomics_val = 'intrinsics'
                elif version >= CompVersion('4.1') and not platform_val.endswith('32'):
                    atomics_val = 'intrinsics'
            elif compiler_val == 'aarch64-gnu':
                atomics_val = 'cstdlib'
            elif compiler_val == 'intel' or compiler_val == 'cray-prgenv-intel':
                atomics_val = 'intrinsics'
            elif compiler_val == 'cray-prgenv-cray':
                atomics_val = 'intrinsics'
            elif compiler_val == 'clang':
                atomics_val = 'intrinsics'
            elif compiler_val == 'clang-included':
                atomics_val = 'intrinsics'

            # we can't use intrinsics, fall back to locks
            if not atomics_val:
                atomics_val = 'locks'
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)
    return atomics_val
예제 #40
0
def get(flag='host'):

    if flag == 'host':
        arch_val = overrides.get('CHPL_HOST_ARCH', '')
    elif flag == 'target':
        arch_val = overrides.get('CHPL_TARGET_ARCH', '')
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)

    arch_flag = "CHPL_TARGET_ARCH"
    cpu_flag = "CHPL_TARGET_CPU"
    if flag == 'host':
      arch_flag = "CHPL_HOST_ARCH"
      cpu_flag = "CHPL_HOST_CPU"

    cpuarch = chpl_cpu.arch_for_cpu(arch_val, flag)
    if cpuarch:

        sys.stderr.write('Warning: {0}={1} is deprecated. '
                         'Please use {2}={3}\n'.format(arch_flag,
                                                       arch_val,
                                                       cpu_flag,
                                                       arch_val))
        arch_val = cpuarch

    if arch_val:
        return arch_val

    # compute the default
    cpu_val = chpl_cpu.get(flag).cpu
    cpuarch = chpl_cpu.arch_for_cpu(cpu_val, flag)
    machine = chpl_cpu.get_default_machine(flag)
    if cpuarch:
        if cpuarch != machine:
            sys.stderr.write('Warning: Cross compilation not yet supported. '
                             'Inferred {0}={1} based upon {2}={3} '
                             'but running on {4}.\n'.format(arch_flag,
                                                            cpuarch,
                                                            cpu_flag,
                                                            cpu_val,
                                                            machine))

    return chpl_cpu.get_default_machine(flag)
예제 #41
0
def get():
    regexp_val = overrides.get('CHPL_REGEXP')
    if not regexp_val:
        chpl_home = get_chpl_home()
        uniq_cfg_path = chpl_3p_re2_configs.get_uniq_cfg_path()
        regexp_subdir = os.path.join(chpl_home, 'third-party', 're2', 'install',
                                     uniq_cfg_path)
        regexp_header = os.path.join(regexp_subdir, 'include', 're2', 're2.h')
        if os.path.exists(regexp_header):
            regexp_val = 're2'
        else:
            regexp_val = 'none'
    return regexp_val
예제 #42
0
def get():
    comm_val = overrides.get('CHPL_COMM')
    if not comm_val:
        platform_val = chpl_platform.get('target')
        # Use ugni on cray-x* series
        if platform_val.startswith('cray-x'):
            comm_val = 'ugni'
        # Use gasnet on cray-cs
        elif platform_val.startswith('cray-'):
            comm_val = 'gasnet'
        else:
            comm_val = 'none'
    return comm_val
예제 #43
0
파일: chpl_make.py 프로젝트: DawidvC/chapel
def get():
    make_val = overrides.get('CHPL_MAKE')
    if not make_val:
        platform_val = chpl_platform.get()
        if platform_val.startswith('cygwin') or platform_val == 'darwin':
            make_val = 'make'
        elif platform_val.startswith('linux'):
            if find_executable('gmake'):
                make_val = 'gmake'
            else:
                make_val = 'make'
        else:
            make_val = 'gmake'
    return make_val
예제 #44
0
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        chpl_third_party = get_chpl_third_party()
        llvm_target_dir = get_uniq_cfg_path()
        llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
예제 #45
0
파일: chpl_llvm.py 프로젝트: gbtitus/chapel
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        # compute a default based on if the included llvm is built
        chpl_third_party = get_chpl_third_party()
        llvm_target_dir = get_uniq_cfg_path_for('llvm')
        llvm_subdir = os.path.join(chpl_third_party, 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
예제 #46
0
def get():
    comm_val = chpl_comm.get()
    if comm_val == 'gasnet':
        segment_val = overrides.get('CHPL_GASNET_SEGMENT')
        if not segment_val:
            substrate_val = chpl_comm_substrate.get()
            if substrate_val in ('portals', 'gemini', 'aries', 'smp'):
                segment_val = 'fast'
            elif substrate_val == 'ibv':
                segment_val = 'large'
            else:
                segment_val = 'everything'
    else:
        segment_val = 'none'
    return segment_val
예제 #47
0
파일: chpl_mem.py 프로젝트: DawidvC/chapel
def get(flag='host'):
    if flag == 'host':
        mem_val = 'cstdlib'
    elif flag == 'target':
        mem_val = overrides.get('CHPL_MEM')
        if not mem_val:
            platform_val = chpl_platform.get('target')
            cygwin = platform_val.startswith('cygwin')

            if cygwin:
                mem_val = 'cstdlib'
            else:
                mem_val = 'jemalloc'
    else:
        error("Invalid flag: '{0}'".format(flag), ValueError)
    return mem_val
예제 #48
0
파일: chpl_llvm.py 프로젝트: jcazzie/chapel
def get():
    llvm_val = overrides.get('CHPL_LLVM')
    if not llvm_val:
        host_platform = chpl_platform.get('host')
        host_compiler = chpl_compiler.get('host')
        chpl_home = get_chpl_home()
        llvm_target_dir = '{0}-{1}'.format(host_platform, host_compiler)
        llvm_subdir = os.path.join(chpl_home, 'third-party', 'llvm', 'install',
                                   llvm_target_dir)
        llvm_header = os.path.join(llvm_subdir, 'include', 'llvm',
                                   'PassSupport.h')
        if os.path.exists(llvm_header):
            llvm_val = 'llvm'
        else:
            llvm_val = 'none'
    return llvm_val
예제 #49
0
def get():
    jemalloc_val = overrides.get('CHPL_JEMALLOC')
    mem_val = chpl_mem.get('target')
    if not jemalloc_val:
        if mem_val == 'jemalloc':
            jemalloc_val = 'jemalloc'
        else:
            jemalloc_val = 'none'

    if mem_val == 'jemalloc' and jemalloc_val == 'none':
      error("CHPL_JEMALLOC must not be 'none' when CHPL_MEM is jemalloc")

    if mem_val != 'jemalloc' and jemalloc_val != 'none':
      error("CHPL_JEMALLOC must not be none when CHPL_MEM is not jemalloc")

    return jemalloc_val
예제 #50
0
파일: chpl_gmp.py 프로젝트: Ldelaney/chapel
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_platform = chpl_platform.get('target')

        # Detect if gmp has been built for this configuration.
        chpl_home = get_chpl_home()
        uniq_cfg_path = chpl_3p_gmp_configs.get_uniq_cfg_path()
        gmp_subdir = os.path.join(chpl_home, 'third-party', 'gmp',
                                  'install', uniq_cfg_path)

        if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
            gmp_val = 'gmp'
        elif target_platform.startswith('cray-x'):
            gmp_val = 'system'
        else:
            gmp_val = 'none'
    return gmp_val
예제 #51
0
def get():
    platform_val = chpl_platform.get('target')
    linux = platform_val.startswith('linux64')
    osx = platform_val.startswith('darwin')
    val = overrides.get('CHPL_UNWIND')

    if linux:
        if val == 'libunwind':
            return 'libunwind'
        elif val == 'system':
            return 'system'
    if osx:
        if val == 'libunwind':
            error("Using CHPL_UNWIND=libunwind is not supported on Mac OS X."
                  "\nUse CHPL_UNWIND=system instead.", ValueError)
        elif val == 'system':
            return 'system'
    return 'none'
예제 #52
0
def get():
    tasks_val = overrides.get("CHPL_TASKS")
    if not tasks_val:
        platform_val = chpl_platform.get("target")
        compiler_val = chpl_compiler.get("target")

        # CCE >= 8.4 is required to build qthreads (for gnu style inline asm.)
        # We build the module with a new enough version so we know the we can
        # use the qthreads it provides even if the user has an older CCE loaded
        using_qthreads_incompatible_cce = False
        if compiler_val == "cray-prgenv-cray":
            if get_compiler_version(compiler_val) < CompVersion("8.4") and not using_chapel_module():
                using_qthreads_incompatible_cce = True

        if platform_val.startswith("cygwin") or platform_val.startswith("netbsd") or using_qthreads_incompatible_cce:
            tasks_val = "fifo"
        else:
            tasks_val = "qthreads"
    return tasks_val
예제 #53
0
def get():
    tasks_val = overrides.get('CHPL_TASKS')
    if not tasks_val:
        platform_val = chpl_platform.get('target')
        compiler_val = chpl_compiler.get('target')

        # CCE >= 8.4 is required to build qthreads (for gnu style inline asm.)
        # We build the module with a new enough version so we know the we can
        # use the qthreads it provides even if the user has an older CCE loaded
        using_qthreads_incompatible_cce = False
        if compiler_val == 'cray-prgenv-cray':
            if (get_compiler_version(compiler_val) < CompVersion('8.4') and
                    not using_chapel_module()):
                using_qthreads_incompatible_cce = True

        if (platform_val.startswith('cygwin') or
                platform_val.startswith('netbsd') or
                using_qthreads_incompatible_cce):
            tasks_val = 'fifo'
        else:
            tasks_val = 'qthreads'
    return tasks_val
예제 #54
0
def get():
    gmp_val = overrides.get('CHPL_GMP')
    if not gmp_val:
        target_compiler = chpl_compiler.get('target')
        if target_compiler == 'cray-prgenv-cray':
            gmp_val = 'system'
        else:
            target_platform = chpl_platform.get('target')

            # Detect if gmp has been built for this configuration.
            third_party = get_chpl_third_party()
            uniq_cfg_path = chpl_3p_gmp_configs.get_uniq_cfg_path()
            gmp_subdir = os.path.join(third_party, 'gmp', 'install', uniq_cfg_path)

            if os.path.exists(os.path.join(gmp_subdir, 'include', 'gmp.h')):
                gmp_val = 'gmp'
            elif target_platform.startswith('cray-x'):
                gmp_val = 'system'
            elif target_platform == 'aarch64':
                gmp_val = 'system'
            else:
                gmp_val = 'none'
    return gmp_val
예제 #55
0
def get(flag='wide'):
    wide_val = overrides.get('CHPL_WIDE_POINTERS', 'struct')
    define = ''

    if wide_val == 'struct':
        define = '-DCHPL_WIDE_POINTER_STRUCT'
    else:
        match = re.match(r'node(\d+)', wide_val)
        if match:
            node_bits = int(match.group(1))
            if node_bits < 2 or node_bits > 60:
                sys.stderr.write("Error: Bad wide pointer node bit width: {0}\n".format(node_bits))
            else:
                define = "-DCHPL_WIDE_POINTER_PACKED " \
                         "-DCHPL_WIDE_POINTER_NODE_BITS={0}".format(node_bits)
        else:
            sys.stderr.write("Error: Unknown wide pointer format: {0}\n".format(wide_val))

    if flag == 'wide':
        return wide_val
    elif flag == 'define':
        return define
    else:
        raise ValueError("Invalid flag: '{0}'".format(flag))
예제 #56
0
def get_chpl_third_party():
    default = os.path.join(get_chpl_home(), 'third-party')
    chpl_third_party = overrides.get('CHPL_THIRD_PARTY', default)
    return chpl_third_party
예제 #57
0
def using_chapel_module():
    chpl_home = overrides.get('CHPL_HOME', None)
    chpl_module_home = os.environ.get('CHPL_MODULE_HOME', None)
    if chpl_home and chpl_module_home:
        return os.path.normpath(chpl_home) == os.path.normpath(chpl_module_home)
    return False
예제 #58
0
def get():
    locale_model_val = overrides.get('CHPL_LOCALE_MODEL', 'flat')
    return locale_model_val
예제 #59
0
def get():
    timers_val = overrides.get('CHPL_TIMERS', 'generic')
    return timers_val