def get_link_args(): link_args = \ third_party_utils.default_get_link_args('qthread', ucp=get_uniq_cfg_path(), libs=['libqthread_chpl.la', '-lchpl', 'libqthread.la']) compiler_val = chpl_compiler.get('target') if (compiler_val == 'cray-prgenv-cray' or (compiler_is_prgenv(compiler_val) and chpl_llvm.get() != 'none')): link_args.append('-lrt') return link_args
def get_link_args(): link_args = \ third_party_utils.default_get_link_args('qthread', ucp=get_uniq_cfg_path(), libs=['libqthread_chpl.la', '-lchpl', 'libqthread.la']) compiler_val = chpl_compiler.get('target') if ( compiler_val == 'cray-prgenv-cray' or (compiler_is_prgenv(compiler_val) and chpl_llvm.get() != 'none' )): link_args.append('-lrt') return link_args
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"
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: 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'