solver: penalize language virtuals for each use#51314
Conversation
|
I tried to benchmark this one using this configuration: packages.yamlpackages:
gcc:
externals:
- spec: [email protected] languages:='c,c++,fortran'
prefix: /home/culpo/opt/compiler-as-deps/build-tools/.spack-env/view
extra_attributes:
compilers:
c: /home/culpo/opt/compiler-as-deps/build-tools/.spack-env/view/bin/gcc
cxx: /home/culpo/opt/compiler-as-deps/build-tools/.spack-env/view/bin/g++
fortran: /home/culpo/opt/compiler-as-deps/build-tools/.spack-env/view/bin/gfortran
- spec: [email protected] languages:='c,c++,fortran'
prefix: /usr
extra_attributes:
compilers:
c: /usr/bin/gcc-8
cxx: /usr/bin/g++-8
fortran: /usr/bin/gfortran-8
- spec: [email protected] languages:='c,c++,fortran'
prefix: /usr
extra_attributes:
compilers:
c: /usr/bin/gcc
cxx: /usr/bin/g++
fortran: /usr/bin/gfortran
- spec: [email protected] languages:='c,c++,fortran'
prefix: /usr
extra_attributes:
compilers:
c: /usr/bin/gcc-10
cxx: /usr/bin/g++-10
fortran: /usr/bin/gfortran-10
llvm:
externals:
- spec: [email protected]+clang~flang+lld~lldb
prefix: /usr
extra_attributes:
compilers:
c: /usr/bin/clang-12
cxx: /usr/bin/clang++-12
- spec: [email protected]+clang~flang~lld+lldb
prefix: /usr
extra_attributes:
compilers:
c: /usr/bin/clang
cxx: /usr/bin/clang++
- spec: [email protected]+clang~flang~lld~lldb
prefix: /usr
extra_attributes:
compilers:
c: /usr/bin/clang-11
cxx: /usr/bin/clang++-11
c:
prefer:
- llvm
cxx:
prefer:
- llvm
fortran:
prefer:
- gccon this system:
There is one spec, radiuss.develop.csv
|
|
I don't think this is what we want. For a solve with a non-default compiler specified on the root, this will make it even more difficult to get the rest of the stack built with the compiler specified on the root. I think what we need instead is a per-parent penalty on provider duplicates (instead of the current per-duplicate penalty). That will ensure that even when compiler mixing is forced, it won't propagate further up the DAG. |
|
Can you give an example? The issue that was pointed out is exactly |
|
Ping. Can we proceed reviewing this? |
This commit changes how penalties for language virtuals are computed so that a penalty is taken each time a non-preferred compiler is used. Signed-off-by: Massimiliano Culpo <[email protected]>
108869e to
5a33b90
Compare
This commit changes how penalties for language virtuals are computed
so that a penalty is taken each time a non-preferred compiler is used.
Using this environment as an example:
```yaml
spack:
specs:
- "fftw~mpi %c,fortran=llvm"
packages:
c:
prefer: [gcc]
cxx:
prefer: [gcc]
fortran:
prefer: [gcc]
```
**Before the PR**
Every node uses `clang` as a compiler, since the penalty is taken per
provider, and we force `clang` on `fftw`.
**After the PR**
Only `fftw` uses `clang`, since a penalty is taken per provider use,
so switching other nodes to `clang` is suboptimal (since `gcc` is preferred).
Signed-off-by: Massimiliano Culpo <[email protected]>


This commit changes how penalties for language virtuals are computed so that a penalty is taken each time a non-preferred compiler is used.
Using this environment as an example:
Before the PR
Every node uses
clangas a compiler, since the penalty is taken per provider, and we forceclangonfftw.After the PR
Only
fftwusesclang, since a penalty is taken per provider use, so switching other nodes toclangis suboptimal (sincegccis preferred).