Skip to content

Make "minimal" the default duplicate strategy#39621

Merged
alalazo merged 6 commits intospack:developfrom
alalazo:solver/make-minimal-default
Oct 6, 2023
Merged

Make "minimal" the default duplicate strategy#39621
alalazo merged 6 commits intospack:developfrom
alalazo:solver/make-minimal-default

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Aug 25, 2023

fixes #38226

The current strategy is "none", meaning no duplicates. Marking as a draft since we need to decide whether or not to keep the current configuration schema.

We also need to improve speed for the minimal case, when no duplicate is actually required.

Modifications:

Implementing #31511 is probably better deferred to another PR.

@spackbot-app spackbot-app bot added core PR affects Spack core functionality defaults tests General test capability(ies) labels Aug 25, 2023
@alalazo alalazo self-assigned this Aug 25, 2023
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Aug 25, 2023

This is the current situation when trying to compare "no duplicates" with "minimal duplicates" on the current e4s stack:

e4s-develop-serial-minimal.csv
e4s-develop-serial-none.csv
e4s.txt

e4s

Table results
Spec solved Total time [No duplicates, secs.] Total time [Minimal duplicates, secs.] Speedup [%]
adios 12.7089 15.4501 -21.5685
alquimia 26.8684 31.3292 -16.6026
aml 11.3923 14.6622 -28.7027
amrex 27.0635 29.3839 -8.57406
arborx 26.431 31.7375 -20.0768
archer 11.7849 13.9073 -18.0093
argobots 10.2139 11.2944 -10.5792
axom 32.6864 35.2926 -7.97336
bolt 11.4643 13.2177 -15.2943
bricks 12.5608 14.1008 -12.2606
butterflypack 12.8802 16.134 -25.2628
boost+filesystem+iostreams+python+system 10.7081 12.6013 -17.6797
cabana 25.3273 30.956 -22.224
caliper 12.9697 16.2286 -25.1271
chaibenchmarkstests 13.0948 15.4896 -18.2878
charliecloud 3.51066 4.34137 -23.6625
conduit 14.0334 17.023 -21.3035
datatransferkit 25.8875 30.6982 -18.5831
dealii 30.45 35.4702 -16.4864
dyninst 11.8754 13.4526 -13.2811
ecp-data-vis-sdk+adios2+ascent+cinemacuda+darshan+faodel+hdf5+paraview+pnetcdfrocm+sz+unifyfs+veloc~visit+vtkm+zfp ^hdf5@1.14 45.4063 52.1487 -14.8491
exaworks 18.8812 23.4245 -24.0628
flecsi 15.4204 18.4829 -19.8603
flit 3.37885 4.37878 -29.5939
flux-core 12.5831 14.5385 -15.5394
fortrilinos 26.2724 34.0772 -29.7075
gasnet 12.1983 14.1939 -16.3592
ginkgo 17.1015 18.3235 -7.14573
globalarrays 13.1158 16.1317 -22.9938
gmp 3.34051 4.42048 -32.3295
gotcha 3.29413 4.06473 -23.3934
gptune 22.083 26.3298 -19.2309
h5bench 14.0513 15.0751 -7.2861
hdf5-vol-async 14.1776 14.8737 -4.90979
hdf5-vol-cache 14.3428 14.7341 -2.72837
hdf5-vol-log 12.8007 14.0766 -9.96779
heffte+fftw 17.0256 18.7915 -10.3714
hpctoolkit 12.9465 17.036 -31.5882
hpx max_cpu_count=512 networking=mpi 12.8637 15.6339 -21.5354
hypre 28.1892 18.1152 35.7372
kokkos+openmp 12.0507 13.4839 -11.8935
kokkos-kernels+openmp 12.9428 15.4171 -19.1172
lammps 27.7636 29.7609 -7.1938
legion 12.8411 14.7001 -14.4768
libnrm 12.4783 14.9255 -19.6117
libpressio+bitgrooming+bzip2cudacusz+fpzip+hdf5+json+libdistributed+lua+mgard+netcdf+openmp+python+remote+sz+sz3+unix+zfp 24.0884 29.6032 -22.8939
libquo 12.3238 16.6462 -35.0734
libunwind 3.06696 3.51104 -14.4795
mercury 12.7842 14.4332 -12.8992
metall 11.5696 12.6789 -9.58814
mfem 33.2314 39.2941 -18.2438
mgard~cuda+openmp+serial+timing+unstructured 11.8869 13.9127 -17.0419
mpark-variant 3.23746 4.05139 -25.1409
mpifileutils~xattr 12.7559 16.5853 -30.0207
nccmp 13.0293 15.3206 -17.5852
nco 12.844 15.4671 -20.4229
netlib-scalapack 12.4164 14.9131 -20.1081
nrm 15.3773 18.9736 -23.3867
nvhpc 0.138948 0.143855 -3.53163
omega-h 27.1722 31.719 -16.7333
openmpi 11.0709 13.0391 -17.7783
openpmd-api 25.5868 35.5312 -38.8653
papi 11.4104 14.0039 -22.7291
papyrus 12.9123 14.1386 -9.49716
parsec~cuda 15.3163 18.0901 -18.1104
pdt 0.50524 0.142243 71.8465
petsc 24.4114 28.3176 -16.0014
phist 27.6976 27.9079 -0.759255
plasma 12.0188 13.8649 -15.3604
plumed 13.1274 16.2618 -23.8763
precice 26.292 29.7694 -13.2258
pumi 13.0635 14.6872 -12.4295
py-h5py+mpi 13.5358 17.2474 -27.4209
py-h5py~mpi 13.5264 17.1629 -26.8841
py-jupyterhub 15.1053 16.841 -11.4907
py-libensemble+mpi+nlopt 27.8779 32.0699 -15.0368
py-petsc4py 26.8131 30.8168 -14.9321
py-warpx 38.5009 48.5787 -26.1756
qthreads scheduler=distrib 11.4647 13.1765 -14.931
quantum-espresso 14.3047 15.8533 -10.826
raja 12.807 14.3873 -12.339
scr 13.3433 15.5986 -16.9023
slate~cuda 14.1057 16.3655 -16.0202
slepc 26.3603 30.0773 -14.1009
stc 13.5704 15.0004 -10.5383
strumpack~slate 18.0567 18.2594 -1.12278
sundials 27.8931 31.1051 -11.5153
superlu 11.6241 13.8924 -19.5141
superlu-dist 14.0591 15.7662 -12.1424
swig 3.28217 3.60327 -9.78303
sz3 11.4278 13.9654 -22.2049
tasmanian 16.2658 16.6106 -2.11948
tau+mpi+python 24.7177 27.3925 -10.8215
trilinos@13.0.1+belos+ifpack2+stokhos 24.5309 28.1985 -14.9509
turbine 14.3044 15.3003 -6.96252
umap 3.20122 4.04429 -26.336
umpire 12.3664 14.4728 -17.0333
upcxx 13.5926 15.7632 -15.9692
variorum 11.6701 13.1974 -13.0873
veloc 12.8106 16.1898 -26.3782
wannier90 15.1858 14.3462 5.52861
xyce+mpi+pymi+pymi_static_tpls+shared ^trilinos~shylu 26.1492 31.7142 -21.2816
amrex+cuda 25.8768 29.704 -14.79
arborx+cuda ^kokkos+wrapper 24.4758 27.4315 -12.076
bricks+cuda 12.5288 16.1341 -28.7755
cabana+cuda ^kokkos+cuda+cuda_lambda+wrapper 25.1014 28.8164 -14.7998
caliper+cuda 13.374 14.8565 -11.0845
chaibenchmarks+cudatests ^umpire~shared 13.1952 15.2858 -15.8436
cusz+cuda 3.55042 4.43026 -24.7813
dealii+cuda 29.3489 33.3573 -13.6579
ecp-data-vis-sdk+adios2~ascent+cuda+hdf5+paraview+sz+vtkm+zfp ^hdf5@1.14 41.3022 51.275 -24.146
flecsi+cuda 15.2386 17.5736 -15.3228
flux-core+cuda 12.0455 13.9957 -16.1908
ginkgo+cuda 16.0631 17.6726 -10.0198
heffte+cuda 14.8357 17.1852 -15.8365
hpctoolkit+cuda 12.6506 15.8705 -25.4529
hpx+cuda max_cpu_count=512 12.1862 14.1613 -16.2079
hypre+cuda 25.4715 19.0183 25.335
kokkos+cuda+wrapper 11.8032 13.6296 -15.4745
kokkos-kernels+cuda ^kokkos+cuda+cuda_lambda+wrapper 13.06 15.3371 -17.4357
libpressio+bitgrooming+bzip2+cuda+cusz+fpzip+hdf5+json+libdistributed+lua+mgard+netcdf+openmp+python+remote+sz+sz3+unix+zfp ^cusz+cuda 24.7522 28.8971 -16.7455
magma+cuda 13.9421 16.1179 -15.6059
mfem+cuda 29.8957 34.4855 -15.3527
mgard+cuda+openmp+serial+timing+unstructured 12.6327 14.1178 -11.7557
omega-h+cuda 26.9104 34.792 -29.2883
papi+cuda 11.6838 13.777 -17.9156
petsc+cuda 24.8285 28.8724 -16.2873
py-torch+cuda 21.9086 26.5331 -21.108
raja+cuda 12.9005 14.328 -11.0659
slate+cuda 15.1065 17.3382 -14.773
slepc+cuda 26.2619 31.4616 -19.7993
strumpack+cuda~slate 17.8288 20.3543 -14.1651
sundials+cuda 25.7918 29.942 -16.0912
superlu-dist+cuda 14.3263 15.8374 -10.5482
tasmanian+cuda 14.7183 17.454 -18.5871
tau+cuda+mpi 26.4589 28.44 -7.48759
trilinos@13.4.0:+belos+cuda+ifpack2+stokhos 24.16 27.9918 -15.8604
umpire+cuda~shared 12.4251 14.3179 -15.234
amrex+rocm 25.8951 30.0308 -15.9711
arborx+rocm 24.2977 26.6095 -9.51435
cabana+rocm 26.1242 28.6659 -9.72939
caliper+rocm 13.2005 15.6432 -18.505
chai~benchmarks+rocm 13.5027 15.7725 -16.8103
ecp-data-vis-sdk+adios2+hdf5+paraview+pnetcdf+rocm+sz+vtkm+zfp ^hdf5@1.14 40.4664 47.9385 -18.4649
gasnet+rocm 12.3253 15.4526 -25.373
ginkgo+rocm 14.9899 17.2733 -15.2333
heffte+rocm 14.8865 17.1344 -15.1001
hpctoolkit+rocm 13.0545 16.0206 -22.7208
hpx+rocm max_cpu_count=512 12.5244 15.2511 -21.7711
hypre+rocm 15.4456 19.533 -26.4636
kokkos+rocm 12.9151 14.8602 -15.0606
magma~cuda+rocm 14.212 16.1659 -13.7486
mfem+rocm 29.1539 33.3246 -14.3056
papi+rocm 12.2882 14.3788 -17.0136
petsc+rocm 24.2885 27.6294 -13.7552
raja~openmp+rocm 12.777 14.9175 -16.7532
slate+rocm 14.4934 16.9688 -17.0792
slepc+rocm ^petsc+rocm 26.3703 32.8297 -24.4947
strumpack+rocm~slate 16.9219 19.8972 -17.582
sundials+rocm 26.2319 29.1043 -10.9499
superlu-dist+rocm 15.1511 18.0349 -19.0335
tasmanian~openmp+rocm 15.5405 17.1909 -10.6204
tau+mpi+rocm 24.9753 26.5495 -6.30305
trilinos@13.4.0:+belosifpack2+rocmstokhos 25.488 29.1738 -14.461
umpire+rocm 13.7566 14.8416 -7.88674
upcxx+rocm 13.3507 15.7665 -18.0954

