Example #1
0
    def _get(cls, cpu, compiler, version):
        if cpu == 'unknown':
            return cpu

        if compiler in ['gnu', 'mpi-gnu', 'cray-prgenv-gnu']:
            if version >= CompVersion('8.0'):
                return cls.gcc8.get(cpu, '')
            elif version >= CompVersion('7.0'):
                return cls.gcc7.get(cpu, '')
            elif version >= CompVersion('6.0'):
                return cls.gcc6.get(cpu, '')
            elif version >= CompVersion('5.0'):
                return cls.gcc6.get(cpu, '')
            elif version >= CompVersion('4.9'):
                return cls.gcc49.get(cpu, '')
            elif version >= CompVersion('4.8'):
                return cls.gcc48.get(cpu, '')
            elif version >= CompVersion('4.7'):
                return cls.gcc47.get(cpu, '')
            elif version >= CompVersion('4.3'):
                return cls.gcc43.get(cpu, '')
            return 'none'
        elif compiler in ['intel', 'cray-prgenv-intel']:
            return cls.intel.get(cpu, '')
        elif compiler in ['clang', 'clang-included', 'allinea']:
            # Clang doesn't know how to do architecture detection for aarch64.
            if cpu == 'native':
                if get_native_machine() == 'aarch64':
                    return 'unknown'
            return cls.clang.get(cpu, '')
        else:
            stderr.write('Warning: Unknown compiler: "{0}"\n'.format(compiler))
            return ''
Example #2
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
Example #3
0
    def _get(cls, arch, compiler, version):
        if arch == 'unknown':
            return arch

        if compiler in ['gnu', 'mpi-gnu', 'aarch64-gnu']:
            if version >= CompVersion('4.9'):
                return cls.gcc49.get(arch, '')
            elif version >= CompVersion('4.7'):
                return cls.gcc47.get(arch, '')
            elif version >= CompVersion('4.3'):
                return cls.gcc43.get(arch, '')
            return 'none'
        elif compiler == 'intel':
            return cls.intel.get(arch, '')
        elif compiler == 'clang':
            return cls.clang.get(arch, '')
        elif compiler == 'clang-included':
            return cls.clang.get(arch, '')
        else:
            stderr.write('Warning: Unknown compiler: "{0}"\n'.format(compiler))
            return ''
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
Example #5
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 default to C standard atomics (cstdlib) for gcc 5 and newer.
            # Some prior versions of gcc look like they support standard
            # atomics, but have buggy or missing parts of the implementation,
            # so we do not try to use cstdlib with gcc < 5. If support is
            # detected for clang (via preprocessor checks) we also default to
            # cstdlib atomics. For llvm/clang-included we always default to
            # cstdlib atomics. We know our clang-included will have compiler
            # support for atomics and llvm requires gcc 4.8 (or a compiler with
            # equivalent features) to be built so we know we'll have system
            # header support too.
            #
            # We 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('5.0'):
                    atomics_val = 'cstdlib'
                elif 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 = 'cstdlib'
            elif compiler_val in ['allinea', 'cray-prgenv-allinea']:
                atomics_val = 'cstdlib'
            elif compiler_val == 'clang':
                if has_std_atomics(compiler_val):
                    atomics_val = 'cstdlib'
                else:
                    atomics_val = 'intrinsics'
            elif compiler_val == 'clang-included':
                atomics_val = 'cstdlib'

            # 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