def get(flag='host'): if flag == 'host': mem_val = 'cstdlib' elif flag == 'target': mem_val = os.environ.get('CHPL_MEM') if not mem_val: comm_val = chpl_comm.get() #platform_val = chpl_platform.get('host') #arch_val = chpl_arch.get('target', get_lcd=True) #tcmallocCompat = ["gnu", "clang", "clang-included", "intel"] # true if tcmalloc is compatible with the target compiler #if (not (platform_val == 'cray-xc' and arch_val == 'knc') and # (not platform_val.startswith("cygwin")) and # any(sub in chpl_compiler.get('target') for sub in tcmallocCompat)): # return 'tcmalloc' if comm_val == 'gasnet': segment_val = chpl_comm_segment.get() if segment_val == 'fast' or segment_val == 'large': mem_val = 'dlmalloc' else: mem_val = 'cstdlib' elif comm_val == 'ugni': mem_val = 'tcmalloc' else: mem_val = 'cstdlib' else: raise ValueError("Invalid flag: '{0}'".format(flag)) return mem_val
def get(): substrate_val = os.environ.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
def get(): launcher_val = os.environ.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'): has_aprun = utils.find_executable('aprun') has_slurm = utils.find_executable('srun') if has_aprun and has_slurm: launcher_val = 'none' elif has_aprun: launcher_val = 'aprun' elif has_slurm: 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
def get(): substrate_val = os.environ.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') 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': if arch_val == 'knc': substrate_val = 'mpi' else: 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(): tasks_val = os.environ.get('CHPL_TASKS') if not tasks_val: arch_val = chpl_arch.get('target', get_lcd=True) platform_val = chpl_platform.get() compiler_val = chpl_compiler.get('target') comm_val = chpl_comm.get() # use muxed on cray-x* machines using the module and supported compiler if (comm_val == 'ugni' and platform_val.startswith('cray-x') and utils.using_chapel_module() and compiler_val in ('cray-prgenv-gnu', 'cray-prgenv-intel') and arch_val != 'knc'): tasks_val = 'muxed' elif (arch_val == 'knc' or platform_val.startswith('cygwin') or platform_val.startswith('netbsd') or compiler_val == 'pgi' or compiler_val == 'cray-prgenv-pgi' or compiler_val == 'cray-prgenv-cray'): tasks_val = 'fifo' else: tasks_val = 'qthreads' return tasks_val
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
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
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
def get(): launcher_val = overrides.get('CHPL_LAUNCHER') comm_val = chpl_comm.get() substrate_val = chpl_comm_substrate.get() if comm_val == 'gasnet' and substrate_val == 'udp': if not launcher_val: launcher_val = 'amudprun' elif launcher_val not in ('none', 'amudprun'): error('CHPL_LAUNCHER={} is not supported for CHPL_COMM=gasnet ' 'CHPL_COMM_SUBSTRATE=udp, CHPL_LAUNCHER=amudprun is ' 'required'.format(launcher_val)) if not launcher_val: platform_val = chpl_platform.get('target') if platform_val.startswith('cray-x') or platform_val.startswith( 'hpe-cray-'): 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: 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) warning('Cannot detect launcher on this system. Please ' 'set CHPL_LAUNCHER in the environment.') elif comm_val == 'gasnet': if substrate_val == 'smp': launcher_val = 'smp' elif substrate_val == 'mpi': launcher_val = slurm_prefix('gasnetrun_mpi', platform_val) elif substrate_val == 'ibv': launcher_val = slurm_prefix('gasnetrun_ibv', platform_val) elif substrate_val == 'ucx': launcher_val = slurm_prefix('gasnetrun_ucx', platform_val) elif substrate_val == 'ofi': launcher_val = slurm_prefix('gasnetrun_ofi', platform_val) else: if platform_val == 'cray-cs' and find_executable('srun'): launcher_val = 'slurm-srun' else: launcher_val = 'none' if launcher_val is None: launcher_val = 'none' return launcher_val
def get(): launcher_val = overrides.get('CHPL_LAUNCHER') if not launcher_val: comm_val = chpl_comm.get() platform_val = chpl_platform.get('target') if platform_val.startswith('cray-') or platform_val.startswith( 'hpe-cray-'): 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: 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': launcher_val = 'gasnetrun_ibv' elif substrate_val == 'ucx': launcher_val = 'gasnetrun_ucx' 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
def check(): platform_val = chpl_platform.get('target') if platform_val.startswith('cray-x'): comm_val = chpl_comm.get() substrate_val = chpl_comm_substrate.get() is_using_hugepages = 'HUGETLB' in os.environ.get('PE_PRODUCT_LIST', '') if comm_val == 'gasnet' and is_using_hugepages: if substrate_val == 'gemini' or substrate_val == 'aries': stderr.write("Warning: compiling with the craype-hugepages module while " "using the GASNet {0} conduit is not supported and " "will lead to link errors\n".format(substrate_val))
def get(): comm_val = chpl_comm.get() if comm_val == 'ofi': libfabric_val = overrides.get('CHPL_LIBFABRIC') if not libfabric_val: libfabric_val = 'libfabric' if libfabric_val == 'none': error("CHPL_LIBFABRIC must not be 'none' when CHPL_COMM is ofi") else: libfabric_val = 'none' return libfabric_val
def check(): platform_val = chpl_platform.get('target') if platform_val.startswith('cray-x'): comm_val = chpl_comm.get() substrate_val = chpl_comm_substrate.get() is_using_hugepages = 'HUGETLB' in os.environ.get('PE_PRODUCT_LIST', '') if comm_val == 'gasnet' and is_using_hugepages: if substrate_val == 'gemini' or substrate_val == 'aries': stderr.write( "Warning: compiling with the craype-hugepages module while " "using the GASNet {0} conduit is not supported and " "will lead to link errors\n".format(substrate_val))
def default_cpu(flag): comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(flag) platform_val = chpl_platform.get(flag) cpu = 'unknown' if comm_val == 'none' and ('linux' in platform_val or platform_val == 'darwin' or platform_val.startswith('cygwin')): cpu = 'native' return cpu
def get(flag='host'): if flag == 'host': mem_val = 'cstdlib' elif flag == 'target': mem_val = os.environ.get('CHPL_MEM') if not mem_val: comm_val = chpl_comm.get() if comm_val != 'none': mem_val='jemalloc' else: mem_val = 'cstdlib' else: raise ValueError("Invalid flag: '{0}'".format(flag)) return mem_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') comm_val = chpl_comm.get() if (platform_val.startswith('cygwin') or platform_val.startswith('netbsd') or compiler_val == 'cray-prgenv-cray'): tasks_val = 'fifo' else: tasks_val = 'qthreads' return tasks_val
def get(): comm_val = chpl_comm.get() if comm_val == 'gasnet': segment_val = os.environ.get('CHPL_GASNET_SEGMENT') if not segment_val: substrate_val = chpl_comm_substrate.get() if substrate_val == 'portals' or substrate_val == 'gemini' or substrate_val == 'aries': segment_val = 'fast' elif substrate_val == 'ibv': segment_val = 'large' else: segment_val = 'everything' else: segment_val = 'none' return segment_val
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
def get_good_nodepara(): """ Get a "good" nodepara value: use up to 3 for comm=none testing, but limit to 1 for comm!=none since that's already oversubscribed. TODO: Consider increasing nodepara if no other shared jobs are running. Note: need to wait to do this until everybody's using slurm on chapcs. """ nodepara = 3 if chpl_comm.get() != 'none': nodepara = 1 # if get_num_shared_jobs_running() == 0: # nodepara += 1 return nodepara
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
def get(): launcher_val = os.environ.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'): has_aprun = utils.find_executable('aprun') has_slurm = utils.find_executable('srun') if has_aprun and has_slurm: launcher_val = 'none' elif has_aprun: launcher_val = 'aprun' elif has_slurm: launcher_val = 'slurm-srun' elif platform_val == 'marenostrum': launcher_val = 'marenostrum' elif compiler_val == 'tile-cc': launcher_val = 'tile-monitor' 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' return launcher_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(): 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-xc': substrate_val = 'aries' elif platform_val in ('cray-cs', 'hpe-apollo'): substrate_val = 'ibv' elif platform_val == 'pwr6': substrate_val = 'ibv' else: substrate_val = 'udp' else: substrate_val = 'none' return substrate_val
def get(): tasks_val = os.environ.get("CHPL_TASKS") if not tasks_val: arch_val = chpl_arch.get("target", get_lcd=True) platform_val = chpl_platform.get() compiler_val = chpl_compiler.get("target") comm_val = chpl_comm.get() if ( arch_val == "knc" or platform_val.startswith("cygwin") or platform_val.startswith("netbsd") or compiler_val == "cray-prgenv-cray" ): tasks_val = "fifo" else: tasks_val = "qthreads" return tasks_val
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() platform_val = chpl_platform.get('target') if substrate_val in ('aries', 'smp', 'ucx'): segment_val = 'fast' elif substrate_val == 'ofi' and platform_val == 'hpe-cray-ex': segment_val = 'fast' elif substrate_val == 'ibv': segment_val = 'large' else: segment_val = 'everything' else: segment_val = 'none' return segment_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(): 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: if platform_val == 'cray-shasta': libfabric_val = 'system' else: libfabric_val = 'libfabric' if libfabric_val == 'none': error("CHPL_LIBFABRIC must not be 'none' when CHPL_COMM is ofi") if platform_val == 'cray-shasta' and libfabric_val != 'system': sys.stderr.write('Warning: CHPL_LIBFABRIC!=system is discouraged ' 'on Shasta\n') else: libfabric_val = 'none' return libfabric_val
def verify_arch(arch, flag): comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(flag) platform_val = chpl_platform.get(flag) isprgenv = compiler_is_prgenv(compiler_val) # Only try to do any architecture 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 # check_arch = False if not isprgenv: if flag == 'target': if comm_val == 'none': if ('linux' in platform_val or platform_val == 'darwin' or platform_val.startswith('cygwin')): check_arch = True if flag == 'host': check_arch = True if check_arch and arch and arch not in ['none', 'unknown', 'native']: # Print a friendly warning if it's unlikely the user could run # their program. This could be printed in cross-compilation settings. machine = machine_for_arch(arch) cur_machine = get_native_machine() warn = (machine != cur_machine) 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): warn = True except ValueError: stderr.write( "Warning: Unknown platform, could not find CPU information\n") if warn: 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")
def get(flag='target'): if flag == 'network': atomics_val = overrides.get('CHPL_NETWORK_ATOMICS') if not atomics_val: if chpl_comm.get() == 'ugni' and get('target') != 'locks': 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', '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
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': warning('CHPL_LIBFABRIC!=system is discouraged on HPE Cray EX') else: libfabric_val = 'none' return libfabric_val
def get(flag='host'): if flag == 'host': mem_val = 'default' elif flag == 'target': mem_val = os.environ.get('CHPL_MEM') if not mem_val: comm_val = chpl_comm.get() if comm_val == 'gasnet': segment_val = chpl_comm_segment.get() if segment_val == 'fast' or segment_val == 'large': mem_val = 'dlmalloc' else: mem_val = 'default' elif comm_val == 'ugni': mem_val = 'tcmalloc' else: mem_val = 'default' else: raise ValueError("Invalid flag: '{0}'".format(flag)) return mem_val
def get(): libfabric_val = overrides.get('CHPL_LIBFABRIC') comm_val = chpl_comm.get() if not libfabric_val: if comm_val == 'ofi': libfabric_val = 'system' else: libfabric_val = 'none' if comm_val == 'ofi' and libfabric_val == 'none': error("CHPL_LIBFABRIC must not be 'none' when CHPL_COMM is ofi") if comm_val != 'ofi' and libfabric_val != 'none': error("CHPL_LIBFABRIC must be 'none' when CHPL_COMM is not ofi") if libfabric_val == 'libfabric': error( "Using CHPL_LIBFABRIC=libfabric is not yet supported." "\nUse CHPL_LIBFABRIC=system instead.", ValueError) return libfabric_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: arch_val = chpl_arch.get('target', get_lcd=True) platform_val = chpl_platform.get() compiler_val = chpl_compiler.get('target') comm_val = chpl_comm.get() # use muxed on cray-x* machines using the module and supported compiler if (comm_val == 'ugni' and platform_val.startswith('cray-x') and utils.using_chapel_module() and compiler_val in ('cray-prgenv-gnu', 'cray-prgenv-intel') and arch_val != 'knc'): tasks_val = 'muxed' elif (arch_val == 'knc' or platform_val.startswith('cygwin') or platform_val.startswith('netbsd') or compiler_val == 'cray-prgenv-cray'): tasks_val = 'fifo' else: tasks_val = 'qthreads' return tasks_val
def gather_pe_chpl_pkgconfig_libs(): # Don't do anything if we aren't using a PrgEnv compiler if chpl_compiler.get_prgenv_compiler() == 'none': return "" import chpl_comm, chpl_comm_substrate, chpl_aux_filesys, chpl_libfabric platform = chpl_platform.get('target') comm = chpl_comm.get() substrate = chpl_comm_substrate.get() auxfs = chpl_aux_filesys.get() ret = os.environ.get('PE_CHAPEL_PKGCONFIG_LIBS', '') if comm != 'none': if platform != 'hpe-cray-ex': # Adding -lhugetlbfs gets the PrgEnv driver to add the appropriate # linker option for static linking with it. While it's not always # used with Chapel programs, it is expected to be the common case # when running on a Cray X*, so just always linking it is ok. # (We don't add it for HPE Cray EX systems, where it's not needed.) ret = 'craype-hugetlbfs:cray-pmi:' + ret if platform.startswith('cray-x'): ret = 'cray-ugni:' + ret if comm == 'gasnet' and substrate == 'aries': ret = 'cray-udreg:' + ret if comm == 'ofi' and chpl_libfabric.get() == 'system': ret = 'libfabric:' + ret # on login/compute nodes, lustre requires the devel api to make # lustre/lustreapi.h available (it's implicitly available on esl nodes) if 'lustre' in auxfs: exists, returncode, out, err = try_run_command( ['pkg-config', '--exists', 'cray-lustre-api-devel']) if exists and returncode == 0: ret = 'cray-lustre-api-devel:' + ret return ret
def verify_cpu(cpu, flag): comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(flag) platform_val = chpl_platform.get(flag) isprgenv = compiler_is_prgenv(compiler_val) # Only try to do any architecture 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 # check_cpu = False if not isprgenv: if flag == 'target': if comm_val == 'none': if ('linux' in platform_val or platform_val == 'darwin' or platform_val.startswith('cygwin')): check_cpu = True if flag == 'host': check_cpu = True if check_cpu and cpu and cpu not in ['none', 'unknown', 'native']: # Print a friendly warning if it's unlikely the user could run # their program. This could be printed in cross-compilation settings. warn = False try: vendor_string, feature_string = get_cpuinfo(platform_val) detected_cpu = feature_sets.find(vendor_string, feature_string) if not feature_sets.subset(cpu, detected_cpu): warn = True except ValueError: stderr.write("Warning: Unknown platform, could not find CPU information\n") if warn: 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")
def verify_cpu(cpu, flag): comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(flag) platform_val = chpl_platform.get(flag) # Only try to do any architecture 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 # check_cpu = False if flag == 'target': if comm_val == 'none': if not target_compiler_is_prgenv(): if ('linux' in platform_val or platform_val == 'darwin' or platform_val.startswith('cygwin')): check_cpu = True if flag == 'host': check_cpu = True if check_cpu and cpu and cpu not in ['none', 'unknown', 'native']: # Print a friendly warning if it's unlikely the user could run # their program. This could be printed in cross-compilation settings. warn = False try: vendor_string, feature_string = get_cpuinfo(platform_val) detected_cpu = feature_sets.find(vendor_string, feature_string) if not feature_sets.subset(cpu, detected_cpu): warn = True except ValueError: warning("Unknown platform, could not find CPU information") if warn: 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.")
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 default_cpu(flag): comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(flag) platform_val = chpl_platform.get(flag) cpu = 'unknown' if comm_val == 'none' and ('linux' in platform_val or platform_val == 'darwin' or platform_val.startswith('cygwin')): # Clang cannot detect the architecture for aarch64. Otherwise, # 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 if compiler_val in ['clang', 'clang-included']: if get_native_machine() == 'aarch64': cpu = 'unknown' else: cpu = 'native' else: cpu = 'native' return cpu
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 = 'intrinsics' 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
def get(location, map_to_compiler=False, get_lcd=False): arch_tuple = collections.namedtuple('arch_tuple', ['flag', 'arch']) if not location or location == "host": arch = overrides.get('CHPL_HOST_ARCH', '') elif location == 'target': arch = overrides.get('CHPL_TARGET_ARCH', '') else: raise InvalidLocationError(location) # fast path out for when the user has set arch=none if arch == 'none': return arch_tuple('none', arch) comm_val = chpl_comm.get() compiler_val = chpl_compiler.get(location) platform_val = chpl_platform.get(location) isprgenv = compiler_is_prgenv(compiler_val) if compiler_val == 'clang-included': isprgenv = compiler_is_prgenv(chpl_compiler.get(location, llvm_mode="orig")) if isprgenv: cray_arch = os.environ.get('CRAY_CPU_TARGET', 'none') if arch and (arch != 'none' and arch != 'unknown' and arch != cray_arch): 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 = cray_arch 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") if is_known_arm(arch): return arch_tuple('cpu', arch) else: return arch_tuple('arch', arch) elif 'pgi' in compiler_val: return arch_tuple('none', 'none') elif 'cray' in compiler_val: return arch_tuple('none', 'none') elif 'ibm' in compiler_val: return arch_tuple('none', '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: # Clang cannot detect the architecture for aarch64. Otherwise, # 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 if compiler_val in ['clang', 'clang-included']: if get_native_machine() == 'aarch64': arch = 'unknown' else: arch = 'native' else: arch = 'native' if map_to_compiler: version = get_compiler_version(compiler_val) (flag, arch) = argument_map.find(arch, compiler_val, version) elif arch and arch != 'none' and arch != 'unknown': if is_known_arm(arch): flag = 'cpu' else: flag = 'arch' else: flag = 'none' return arch_tuple(flag or 'none', arch or 'unknown')
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
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'
self.default)) if not self.help_text or not isinstance(self.help_text, basestring): raise ValueError( 'help_text must be a non-empty string: {0}'.format( self.help_text)) """Dimensions this script knows about when compiling chapel. Order determines how they will show up in the usage and what order is used in interactive mode. """ Dimensions = [ Dimension( 'comm', 'CHPL_COMM', values=['none', 'gasnet'], default=chpl_comm.get(), help_text='Chapel communication ({var_name}) value to build.', ), Dimension( 'task', 'CHPL_TASKS', values=['fifo', 'qthreads'], default=chpl_tasks.get(), help_text='Tasks ({var_name}) values to build.', ), Dimension( 'mem', 'CHPL_MEM', values=['cstdlib', 'jemalloc'], default=chpl_mem.get('target'), help_text='Memory allocator ({var_name}) values to build.',
if not self.default or not isinstance(self.default, basestring): raise ValueError('default must be a non-empty string: {0}'.format( self.default)) if not self.help_text or not isinstance(self.help_text, basestring): raise ValueError('help_text must be a non-empty string: {0}'.format( self.help_text)) """Dimensions this script knows about when compiling chapel. Order determines how they will show up in the usage and what order is used in interactive mode. """ Dimensions = [ Dimension( 'comm', 'CHPL_COMM', values=['none', 'gasnet'], default=chpl_comm.get(), help_text='Chapel communcation ({var_name}) value to build.', ), Dimension( 'task', 'CHPL_TASKS', values=['fifo', 'qthreads'], default=chpl_tasks.get(), help_text='Tasks ({var_name}) values to build.', ), Dimension( 'mem', 'CHPL_MEM', values=['cstdlib', 'tcmalloc', 'jemalloc', 'dlmalloc'], default=chpl_mem.get('target'), help_text='Memory allocator ({var_name}) values to build.', ), Dimension(
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"