Concretization is 10%-30% slower when using that mode of operation. I'll check if I can improve it in some way with heuristics.

@haampie
Copy link
Copy Markdown
Member

haampie commented Aug 28, 2023

Would be good to add py-cython to the list, see #39661

Edit: this was done.

@alalazo alalazo force-pushed the solver/make-minimal-default branch from 00944c2 to 5e2d0e2 Compare September 20, 2023 16:46
@alalazo alalazo marked this pull request as ready for review September 20, 2023 16:48
@haampie
Copy link
Copy Markdown
Member

haampie commented Sep 25, 2023

@alalazo I've reduced it to:

# example-one/package.py
from spack.package import *
class ExampleOne(Package):
    version("1.0")
    depends_on("example-provider", type="build")

# example-two/package.py
from spack.package import *
class ExampleTwo(Package):
    version("1.0")
    provides("example-provider")

Fails to concretize, but it does concretize when:

a) you replace the virtual with the provider: depends_on("example-two", type="build")
b) change the deptype to link/build: depends_on("example-provider", type=("build", "link"))

Finally, this is not caused by 5e2d0e2, but the bug happens on develop too 👍

spack -c concretizer:duplicates:strategy:minimal spec example-one

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Sep 26, 2023

Finally, this is not caused by 5e2d0e2, but the bug happens on develop too 👍

