@@ -444,17 +444,20 @@ Variant preferences
444444
445445As we've seen throughout this tutorial, HDF5 builds with MPI enabled by default in Spack.
446446If we were working on a project that would routinely need serial HDF5, that might get annoying quickly, having to type ``hdf5~mpi `` all the time.
447- Instead, we'll update our preferences for HDF5.
447+ Instead, we'll update our config to force disable it:
448448
449449.. code-block :: yaml
450- :emphasize-lines : 9-10
450+ :emphasize-lines : 12-13
451451
452452 spack :
453453 specs : []
454454 view : true
455+ concretizer :
456+ unify : true
455457 packages :
456458 all :
457- compiler : [clang, gcc, intel, pgi, xl, nag, fj]
459+ require :
460+ - one_of : ["%llvm", "%gcc"]
458461 providers :
459462 mpi : [mpich, openmpi]
460463 hdf5 :
@@ -465,7 +468,7 @@ Now hdf5 will concretize without an MPI dependency by default.
465468
466469.. literalinclude :: outputs/config/3.prefs.out
467470 :language: console
468- :emphasize-lines: 8
471+ :emphasize-lines: 2
469472
470473
471474In general, every attribute that we can set for all packages we can set separately for an individual package.
@@ -482,14 +485,17 @@ On these systems, we have a pre-installed curl.
482485Let's tell Spack about this package and where it can be found:
483486
484487.. code-block :: yaml
485- :emphasize-lines : 11-14
488+ :emphasize-lines : 14-17
486489
487490 spack :
488491 specs : []
489492 view : true
493+ concretizer :
494+ unify : true
490495 packages :
491496 all :
492- compiler : [clang, gcc, intel, pgi, xl, nag, fj]
497+ require :
498+ - one_of : ["%llvm", "%gcc"]
493499 providers :
494500 mpi : [mpich, openmpi]
495501 hdf5 :
@@ -498,49 +504,15 @@ Let's tell Spack about this package and where it can be found:
498504 externals :
499505 - spec : curl@7.81.0 %gcc@11.4.0
500506 prefix : /usr
507+ buildable : false
501508
502509
503510 Here, we've told Spack that Curl 7.81.0 is installed on our system.
504511We've also told it the installation prefix where Curl can be found.
505512We don't know exactly which variants it was built with, but that's okay.
506-
507- .. literalinclude :: outputs/config/0.externals.out
508- :language: console
509-
510-
511- You'll notice that Spack is now using the external Curl installation, but the compiler used to build Curl is now overriding our compiler preference of clang.
512- If we explicitly specify Clang:
513-
514- .. literalinclude :: outputs/config/1.externals.out
515- :language: console
516-
517- Spack concretizes to both HDF5 and Curl being built with Clang.
518- This has a side-effect of rebuilding Curl.
519- If we want to force Spack to use the system Curl, we have two choices.
520- We can either specify it on the command line, or we can tell Spack that it's not allowed to build its own Curl.
521- We'll go with the latter.
522-
523- .. code-block :: yaml
524- :emphasize-lines : 15
525-
526- spack :
527- specs : []
528- view : true
529- packages :
530- all :
531- compiler : [clang, gcc, intel, pgi, xl, nag, fj]
532- providers :
533- mpi : [mpich, openmpi]
534- hdf5 :
535- require : ~mpi
536- curl :
537- externals :
538- - spec : curl@5.34.0 %gcc@11.4.0
539- prefix : /usr
540- buildable : false
541-
542-
543- Now Spack will be forced to choose the external Curl.
513+ Finally, we set `buildable: false ` to require that Spack not try to
514+ build its own.
515+ .. The weighting/preferences dont work quite the same so I skipped right to buildable:false
544516
545517 .. literalinclude :: outputs/config/2.externals.out
546518 :language: console
@@ -560,14 +532,17 @@ To express that we don't want any other MPI installed, we can use the virtual ``
560532While we're editing the ``spack.yaml `` file, make sure to configure HDF5 to be able to build with MPI again:
561533
562534.. code-block :: yaml
563- :emphasize-lines : 14-19
535+ :emphasize-lines : 19-24
564536
565537 spack :
566538 specs : []
567539 view : true
540+ concretizer :
541+ unify : true
568542 packages :
569543 all :
570- compiler : [clang, gcc, intel, pgi, xl, nag, fj]
544+ require :
545+ - one_of : ["%llvm", "%gcc"]
571546 providers :
572547 mpi : [mpich, openmpi]
573548 curl :
@@ -582,27 +557,25 @@ While we're editing the ``spack.yaml`` file, make sure to configure HDF5 to be a
582557 mpi :
583558 buildable : false
584559
585- Now that we have configured Spack not to build any possible provider for MPI, we can try again.
560+ .. 3.externals.out has mpich
561+ .. The concretization result is strange and enables some qt stuff that makes it huge
586562
587- .. literalinclude :: outputs/config/3.externals.out
588- :language: console
589- :emphasize-lines: 15
590-
591- Notice that we still haven't build ``hdf5 `` with our external ``mpich ``.
563+ If you run this as-is, you'll notice Spack still hasn't built ``hdf5 `` with our external ``mpich ``.
592564The concretizer has instead turned off ``mpi `` support in ``hdf5 ``.
593565To debug this, we will force Spack to use ``hdf5+mpi ``.
594566
595567.. code-block :: console
596568
597- $ spack spec hdf5%clang+mpi
598- ==> Error: concretization failed for the following reasons:
599-
600- 1. hdf5: '+mpi' conflicts with '^mpich@4.0:4.0.3'
601- 2. hdf5: '+mpi' conflicts with '^mpich@4.0:4.0.3'
602- required because conflict applies to spec ^mpich@4.0:4.0.3
603- required because hdf5%clang+mpi requested from CLI
569+ $ spack spec hdf5+mpi
570+ ==> Error: failed to concretize `hdf5+mpi` for the following reasons:
571+ 1. cannot satisfy a requirement for package 'mpich'.
572+ 2. hdf5: '+mpi' conflicts with '^mpich@4.0:4.0.3'
573+ 3. hdf5: '+mpi' conflicts with '^mpich@4.0:4.0.3'
604574 required because conflict is triggered when +mpi
605- required because hdf5%clang+mpi requested from CLI
575+ required because hdf5+mpi requested explicitly
576+ required because conflict constraint ^mpich@4.0:4.0.3
577+ required because mpich available as external when satisfying mpich@=4.0+hydra device=ch4 netmod=ofi
578+ required because hdf5+mpi requested explicitly
606579
607580 In this case, we cannot use the external mpich.
608581The version is incompatible with ``hdf5 ``.
0 commit comments