def get(flag='target'): if flag == 'network': atomics_val = os.environ.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 = os.environ.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 == 'gnu' or compiler_val == 'cray-prgenv-gnu': version = utils.get_compiler_version('gnu') if version.major > 4: atomics_val = 'intrinsics' if version.major == 4: if version.minor >= 8: atomics_val = 'intrinsics' elif version.minor >= 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 == '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: raise ValueError("Invalid flag: '{0}'".format(flag)) return atomics_val
def get(flag='target'): if flag == 'network': atomics_val = os.environ.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 = os.environ.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 == 'gnu' or compiler_val == 'cray-prgenv-gnu': version = utils.get_compiler_version('gnu') if version.major > 4: atomics_val = 'intrinsics' if version.major == 4: if version.minor >= 8: atomics_val = 'intrinsics' elif version.minor >= 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 == '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: raise ValueError("Invalid flag: '{0}'".format(flag)) return atomics_val
def get(flag="target"): if flag == "network": atomics_val = os.environ.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 = os.environ.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 == "gnu" or compiler_val == "cray-prgenv-gnu": version = utils.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 == "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: raise ValueError("Invalid flag: '{0}'".format(flag)) return atomics_val
def get(): tasks_val = os.environ.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 (utils.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
def get(): tasks_val = os.environ.get('CHPL_TASKS') if not tasks_val: platform_val = chpl_platform.get() 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 (utils.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
def get(flag='target'): if flag == 'network': atomics_val = os.environ.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 = os.environ.get('CHPL_ATOMICS') if not atomics_val: compiler_val = chpl_compiler.get('target') platform_val = chpl_platform.get('target') # we currently support intrinsics for 64 bit platforms using gcc, # intel, or cray compilers but not pgi. pgi does not have support # for atomic intrinsics so we revert to locks for that case. We # could add support for 32-bit platforms and only use locks for # 64-bit atomics but we can cross that bridge when we get there. if platform_val != "linux32": if compiler_val == 'gnu' or compiler_val == 'cray-prgenv-gnu': version = utils.get_compiler_version('gnu') if version >= 4.1: atomics_val = 'intrinsics' elif 'intel' in compiler_val or compiler_val == 'cray-prgenv-intel': atomics_val = 'intrinsics' elif compiler_val == 'cray-prgenv-cray': atomics_val = 'intrinsics' elif 'clang' in compiler_val: atomics_val = 'intrinsics' # we can't use intrinsics, fall back to locks if not atomics_val: atomics_val = 'locks' else: raise ValueError("Invalid flag: '{0}'".format(flag)) return atomics_val
def get(location, map_to_compiler=False, get_lcd=False): if not location or location == "host": arch = os.environ.get('CHPL_HOST_ARCH', '') elif location == 'target': arch = os.environ.get('CHPL_TARGET_ARCH', '') else: raise InvalidLocationError(location) # fast path out for when the user has set arch=none if arch == 'none': return arch comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(location) platform_val = chpl_platform.get(location) if compiler_val.startswith('cray-prgenv'): if arch and (arch != 'none' or arch != 'unknown'): stderr.write("Warning: Setting the processor type through " "environment variables is not supported for " "cray-prgenv-*. Please use the appropriate craype-* " "module for your processor type.\n") arch = os.environ.get('CRAY_CPU_TARGET', 'none') if arch == 'none': stderr.write( "Warning: No craype-* processor type module was " "detected, please load the appropriate one if you want " "any specialization to occur.\n") if get_lcd: arch = get_module_lcd_arch(platform_val, arch) if arch == 'none': stderr.write("Warning: Could not detect the lowest common " "denominator processor type for this platform. " "You may be unable to use the Chapel compiler\n") return arch elif 'pgi' in compiler_val: return 'none' elif 'cray' in compiler_val: return 'none' elif 'ibm' in compiler_val: return 'none' # Only try to do any auto-detection or verification when: # comm == none -- The inverse means that we are probably cross-compiling. # # linux/dawin/ -- The only platforms that we should try and detect on. # cygwin Crays will be handled through the craype-* modules # if comm_val == 'none' and ('linux' in platform_val or platform_val == 'darwin' or platform_val.startswith('cygwin')): if arch: if arch != 'knc' and not location or location == 'host': # when a user supplies an architecture, and it seems reasonable # to double check their choice we do so. This will only # generate a warning that the user may not be able to run # whatever they compile. # # This only runs when location is 'host' since we # conservatively assume that a setting for 'target' could be in # a cross-compilation setting try: vendor_string, feature_string = get_cpuinfo(platform_val) detected_arch = feature_sets.find(vendor_string, feature_string) if not feature_sets.subset(arch, detected_arch): stderr.write( "Warning: The supplied processor type does " "not appear to be compatible with the host " "processor type. The resultant binary may " "not run on the current machine.\n") except ValueError: stderr.write( "Warning: Unknown platform, could not find CPU information\n" ) else: # let the backend compiler do the actual feature set detection. We # could be more aggressive in setting a precise architecture using # the double checking code above, but it seems like a waste of time # to not use the work the backend compilers have already done arch = 'native' if map_to_compiler: version = utils.get_compiler_version(compiler_val) arch = argument_map.find(arch, compiler_val, version) return arch or 'unknown'
def get(location, map_to_compiler=False, get_lcd=False): if not location or location == "host": arch = os.environ.get("CHPL_HOST_ARCH", "") elif location == "target": arch = os.environ.get("CHPL_TARGET_ARCH", "") else: raise InvalidLocationError(location) # fast path out for when the user has set arch=none if arch == "none": return arch comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(location) platform_val = chpl_platform.get(location) isprgenv = utils.compiler_is_prgenv(compiler_val) if isprgenv: if arch and (arch != "none" or arch != "unknown"): stderr.write( "Warning: Setting the processor type through " "environment variables is not supported for " "cray-prgenv-*. Please use the appropriate craype-* " "module for your processor type.\n" ) arch = os.environ.get("CRAY_CPU_TARGET", "none") if arch == "none": stderr.write( "Warning: No craype-* processor type module was " "detected, please load the appropriate one if you want " "any specialization to occur.\n" ) if get_lcd: arch = get_module_lcd_arch(platform_val, arch) if arch == "none": stderr.write( "Warning: Could not detect the lowest common " "denominator processor type for this platform. " "You may be unable to use the Chapel compiler\n" ) return arch elif "pgi" in compiler_val: return "none" elif "cray" in compiler_val: return "none" elif "ibm" in compiler_val: return "none" # Only try to do any auto-detection or verification when: # comm == none -- The inverse means that we are probably cross-compiling. # # linux/dawin/ -- The only platforms that we should try and detect on. # cygwin Crays will be handled through the craype-* modules # if comm_val == "none" and ( "linux" in platform_val or platform_val == "darwin" or platform_val.startswith("cygwin") ): if arch and arch not in ["none", "unknown", "native"]: if location == "host": # when a user supplies an architecture, and it seems reasonable # to double check their choice we do so. This will only # generate a warning that the user may not be able to run # whatever they compile. # # This only runs when location is 'host' since we # conservatively assume that a setting for 'target' could be in # a cross-compilation setting try: vendor_string, feature_string = get_cpuinfo(platform_val) detected_arch = feature_sets.find(vendor_string, feature_string) if not feature_sets.subset(arch, detected_arch): stderr.write( "Warning: The supplied processor type does " "not appear to be compatible with the host " "processor type. The resultant binary may " "not run on the current machine.\n" ) except ValueError: stderr.write("Warning: Unknown platform, could not find CPU information\n") else: # let the backend compiler do the actual feature set detection. We # could be more aggressive in setting a precise architecture using # the double checking code above, but it seems like a waste of time # to not use the work the backend compilers have already done arch = "native" if map_to_compiler: version = utils.get_compiler_version(compiler_val) arch = argument_map.find(arch, compiler_val, version) return arch or "unknown"