I'll have a look at this today.

@spackbot-app spackbot-app bot added dependencies new-version stand-alone-tests Stand-alone (or smoke) tests for installed packages virtual-dependencies labels Sep 26, 2023
@alalazo alalazo force-pushed the solver/make-minimal-default branch 2 times, most recently from fd7bf11 to 7ec19db Compare September 26, 2023 18:19
@alalazo alalazo force-pushed the solver/make-minimal-default branch 2 times, most recently from 5367ea5 to 0cf2122 Compare September 27, 2023 03:11
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Sep 27, 2023

Tested on:

  • Spack: 0.21.0.dev0 (77f14af)
  • Python: 3.11.4
  • Platform: linux-ubuntu20.04-icelake
  • Concretizer: clingo

radiuss_none.csv
radiuss_pr.csv
radiuss.txt

radiuss

Table results
Spec solved Total time [develop, secs.] Total time [PR, secs.] Speedup [%]
aluminum 13.5241 15.5808 -15.2077
ascent 36.6706 39.7976 -8.52718
axom 35.6014 38.5312 -8.22949
blt 3.21497 3.74308 -16.4266
caliper 13.4151 14.8317 -10.5593
care 13.9029 15.1977 -9.31252
chai 13.5848 15.0183 -10.5523
conduit 14.1069 16.0581 -13.8314
dihydrogen 14.7968 16.9801 -14.755
flux-core 13.1379 14.4732 -10.1639
flux-sched 12.9287 14.3421 -10.9322
flux-security 3.36523 3.87258 -15.0762
glvis 36.3398 38.3541 -5.54303
hiptt 11.9515 12.3883 -3.65527
hydrogen 14.3965 16.0908 -11.7687
hypre 17.4018 19.1065 -9.79612
lbann 36.4273 38.0077 -4.33868
lvarray 19.1897 19.5827 -2.04758
mfem 36.3083 37.783 -4.06185
py-hatchet 16.4154 17.7959 -8.40941
py-maestrowf 3.89829 4.43653 -13.8071
py-merlin 14.1773 15.6714 -10.5382
py-shroud 3.40056 3.89795 -14.6266
raja 13.0722 14.1702 -8.39939
samrai 12.9474 14.5655 -12.4972
scr 13.8035 15.5599 -12.7247
sundials 29.5382 34.3956 -16.4443
umpire 12.7485 15.2766 -19.8304
visit 40.0165 42.8839 -7.16556
xbraid 14.1709 15.0223 -6.00775
zfp 12.2094 13.401 -9.75942

