wip: apple-clang only and now parallelism
This commit is contained in:
parent
e1bcefd805
commit
f60cb4090b
@ -233,38 +233,25 @@ def find_compilers(path_hints=None):
|
|||||||
path_hints = get_path("PATH")
|
path_hints = get_path("PATH")
|
||||||
default_paths = fs.search_paths_for_executables(*path_hints)
|
default_paths = fs.search_paths_for_executables(*path_hints)
|
||||||
|
|
||||||
# To detect the version of the compilers, we dispatch a certain number
|
pkg_cls_to_check = [spack.repo.path.get_pkg_class(pkg) for pkg in ["apple-clang"]]
|
||||||
# of function calls to different workers. Here we construct the list
|
detected_compilers = spack.detection.by_executable(pkg_cls_to_check, path_hints=default_paths)
|
||||||
# of arguments for each call.
|
|
||||||
arguments = []
|
|
||||||
for o in all_os_classes():
|
|
||||||
search_paths = getattr(o, "compiler_search_paths", default_paths)
|
|
||||||
arguments.extend(arguments_to_detect_version_fn(o, search_paths))
|
|
||||||
|
|
||||||
# Here we map the function arguments to the corresponding calls
|
platform = spack.platforms.host()
|
||||||
tp = multiprocessing.pool.ThreadPool()
|
operating_system = platform.operating_system("default_os")
|
||||||
try:
|
target = platform.target("default_target")
|
||||||
detected_versions = tp.map(detect_version, arguments)
|
|
||||||
finally:
|
|
||||||
tp.close()
|
|
||||||
|
|
||||||
def valid_version(item):
|
compilers = []
|
||||||
value, error = item
|
for name, detected in detected_compilers.items():
|
||||||
if error is None:
|
for entry in detected:
|
||||||
return True
|
compiler_cls = spack.compilers.class_for_compiler_name(name)
|
||||||
try:
|
spec = spack.spec.CompilerSpec(entry.spec.name, f"={entry.spec.versions}")
|
||||||
# This will fail on Python 2.6 if a non ascii
|
paths = [
|
||||||
# character is in the error
|
entry.spec.extra_attributes["compilers"].get(x, None)
|
||||||
tty.debug(error)
|
for x in ("c", "cxx", "f77", "fc")
|
||||||
except UnicodeEncodeError:
|
]
|
||||||
pass
|
compilers.append(compiler_cls(spec, str(operating_system), str(target), paths))
|
||||||
return False
|
|
||||||
|
|
||||||
def remove_errors(item):
|
return compilers
|
||||||
value, _ = item
|
|
||||||
return value
|
|
||||||
|
|
||||||
return make_compiler_list(map(remove_errors, filter(valid_version, detected_versions)))
|
|
||||||
|
|
||||||
|
|
||||||
def find_new_compilers(path_hints=None, scope=None):
|
def find_new_compilers(path_hints=None, scope=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user