Skip to content

Commit 661f908

Browse files
committed
Add a fortran-rt virtual for all Fortran runtimes
1 parent 694848a commit 661f908

File tree

7 files changed

+26
-17
lines changed

7 files changed

+26
-17
lines changed

etc/spack/defaults/packages.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ packages:
2424
elf: [elfutils]
2525
fftw-api: [fftw, amdfftw]
2626
flame: [libflame, amdlibflame]
27+
fortran-rt: [gcc-runtime, intel-oneapi-runtime]
2728
fuse: [libfuse]
2829
gfortran: [gcc-runtime]
2930
gl: [glx, osmesa]

lib/spack/spack/solver/asp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,8 +2645,12 @@ def setup(
26452645
node_counter = _create_counter(specs, tests=self.tests)
26462646
self.possible_virtuals = node_counter.possible_virtuals()
26472647
self.pkgs = node_counter.possible_dependencies()
2648+
2649+
# TODO: unify this under an abstract operation
26482650
self.possible_virtuals.add("gfortran")
26492651
self.possible_virtuals.add("ifcore")
2652+
self.possible_virtuals.add("fortran-rt")
2653+
26502654
runtimes = spack.repo.PATH.packages_with_tags("runtime")
26512655
self.pkgs.update(set(runtimes))
26522656

lib/spack/spack/solver/display.lp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@
5252
% debug
5353
possible_in_link_run("gfortran").
5454
possible_in_link_run("ifcore").
55+
possible_in_link_run("fortran-rt").

var/spack/repos/builtin/packages/gcc-runtime/package.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class GccRuntime(Package):
4848
]
4949

5050
# libgfortran ABI
51+
provides("fortran-rt", "gfortran")
5152
provides("gfortran@3", when="%gcc@:6")
5253
provides("gfortran@4", when="%gcc@7")
5354
provides("gfortran@5", when="%gcc@8:")

var/spack/repos/builtin/packages/gcc/package.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,13 +1147,14 @@ def runtime_constraints(cls, *, compiler, pkg):
11471147
elif compiler.spec.satisfies("gcc@7"):
11481148
gfortran_str = "gfortran@4"
11491149

1150-
pkg("*").depends_on(
1151-
f"{gfortran_str}",
1152-
when=f"%{str(compiler.spec)}",
1153-
languages=["fortran"],
1154-
type="link",
1155-
description=f"Add a dependency on '{gfortran_str}' for nodes compiled with "
1156-
f"{str(compiler.spec)} and using the 'fortran' language",
1157-
)
1150+
for fortran_virtual in ("fortran-rt", gfortran_str):
1151+
pkg("*").depends_on(
1152+
fortran_virtual,
1153+
when=f"%{str(compiler.spec)}",
1154+
languages=["fortran"],
1155+
type="link",
1156+
description=f"Add a dependency on '{gfortran_str}' for nodes compiled with "
1157+
f"{str(compiler.spec)} and using the 'fortran' language",
1158+
)
11581159
# The version of gcc-runtime is the same as the %gcc used to "compile" it
11591160
pkg("gcc-runtime").requires(f"@={str(compiler.version)}", when=f"%{str(compiler.spec)}")

var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,15 @@ def runtime_constraints(cls, *, compiler, pkg):
394394
f"it depends on intel-oneapi-runtime@{str(compiler.version)}:",
395395
)
396396

397-
pkg("*").depends_on(
398-
"ifcore@5",
399-
when=f"%{str(compiler.spec)}",
400-
languages=["fortran"],
401-
type="link",
402-
description=f"Add a dependency on 'ifcore' for nodes compiled with "
403-
f"{str(compiler.spec)} and using the 'fortran' language",
404-
)
397+
for fortran_virtual in ("fortran-rt", "ifcore@5"):
398+
pkg("*").depends_on(
399+
fortran_virtual,
400+
when=f"%{str(compiler.spec)}",
401+
languages=["fortran"],
402+
type="link",
403+
description=f"Add a dependency on 'ifcore' for nodes compiled with "
404+
f"{str(compiler.spec)} and using the 'fortran' language",
405+
)
405406
# The version of gcc-runtime is the same as the %gcc used to "compile" it
406407
pkg("intel-oneapi-runtime").requires(
407408
f"@={str(compiler.version)}", when=f"%{str(compiler.spec)}"

var/spack/repos/builtin/packages/intel-oneapi-runtime/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class IntelOneapiRuntime(Package):
3434
]
3535

3636
# libifcore ABI
37-
provides("ifcore@5", when="%oneapi@2021:")
37+
provides("fortran-rt", "ifcore@5", when="%oneapi@2021:")
3838

3939
def install(self, spec, prefix):
4040
if spec.platform in ["linux", "cray", "freebsd"]:

0 commit comments

Comments
 (0)