The slow-down when compared to no duplicates is in the range 5-15%

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Sep 27, 2023

@spackbot rebuild everything

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Sep 27, 2023

I've started that pipeline for you!

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Sep 27, 2023

So, after a too long debugging, it seems clingo is behaving as it should in https://gitlab.spack.io/spack/spack/-/pipelines/506271

The fact that a cmake@3.1.0 gets selected is due to:

  1. The environment preferring cmake~ownlibs
  2. The new default allowing more than one cmake
  3. clingo trying to respect cmake~ownlibs for jsoncpp by selecting... the latest version not depending on jsoncpp

I'll be updating the pipelines to use cmake+ownlibs

@alalazo alalazo force-pushed the solver/make-minimal-default branch from 77f14af to c2d9598 Compare September 27, 2023 21:24
@spackbot-app spackbot-app bot added gitlab Issues related to gitlab integration documentation Improvements or additions to documentation labels Sep 27, 2023
@alalazo alalazo requested a review from haampie September 28, 2023 15:32
@tgamblin tgamblin requested a review from haampie October 4, 2023 17:40
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Oct 4, 2023

@spackbot run pipeline

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Oct 4, 2023

I've started that pipeline for you!

@alalazo alalazo force-pushed the solver/make-minimal-default branch from 520452d to 44e8112 Compare October 5, 2023 10:07
* Allow branching out of the "generic build" unification set

For cases like the one in spack#39661
we need to relax rules on unification sets.

The issue is that, right now, nodes in the "generic build" unification
set are unified together with their build dependencies. This was done
out of caution to avoid the risk of circular dependencies, which would
ultimately cause a very slow solve.

For build-tools like Cython, however, the build dependencies is masked
by a long chain of "build, run" dependencies that belong in the
"generic build" unification space.

