diff --git a/stackinator/etc/Make.inc b/stackinator/etc/Make.inc index fc92dcac..cf05543d 100644 --- a/stackinator/etc/Make.inc +++ b/stackinator/etc/Make.inc @@ -29,4 +29,4 @@ store: touch $@ # Because Spack doesn't know how to find compilers, we help it by getting the bin folder of gcc, clang, nvc given a install prefix -compiler_bin_dirs = $$(find $(1) '(' -name gcc -o -name clang -o -name nvc ')' -path '*/bin/*' '(' -type f -o -type l ')' -exec dirname {} +) +compiler_bin_dirs = $$(find $(1) '(' -name gcc -o -name clang -o -name nvc -o -name icx ')' -path '*/bin/*' '(' -type f -o -type l ')' -exec dirname {} +) diff --git a/stackinator/recipe.py b/stackinator/recipe.py index 7850d036..30bf8b58 100644 --- a/stackinator/recipe.py +++ b/stackinator/recipe.py @@ -391,6 +391,10 @@ def generate_environment_specs(self, raw): # Which will compile the upstream MPI with nvfortran, as well as downstream dependendencies. if config["prefer"] is None: compiler = config["compiler"][0] + # spack uses a different name for the intel oneapi compilers + # than the package that installs them. + if compiler == "intel-oneapi-compilers": + compiler = "oneapi" config["prefer"] = [ f"%[when=%c] c={compiler} %[when=%cxx] cxx={compiler} %[when=%fortran] fortran={compiler}" ] @@ -477,6 +481,15 @@ def generate_compiler_specs(self, raw): llvm_amdgpu["exclude_from_cache"] = cache_exclude compilers["llvm-amdgpu"] = llvm_amdgpu + if raw["intel-oneapi-compilers"] is not None: + oneapi = {} + oneapi_version = raw["intel-oneapi-compilers"]["version"] + oneapi["packages"] = False + oneapi["specs"] = [f"intel-oneapi-compilers@{oneapi_version}"] + + oneapi["exclude_from_cache"] = cache_exclude + compilers["intel-oneapi-compilers"] = oneapi + self.compilers = compilers # The path of the default configuration for the target system/cluster diff --git a/stackinator/schema/compilers.json b/stackinator/schema/compilers.json index 19ab0123..810ad0b7 100644 --- a/stackinator/schema/compilers.json +++ b/stackinator/schema/compilers.json @@ -60,6 +60,22 @@ } ], "default": null + }, + "intel-oneapi-compilers": { + "oneOf": [ + { + "type": "object", + "properties": { + "version": {"type": "string"} + }, + "additionalProperties": false, + "required": ["version"] + }, + { + "type": "null" + } + ], + "default": null } } } diff --git a/stackinator/schema/environments.json b/stackinator/schema/environments.json index 99fb0076..c8ee0df9 100644 --- a/stackinator/schema/environments.json +++ b/stackinator/schema/environments.json @@ -63,7 +63,7 @@ "type": "array", "items": { "type": "string", - "enum": ["gcc", "nvhpc", "llvm", "llvm-amdgpu"] + "enum": ["gcc", "nvhpc", "llvm", "llvm-amdgpu", "intel-oneapi-compilers"] } }, "specs": { diff --git a/stackinator/templates/Makefile.compilers b/stackinator/templates/Makefile.compilers index f9520bd6..8418fbf0 100644 --- a/stackinator/templates/Makefile.compilers +++ b/stackinator/templates/Makefile.compilers @@ -51,12 +51,18 @@ llvm-amdgpu/packages.yaml: gcc/generated/env $(SPACK) compiler find --scope=user $(call compiler_bin_dirs, $$($(SPACK_HELPER) -e ./gcc find --explicit --format '{prefix}' {{ compilers.get('llvm-amdgpu').requires }})) {% endif %} +{% if compilers.get('intel-oneapi-compilers') %} +intel-oneapi-compilers/packages.yaml: gcc/generated/env + $(SPACK) compiler find --scope=user $(call compiler_bin_dirs, $$($(SPACK_HELPER) -e ./gcc find --explicit --format '{prefix}' {{ compilers.get('intel-oneapi-compilers').requires }})) +{% endif %} + {% if compilers.nvhpc %} nvhpc/packages.yaml: gcc/generated/env $(SPACK) compiler find --scope=user $(call compiler_bin_dirs, $$($(SPACK_HELPER) -e ./gcc find --explicit --format '{prefix}' {{ compilers.nvhpc.requires }})) {% endif %} + include ../Make.inc # GNU Make isn't very smart about dependencies across included Makefiles, so we @@ -77,6 +83,12 @@ include llvm-amdgpu/Makefile endif {% endif %} +{% if compilers.get('intel-oneapi-compilers') %} +ifneq (,$(wildcard gcc/Makefile)) +include intel-oneapi-compilers/Makefile +endif +{% endif %} + {% if compilers.nvhpc %} ifneq (,$(wildcard gcc/Makefile)) include nvhpc/Makefile diff --git a/stackinator/templates/Makefile.generate-config b/stackinator/templates/Makefile.generate-config index 1ab96844..a53a1c8c 100644 --- a/stackinator/templates/Makefile.generate-config +++ b/stackinator/templates/Makefile.generate-config @@ -4,10 +4,10 @@ CONFIG_DIR = $(STORE)/config MODULE_DIR = $(BUILD_ROOT)/modules # These will be the prefixes of the GCCs, LLVMs and NVHPCs in the respective environments. -ALL_COMPILER_PREFIXES ={% for compiler in all_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc){% endfor %} +ALL_COMPILER_PREFIXES ={% for compiler in all_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc intel-oneapi){% endfor %} -COMPILER_PREFIXES ={% for compiler in release_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc){% endfor %} +COMPILER_PREFIXES ={% for compiler in release_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc intel-oneapi){% endfor %} all: $(CONFIG_DIR)/upstreams.yaml $(CONFIG_DIR)/packages.yaml $(CONFIG_DIR)/repos.yaml{% if modules %} $(MODULE_DIR)/upstreams.yaml $(MODULE_DIR)/compilers.yaml{% endif %} diff --git a/stackinator/templates/compilers.intel-oneapi-compilers.spack.yaml b/stackinator/templates/compilers.intel-oneapi-compilers.spack.yaml new file mode 100644 index 00000000..e567b226 --- /dev/null +++ b/stackinator/templates/compilers.intel-oneapi-compilers.spack.yaml @@ -0,0 +1,13 @@ +spack: + include: + - packages.yaml + - config.yaml + specs: +{% for spec in config.specs %} + - {{ spec }} +{% endfor %} + view: false + concretizer: + unify: when_possible + reuse: false +