Skip to content

Commit c4f7fc3

Browse files
Make TPL-to-TPL dependencies optional (TriBITSPub#557)
Disabling the upstream TPL HDF5 was disabling the TPL Netcdf and that broke several customer's Trilinos configure scripts. The issue is, that we can't treat TPL-to-TPL dependencies as required for cases like this. I also updated some documentation to make this more clear. In the future, we may need to expand TPL intra-dependencies to support optional and required dependencies because there are cases where you would like the behavior of required dependencies for some TPL relationships.
1 parent 3879de0 commit c4f7fc3

File tree

6 files changed

+71
-30
lines changed

6 files changed

+71
-30
lines changed

test/core/DependencyUnitTests/CMakeLists.txt

+31-8
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ create_reduced_dependency_handling_test_case(
568568
-DTrilinos_DUMP_PACKAGE_DEPENDENCIES:BOOL=ON
569569
-DTrilinos_DUMP_FORWARD_PACKAGE_DEPENDENCIES:BOOL=ON
570570
PASS_REGULAR_EXPRESSION_ALL
571-
"-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK.R."
572-
"-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS.R."
571+
"-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK.O."
572+
"-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS.O."
573573
"Explicitly enabled external packages/TPLs on input [(]by user[)]: 0"
574574
"Explicitly disabled external packages/TPLs on input [(]by user or by default[)]: 0"
575575
"-- Setting TPL_ENABLE_LAPACK=ON because DependsOnLAPACK has a required dependence on LAPACK"
@@ -599,11 +599,38 @@ create_reduced_dependency_handling_test_case(
599599
"Final set of enabled external packages/TPLs: BLAS LAPACK 2"
600600
"Processing enabled external package/TPL: BLAS [(]enabled explicitly, disable with -DTPL_ENABLE_BLAS=OFF[)]"
601601
"Processing enabled external package/TPL: LAPACK [(]enabled by DependsOnLAPACK, disable with -DTPL_ENABLE_LAPACK=OFF[)]"
602-
"-- LAPACK_LIB_ENABLED_DEPENDENCIES: BLAS.R."
602+
"-- LAPACK_LIB_ENABLED_DEPENDENCIES: BLAS.O."
603603
"-- DependsOnLAPACK_LIB_ENABLED_DEPENDENCIES: LAPACK.R."
604604
)
605605

606606

607+
create_reduced_dependency_handling_test_case(
608+
IndirectTplDependency_ExplicitDisableBLAS
609+
ARGS
610+
-DTrilinos_EXTRA_REPOSITORIES=extraRepos/DependsOnLAPACK
611+
-DTPL_ENABLE_BLAS=OFF
612+
-DTrilinos_ENABLE_DependsOnLAPACK=ON
613+
-DTrilinos_DUMP_PACKAGE_DEPENDENCIES:BOOL=ON
614+
-DTrilinos_DUMP_FORWARD_PACKAGE_DEPENDENCIES:BOOL=ON
615+
PASS_REGULAR_EXPRESSION_ALL
616+
"-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK.O."
617+
"-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS.O."
618+
"Explicitly enabled external packages/TPLs on input [(]by user[)]: 0"
619+
"Explicitly disabled external packages/TPLs on input [(]by user or by default[)]: BLAS 1"
620+
"-- Setting TPL_ENABLE_LAPACK=ON because DependsOnLAPACK has a required dependence on LAPACK"
621+
"-- Setting DependsOnLAPACK_ENABLE_LAPACK=ON since Trilinos_ENABLE_DependsOnLAPACK=ON AND TPL_ENABLE_LAPACK=ON"
622+
"Final set of enabled packages: DependsOnLAPACK 1"
623+
"Final set of enabled external packages/TPLs: LAPACK 1"
624+
"Final set of non-enabled external packages/TPLs: .* BLAS .*"
625+
"-- LAPACK: No enabled dependencies"
626+
"-- DependsOnLAPACK_LIB_ENABLED_DEPENDENCIES: LAPACK.R."
627+
)
628+
# NOTE: The above test ensures that the explicit disable of an upstream TPL
629+
# does not implicitly disable a downstream TPL (see TriBITSPub/TriBITS#557).
630+
# This was breaking use cases where people were enabling Netcdf but disabling
631+
# HDF5 (and that is a valid configuration when Netcdf is built without HDF5).
632+
633+
607634
#####################################################################
608635
#
609636
# Unit tests for dependency handling for full set of packages
@@ -827,16 +854,14 @@ create_dependency_handling_test_case(
827854
"Explicitly enabled top-level packages on input .by user.: Zoltan 1"
828855
"Explicitly disabled top-level packages on input .by user or by default.: Stokhos 1"
829856
"Explicitly disabled external packages/TPLs on input .by user or by default.: MPI BLAS 2"
830-
"-- Setting TPL_ENABLE_LAPACK=OFF because LAPACK has a required library dependence on disabled package BLAS"
831-
"-- Setting TPL_ENABLE_SuperLUDist=OFF because SuperLUDist has a required library dependence on disabled package BLAS"
832-
"-- Setting TPL_ENABLE_SuperLU=OFF because SuperLU has a required library dependence on disabled package BLAS"
833857
"-- Setting Trilinos_ENABLE_Teuchos=OFF because Teuchos has a required library dependence on disabled package BLAS"
834858
"-- Setting Trilinos_ENABLE_Epetra=OFF because Epetra has a required library dependence on disabled package BLAS"
835859
"-- Setting Trilinos_ENABLE_TrilinosFramework=ON"
836860
"Final set of enabled top-level packages: TrilinosFramework Zoltan Shards 3"
837861
"Final set of enabled packages: TrilinosFramework Zoltan Shards 3"
838862
"Final set of non-enabled top-level packages: Teuchos RTOp Epetra Triutils Tpetra EpetraExt Stokhos Sacado Thyra Isorropia AztecOO Galeri Amesos Intrepid Ifpack ML Belos Stratimikos RBGen Phalanx Panzer 21"
839863
"Final set of non-enabled packages: Teuchos RTOp Epetra Triutils Tpetra EpetraExt Stokhos Sacado ThyraCoreLibs ThyraGoodStuff ThyraCrazyStuff ThyraEpetra ThyraEpetraExt ThyraTpetra Thyra Isorropia AztecOO Galeri Amesos Intrepid Ifpack ML Belos Stratimikos RBGen Phalanx Panzer 27"
864+
"Final set of enabled external packages/TPLs: 0"
840865
)
841866
# Above test makes sure that TRUE/FALSE also processed correctly for enable
842867
# vars.
@@ -1127,8 +1152,6 @@ create_dependency_handling_test_case(
11271152
EnableZoltan_ZoltanEnableParMETIS_TplDisableParMETIS
11281153
ARGS -DTrilinos_ENABLE_Zoltan=ON -DZoltan_ENABLE_ParMETIS=ON -DTPL_ENABLE_ParMETIS=OFF
11291154
PASS_REGULAR_EXPRESSION_ALL
1130-
"-- Setting TPL_ENABLE_SuperLUDist=OFF because SuperLUDist has a required library dependence on disabled package ParMETIS"
1131-
"-- Setting TPL_ENABLE_SuperLU=OFF because SuperLU has a required library dependence on disabled package ParMETIS"
11321155
"-- NOTE: Setting Zoltan_ENABLE_ParMETIS=OFF which was ON because Zoltan has an optional library dependence on disabled package ParMETIS"
11331156
"Final set of enabled external packages/TPLs: 0"
11341157
)

test/core/DependencyUnitTests/DepTests_EnableAllPackages_DumpDependencies.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ Package dependencies information:
1818
-- MPI_FORWARD_LIB_DEFINED_DEPENDENCIES: Teuchos[O] Epetra[O] Zoltan[O] ML[O] Panzer[R]
1919
-- MPI_FORWARD_TEST_DEFINED_DEPENDENCIES: TrilinosFramework[O]
2020

21-
-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK[R] SuperLUDist[R] SuperLU[R] Teuchos[R] Epetra[R] ML[R]
21+
-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK[O] SuperLUDist[O] SuperLU[O] Teuchos[R] Epetra[R] ML[R]
2222

23-
-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS[R]
23+
-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS[O]
2424
-- LAPACK_FORWARD_LIB_DEFINED_DEPENDENCIES: Teuchos[R] Epetra[R] ML[R]
2525

2626
-- Boost_FORWARD_LIB_DEFINED_DEPENDENCIES: Teuchos[O] Phalanx[R] Panzer[R]
2727

2828
-- Scotch_FORWARD_LIB_DEFINED_DEPENDENCIES: Zoltan[O]
2929

30-
-- METIS_FORWARD_LIB_DEFINED_DEPENDENCIES: ParMETIS[R] ML[O]
30+
-- METIS_FORWARD_LIB_DEFINED_DEPENDENCIES: ParMETIS[O] ML[O]
3131
-- METIS_FORWARD_TEST_DEFINED_DEPENDENCIES: ML[O]
3232

33-
-- ParMETIS_LIB_DEFINED_DEPENDENCIES: METIS[R]
34-
-- ParMETIS_FORWARD_LIB_DEFINED_DEPENDENCIES: SuperLUDist[R] SuperLU[R] Zoltan[O] Amesos[O] ML[O]
33+
-- ParMETIS_LIB_DEFINED_DEPENDENCIES: METIS[O]
34+
-- ParMETIS_FORWARD_LIB_DEFINED_DEPENDENCIES: SuperLUDist[O] SuperLU[O] Zoltan[O] Amesos[O] ML[O]
3535
-- ParMETIS_FORWARD_TEST_DEFINED_DEPENDENCIES: ML[O]
3636

3737
-- CppUnit_FORWARD_TEST_DEFINED_DEPENDENCIES: Sacado[O]
@@ -44,10 +44,10 @@ Package dependencies information:
4444

4545
-- y12m_FORWARD_LIB_DEFINED_DEPENDENCIES: AztecOO[O]
4646

47-
-- SuperLUDist_LIB_DEFINED_DEPENDENCIES: ParMETIS[R] BLAS[R]
47+
-- SuperLUDist_LIB_DEFINED_DEPENDENCIES: ParMETIS[O] BLAS[O]
4848
-- SuperLUDist_FORWARD_LIB_DEFINED_DEPENDENCIES: Amesos[O]
4949

50-
-- SuperLU_LIB_DEFINED_DEPENDENCIES: ParMETIS[R] BLAS[R]
50+
-- SuperLU_LIB_DEFINED_DEPENDENCIES: ParMETIS[O] BLAS[O]
5151
-- SuperLU_FORWARD_LIB_DEFINED_DEPENDENCIES: Amesos[O]
5252

5353
-- UMFPACK_FORWARD_LIB_DEFINED_DEPENDENCIES: EpetraExt[O] Amesos[O]
@@ -173,7 +173,7 @@ Dumping direct enabled dependencies for each package ...
173173

174174
-- BLAS: No enabled dependencies!
175175

176-
-- LAPACK_LIB_ENABLED_DEPENDENCIES: BLAS[R]
176+
-- LAPACK_LIB_ENABLED_DEPENDENCIES: BLAS[O]
177177

178178
-- Boost: No enabled dependencies!
179179

tribits/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
ChangeLog for TriBITS
33
----------------------------------------
44

5+
## 2023-01-06:
6+
7+
* **Changed:** Changed all TPL dependencies back to 'Optional' so that
8+
disabling an external package/TPL will **not** disable any downstream
9+
external packages/TPLs that list a dependency on that external package/TPL.
10+
This undoes the change on [2022-10-20](#2022-10-20) and restores backward
11+
compatibility to the behavior before that change.
12+
513
## 2022-12-20:
614

715
* **Deprecated:** The macro `set_and_inc_dirs()` is deprecated and replaced by

tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ macro(tribits_read_external_package_deps_files_add_to_graph tplName)
223223
tribits_trace_file_processing(TPL INCLUDE "${absTplDepsFile}")
224224
include(${absTplDepsFile})
225225
foreach(depPkg IN LISTS ${tplName}_LIB_DEFINED_DEPENDENCIES)
226-
global_set(${tplName}_LIB_DEP_REQUIRED_${depPkg} TRUE)
226+
global_set(${tplName}_LIB_DEP_REQUIRED_${depPkg} FALSE)
227227
endforeach()
228228
tribits_append_forward_dep_packages(${tplName} LIB)
229229
endif()

tribits/doc/guides/ReducedMockTrilinosOutput/ExpectedDependencies.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Package dependencies information:
1717

1818
-- MPI_FORWARD_LIB_DEFINED_DEPENDENCIES: Teuchos[O] Epetra[O]
1919

20-
-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK[R] Teuchos[R] Epetra[R]
20+
-- BLAS_FORWARD_LIB_DEFINED_DEPENDENCIES: LAPACK[O] Teuchos[R] Epetra[R]
2121

22-
-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS[R]
22+
-- LAPACK_LIB_DEFINED_DEPENDENCIES: BLAS[O]
2323
-- LAPACK_FORWARD_LIB_DEFINED_DEPENDENCIES: Teuchos[R] Epetra[R]
2424

2525
-- Boost_FORWARD_LIB_DEFINED_DEPENDENCIES: Teuchos[O]
@@ -68,7 +68,7 @@ Dumping direct enabled dependencies for each package ...
6868

6969
-- BLAS: No enabled dependencies!
7070

71-
-- LAPACK_LIB_ENABLED_DEPENDENCIES: BLAS[R]
71+
-- LAPACK_LIB_ENABLED_DEPENDENCIES: BLAS[O]
7272

7373
-- Boost: No enabled dependencies!
7474

tribits/doc/guides/TribitsGuidesBody.rst

+20-10
Original file line numberDiff line numberDiff line change
@@ -2269,6 +2269,11 @@ This defines all of the TPLs that ``<tplName>`` could directly depends on but
22692269
only dependencies for enabled upstream TPLs will be added to the IMPORTED
22702270
targets.
22712271

2272+
NOTE: TPL-to-TPL dependencies are optional. Therefore, in the above example,
2273+
enabling the TPL ``<tplName>`` will not auto-enable a dependent upstream TPL
2274+
``<upstreamTpl_i>``. Likewise, disabling an upstream TPL ``<upstreamTpl_i>``
2275+
will not auto-disable a dependent downstream TPL ``<tplName>``.
2276+
22722277

22732278
TriBITS External Package/TPL Core Variables
22742279
...........................................
@@ -3676,19 +3681,24 @@ In more detail, these rules/behaviors are:
36763681

36773682
.. _<Project>_ENABLE_ALL_FORWARD_DEP_PACKAGES enables downstream packages/tests:
36783683

3679-
17) **<Project>_ENABLE_ALL_FORWARD_DEP_PACKAGES enables downstream packages/tests**:
3680-
Setting the user cache-variable
3684+
17) **<Project>_ENABLE_ALL_FORWARD_DEP_PACKAGES enables downstream
3685+
packages/tests**: Setting the user cache-variable
36813686
``${PROJECT_NAME}_ENABLE_ALL_FORWARD_PACKAGES=ON`` will result in the
3682-
`downstream`_ ``PT`` packages and tests to be enabled (and all ``PT``
3683-
and ``ST`` packages and tests when
3687+
`downstream`_ ``PT`` internal packages and tests to be enabled (and all
3688+
``PT`` and ``ST`` packages and tests when
36843689
``${PROJECT_NAME}_SECONDARY_TESTED_CODE=ON``) for all explicitly enabled
3685-
packages. For example, configuring with ``Trilinos_ENABLE_Epetra=ON``,
3686-
``Trilinos_ENABLE_TESTS=ON``, and
3690+
internal packages. For example, in the mock Trilinos project, configuring
3691+
with ``Trilinos_ENABLE_Epetra=ON``, ``Trilinos_ENABLE_TESTS=ON``, and
36873692
``Trilinos_ENABLE_ALL_FORWARD_PACKAGES=ON`` will result the package
3688-
enables (and test and example enables) for the packages ``Triutils``,
3689-
``EpetraExt``, ``ThyraCoreLibs``, ``ThyraEpetra`` and ``Thyra``. For an
3690-
example, see `Explicit enable of a package and downstream packages and
3691-
tests`_.
3693+
enables (and test and example enables) for the downstream packages
3694+
``Triutils``, ``EpetraExt``, ``ThyraCoreLibs``, ``ThyraEpetra`` and
3695+
``Thyra``. For an example, see `Explicit enable of a package and
3696+
downstream packages and tests`_. Note that when setting this option, the
3697+
enable of an external package/TPL will **not** result in the auto-enable
3698+
of downstream internal packages. For example, setting
3699+
``Trilinos_ENABLE_BLAS=ON`` will not result in the auto-enable of any
3700+
internal packages that depend on ``BLAS`` like ``Teuchos`` (in the mock
3701+
Trilinos project).
36923702

36933703
.. _${PROJECT_NAME}_ENABLE_ALL_PACKAGES:
36943704

0 commit comments

Comments
 (0)