To allow splitting on cases like this, we relax the rule disallowing
branching out of the "generic build" unification set.

* Fix issue with pure build virtual dependencies

Pure build virtual dependencies were not accounted properly in the
list of possible virtuals. This caused some facts connecting virtuals
to the corresponding providers to not be emitted, and in the end
lead to unsat problems.
@alalazo alalazo force-pushed the solver/make-minimal-default branch from 44e8112 to 911624e Compare October 5, 2023 10:21
@alalazo alalazo force-pushed the solver/make-minimal-default branch from 911624e to 5e1ee12 Compare October 6, 2023 06:44
@alalazo alalazo merged commit e20c05f into spack:develop Oct 6, 2023
@alalazo alalazo deleted the solver/make-minimal-default branch October 6, 2023 08:24
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Nov 2, 2023
* Allow branching out of the "generic build" unification set

For cases like the one in spack#39661
we need to relax rules on unification sets.

The issue is that, right now, nodes in the "generic build" unification
set are unified together with their build dependencies. This was done
out of caution to avoid the risk of circular dependencies, which would
ultimately cause a very slow solve.

For build-tools like Cython, however, the build dependencies is masked
by a long chain of "build, run" dependencies that belong in the
"generic build" unification space.

To allow splitting on cases like this, we relax the rule disallowing
branching out of the "generic build" unification set.

* Fix issue with pure build virtual dependencies

Pure build virtual dependencies were not accounted properly in the
list of possible virtuals. This caused some facts connecting virtuals
to the corresponding providers to not be emitted, and in the end
lead to unsat problems.

* Fixed a few issues in packages

py-gevent: restore dependency on py-cython@3
jsoncpp: fix typo in build dependency
ecp-data-vis-sdk: update spack.yaml and cmake recipe
py-statsmodels: add v0.13.5

* Make dependency on "blt" of type "build"
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Jan 11, 2024
* Allow branching out of the "generic build" unification set

For cases like the one in spack#39661
we need to relax rules on unification sets.

The issue is that, right now, nodes in the "generic build" unification
set are unified together with their build dependencies. This was done
out of caution to avoid the risk of circular dependencies, which would
ultimately cause a very slow solve.

For build-tools like Cython, however, the build dependencies is masked
by a long chain of "build, run" dependencies that belong in the
"generic build" unification space.

To allow splitting on cases like this, we relax the rule disallowing
branching out of the "generic build" unification set.

* Fix issue with pure build virtual dependencies

Pure build virtual dependencies were not accounted properly in the
list of possible virtuals. This caused some facts connecting virtuals
to the corresponding providers to not be emitted, and in the end
lead to unsat problems.

* Fixed a few issues in packages

py-gevent: restore dependency on py-cython@3
jsoncpp: fix typo in build dependency
ecp-data-vis-sdk: update spack.yaml and cmake recipe
py-statsmodels: add v0.13.5

* Make dependency on "blt" of type "build"
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Jan 31, 2024
* Allow branching out of the "generic build" unification set

For cases like the one in spack#39661
we need to relax rules on unification sets.

The issue is that, right now, nodes in the "generic build" unification
set are unified together with their build dependencies. This was done
out of caution to avoid the risk of circular dependencies, which would
ultimately cause a very slow solve.

For build-tools like Cython, however, the build dependencies is masked
by a long chain of "build, run" dependencies that belong in the
"generic build" unification space.

To allow splitting on cases like this, we relax the rule disallowing
branching out of the "generic build" unification set.

* Fix issue with pure build virtual dependencies

Pure build virtual dependencies were not accounted properly in the
list of possible virtuals. This caused some facts connecting virtuals
to the corresponding providers to not be emitted, and in the end
lead to unsat problems.

* Fixed a few issues in packages

py-gevent: restore dependency on py-cython@3
jsoncpp: fix typo in build dependency
ecp-data-vis-sdk: update spack.yaml and cmake recipe
py-statsmodels: add v0.13.5

* Make dependency on "blt" of type "build"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core PR affects Spack core functionality defaults dependencies documentation Improvements or additions to documentation gitlab Issues related to gitlab integration new-version python stand-alone-tests Stand-alone (or smoke) tests for installed packages tests General test capability(ies) update-package utilities virtual-dependencies

Projects

Development

Successfully merging this pull request may close these issues.

Allow multiple versions of the same build dependency in a DAG

2 participants