Skip to content

Commit 5a6d5f1

Browse files
authored
Feature/intel compiler (eth-cscs#289)
add support for intel-oneapi-compilers.
1 parent 2b0b8a0 commit 5a6d5f1

7 files changed

Lines changed: 58 additions & 4 deletions

File tree

stackinator/etc/Make.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ store:
2929
touch $@
3030

3131
# 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
32-
compiler_bin_dirs = $$(find $(1) '(' -name gcc -o -name clang -o -name nvc ')' -path '*/bin/*' '(' -type f -o -type l ')' -exec dirname {} +)
32+
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 {} +)

stackinator/recipe.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ def generate_environment_specs(self, raw):
391391
# Which will compile the upstream MPI with nvfortran, as well as downstream dependendencies.
392392
if config["prefer"] is None:
393393
compiler = config["compiler"][0]
394+
# spack uses a different name for the intel oneapi compilers
395+
# than the package that installs them.
396+
if compiler == "intel-oneapi-compilers":
397+
compiler = "oneapi"
394398
config["prefer"] = [
395399
f"%[when=%c] c={compiler} %[when=%cxx] cxx={compiler} %[when=%fortran] fortran={compiler}"
396400
]
@@ -477,6 +481,15 @@ def generate_compiler_specs(self, raw):
477481
llvm_amdgpu["exclude_from_cache"] = cache_exclude
478482
compilers["llvm-amdgpu"] = llvm_amdgpu
479483

484+
if raw["intel-oneapi-compilers"] is not None:
485+
oneapi = {}
486+
oneapi_version = raw["intel-oneapi-compilers"]["version"]
487+
oneapi["packages"] = False
488+
oneapi["specs"] = [f"intel-oneapi-compilers@{oneapi_version}"]
489+
490+
oneapi["exclude_from_cache"] = cache_exclude
491+
compilers["intel-oneapi-compilers"] = oneapi
492+
480493
self.compilers = compilers
481494

482495
# The path of the default configuration for the target system/cluster

stackinator/schema/compilers.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@
6060
}
6161
],
6262
"default": null
63+
},
64+
"intel-oneapi-compilers": {
65+
"oneOf": [
66+
{
67+
"type": "object",
68+
"properties": {
69+
"version": {"type": "string"}
70+
},
71+
"additionalProperties": false,
72+
"required": ["version"]
73+
},
74+
{
75+
"type": "null"
76+
}
77+
],
78+
"default": null
6379
}
6480
}
6581
}

stackinator/schema/environments.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"type": "array",
6464
"items": {
6565
"type": "string",
66-
"enum": ["gcc", "nvhpc", "llvm", "llvm-amdgpu"]
66+
"enum": ["gcc", "nvhpc", "llvm", "llvm-amdgpu", "intel-oneapi-compilers"]
6767
}
6868
},
6969
"specs": {

stackinator/templates/Makefile.compilers

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,18 @@ llvm-amdgpu/packages.yaml: gcc/generated/env
5151
$(SPACK) compiler find --scope=user $(call compiler_bin_dirs, $$($(SPACK_HELPER) -e ./gcc find --explicit --format '{prefix}' {{ compilers.get('llvm-amdgpu').requires }}))
5252
{% endif %}
5353

54+
{% if compilers.get('intel-oneapi-compilers') %}
55+
intel-oneapi-compilers/packages.yaml: gcc/generated/env
56+
$(SPACK) compiler find --scope=user $(call compiler_bin_dirs, $$($(SPACK_HELPER) -e ./gcc find --explicit --format '{prefix}' {{ compilers.get('intel-oneapi-compilers').requires }}))
57+
{% endif %}
58+
5459
{% if compilers.nvhpc %}
5560
nvhpc/packages.yaml: gcc/generated/env
5661
$(SPACK) compiler find --scope=user $(call compiler_bin_dirs, $$($(SPACK_HELPER) -e ./gcc find --explicit --format '{prefix}' {{ compilers.nvhpc.requires }}))
5762
{% endif %}
5863

5964

65+
6066
include ../Make.inc
6167

6268
# GNU Make isn't very smart about dependencies across included Makefiles, so we
@@ -77,6 +83,12 @@ include llvm-amdgpu/Makefile
7783
endif
7884
{% endif %}
7985

86+
{% if compilers.get('intel-oneapi-compilers') %}
87+
ifneq (,$(wildcard gcc/Makefile))
88+
include intel-oneapi-compilers/Makefile
89+
endif
90+
{% endif %}
91+
8092
{% if compilers.nvhpc %}
8193
ifneq (,$(wildcard gcc/Makefile))
8294
include nvhpc/Makefile

stackinator/templates/Makefile.generate-config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ CONFIG_DIR = $(STORE)/config
44
MODULE_DIR = $(BUILD_ROOT)/modules
55

66
# These will be the prefixes of the GCCs, LLVMs and NVHPCs in the respective environments.
7-
ALL_COMPILER_PREFIXES ={% for compiler in all_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc){% endfor %}
7+
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 %}
88

99

10-
COMPILER_PREFIXES ={% for compiler in release_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc){% endfor %}
10+
COMPILER_PREFIXES ={% for compiler in release_compilers %} $$($(SPACK_HELPER) -e ../compilers/{{ compiler }} find --explicit --format='{prefix}' gcc llvm llvm-amdgpu nvhpc intel-oneapi){% endfor %}
1111

1212

1313
all: $(CONFIG_DIR)/upstreams.yaml $(CONFIG_DIR)/packages.yaml $(CONFIG_DIR)/repos.yaml{% if modules %} $(MODULE_DIR)/upstreams.yaml $(MODULE_DIR)/compilers.yaml{% endif %}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
spack:
2+
include:
3+
- packages.yaml
4+
- config.yaml
5+
specs:
6+
{% for spec in config.specs %}
7+
- {{ spec }}
8+
{% endfor %}
9+
view: false
10+
concretizer:
11+
unify: when_possible
12+
reuse: false
13+

0 commit comments

Comments
 (0)