diff --git a/mpcdf_common.py b/mpcdf_common.py index af230f81bb440ac1bc68bbfb44d2f68d448fed96..20f2b676aedb3bdd310cc6209bc2e44e434ce737 100644 --- a/mpcdf_common.py +++ b/mpcdf_common.py @@ -194,9 +194,14 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r raise SystemExit(1) compilers = try_get_attribute(package, "compiler_modules", with_project=True) - all_compilers = try_get_attribute(None, "compiler_modules") mpis = try_get_attribute(package, "mpi_modules", with_project=True) cudas = try_get_attribute(package, "cuda_modules", with_project=True) + pgis = try_get_attribute(package, "pgi_modules", with_project=True) + + all_compilers = try_get_attribute(None, "compiler_modules") + all_mpis = try_get_attribute(None, "mpi_modules") + all_cudas = try_get_attribute(None, "cuda_modules") + all_pgis = try_get_attribute(None, "pgi_modules") default_compilers = try_get_attribute(None, "default_compiler") default_mpis = try_get_attribute(None, "default_mpi") @@ -213,7 +218,7 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r print("Enabling", name) def actual_compilers(): - for compiler in compilers: + for compiler in (c for c in compilers if c in all_compilers): if compiler == "intel": for intel_compiler in filter(lambda cc: cc.startswith("intel"), all_compilers): yield intel_compiler @@ -227,7 +232,7 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r yield compiler def actual_mpis(): - for mpi in mpis: + for mpi in (m for m in mpis if m in all_mpis): if mpi == "impi": for impi in filter(lambda cc: cc.startswith("impi"), mpis): yield impi @@ -238,13 +243,17 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r yield mpi def actual_cudas(): - for cuda in cudas: + for cuda in (c for c in cudas if c in all_cudas): if cuda == "default_cuda": for default_cuda in default_cudas: yield default_cuda else: yield cuda + def actual_pgis(): + for pgi in (p for p in pgis if p in all_pgis): + yield pgi + for flag in enable_repos: if flag == "system": @@ -269,6 +278,14 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r if valid_cuda(cuda, compiler) and valid_mpi(compiler, mpi): enable(cuda + "_" + mpi + "_" + compiler) + if flag == "pgi": + for pgi in actual_pgis(): + enable(pgi) + + if flag == "pgi_mpi": + for mpi, pgi in product(actual_mpis(), actual_pgis()): + enable(mpi + "_" + pgi) + if len(build.getchildren()) > 0: build.getchildren()[-1].tail = "\n " @@ -287,6 +304,7 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p compilers = list(get_attribute_values(api_url, project, None, "MPCDF:compiler_modules")) mpis = list(get_attribute_values(api_url, project, None, "MPCDF:mpi_modules")) cudas = list(get_attribute_values(api_url, project, None, "MPCDF:cuda_modules")) + pgis = list(get_attribute_values(api_url, project, None, "MPCDF:pgi_modules")) if distribution is None: # Get existing value from project meta @@ -388,7 +406,7 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p else: repo("System", ("distributions", distribution)) - for compiler in compilers: + for compiler in compilers + pgis: repo(compiler, (project, "System"), compiler=True) for mpi in filter(partial(valid_mpi, compiler), mpis): diff --git a/mpcdf_enable_repositories.py b/mpcdf_enable_repositories.py index 4fd1f63a30ae09ef959a45a83ce171de6eba6bdf..c7111ba75d382804708e17184ba1dc62a76952bd 100644 --- a/mpcdf_enable_repositories.py +++ b/mpcdf_enable_repositories.py @@ -18,9 +18,11 @@ import osc.cmdln help="Restrict the set of MPI implementations to use") @osc.cmdln.option('--cuda-modules', nargs=1, help="Restrict the set of CUDA implementations to use") +@osc.cmdln.option('--pgi-modules', nargs=1, + help="Restrict the set of PGI compilers to use") @osc.cmdln.option('--set', nargs=1, metavar="FLAGS", help="Modify the set of enabled repositories, without this the current setup is displayed. " - "FLAGS is a comma-separated list of a subset of 'system', 'compilers', 'mpi', 'cuda', 'cuda_mpi'") + "FLAGS is a comma-separated list of a subset of 'system', 'compilers', 'mpi', 'cuda', 'cuda_mpi', 'pgi', 'pgi_mpi'") @osc.cmdln.option('--disable', action="store_true", metavar="FLAGS", help="Disable building this package") @osc.cmdln.alias("mpcdf_enable_repos") @@ -80,9 +82,10 @@ def do_mpcdf_enable_repositories(self, subcmd, opts, *args): print("Removing attribute", attribute_name, "from package") mpcdf_common.remove_attribute(api_url, project, package, attribute_name) + set_or_remove(opts.compiler_modules, "MPCDF:compiler_modules") set_or_remove(opts.mpi_modules, "MPCDF:mpi_modules") set_or_remove(opts.cuda_modules, "MPCDF:cuda_modules") - set_or_remove(opts.compiler_modules, "MPCDF:compiler_modules") + set_or_remove(opts.pgi_modules, "MPCDF:pgi_modules") if opts.recreate or opts.set or opts.disable: mpcdf_common.mpcdf_enable_repositories(api_url, project, package, verbose=True) @@ -110,5 +113,6 @@ def do_mpcdf_enable_repositories(self, subcmd, opts, *args): print_attr("- Subset of compiler modules set to:", "MPCDF:compiler_modules") print_attr("- Subset of MPI modules set to:", "MPCDF:mpi_modules") print_attr("- Subset of CUDA modules set to:", "MPCDF:cuda_modules") + print_attr("- Subset of PGI modules set to:", "MPCDF:pgi_modules") else: print("Disabled")