Expand version argument - #775
Conversation
hughcars
left a comment
There was a problem hiding this comment.
Useful addition—the -V / --version interface and dependency output are valuable. My main concern is that source-tree probing does not provide authoritative provenance across superbuild and Spack/archive builds. I tested a producer-supplied approach here as a reference, not a requested wholesale rewrite:
https://github.com/awslabs/palace/tree/hughcars/pr775-simplified-version-metadata
dee4dfc to
6e41962
Compare
Co-authored-by: nikosavola <7860886+nikosavola@users.noreply.github.com>
Use only Git commit ID
Fetch git SHA from build/extern folders
…revisions - Always print PROJECT_VERSION in `palace --version`; Git commit stays as optional extra detail so non-Git builds still report a version. - Resolve each dependency version as producer-supplied PALACE_DEP_<NAME>_VERSION (e.g. a Spack recipe), then the find_package version, then the source-tree git description as a last resort. - Pass the dependency source directory explicitly from the superbuild via PALACE_EXTERN_SOURCE_DIR instead of assuming the build-tree layout. - Add missing <cstring> include for std::strcmp. - Short-circuit `-V` in the wrapper so it does not require an MPI launcher. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6e41962 to
0b63f2b
Compare
hughcars
left a comment
There was a problem hiding this comment.
Thanks for taking another pass at this. The Palace version handling looks good, and passing the external source directory fixes the layout assumption. I think the remaining part is to actually pass these values from the superbuild and Spack. Right now the new interface is there, but neither caller uses it, so we still have the original problem. I’ve left examples for both.
| "-DPALACE_REGRESSION_NUMPROC=${PALACE_REGRESSION_NUMPROC}" | ||
| "-DPALACE_TESTS_OMP_THREADS=${PALACE_TESTS_OMP_THREADS}" | ||
| # Where the dependency source trees live, for `palace --version` reporting | ||
| "-DPALACE_EXTERN_SOURCE_DIR=${CMAKE_BINARY_DIR}/extern" |
There was a problem hiding this comment.
This gives the inner build somewhere to receive the version, but the superbuild never actually sends it. Since the superbuild already knows the exact tags, can we pass them here rather than finding them again from the checked-out source?
Something like:
if(PALACE_BUILD_EXTERNAL_DEPS)
list(APPEND PALACE_OPTIONS
"-DPALACE_DEP_mfem_VERSION=${EXTERN_MFEM_GIT_TAG}"
"-DPALACE_DEP_libCEED_VERSION=${EXTERN_LIBCEED_GIT_TAG}"
"-DPALACE_DEP_hypre_VERSION=${EXTERN_HYPRE_GIT_TAG}"
"-DPALACE_DEP_metis_VERSION=${EXTERN_METIS_GIT_TAG}"
"-DPALACE_DEP_parmetis_VERSION=${EXTERN_PARMETIS_GIT_TAG}"
)
if(PALACE_WITH_SLEPC)
list(APPEND PALACE_OPTIONS
"-DPALACE_DEP_petsc_VERSION=${EXTERN_PETSC_GIT_TAG}"
"-DPALACE_DEP_slepc_VERSION=${EXTERN_SLEPC_GIT_TAG}"
)
endif()
if(PALACE_WITH_ARPACK)
list(APPEND PALACE_OPTIONS
"-DPALACE_DEP_arpack_ng_VERSION=${EXTERN_ARPACK_GIT_TAG}"
)
endif()
if(PALACE_WITH_SUNDIALS)
list(APPEND PALACE_OPTIONS
"-DPALACE_DEP_sundials_VERSION=${EXTERN_SUNDIALS_GIT_TAG}"
)
endif()
if(PALACE_WITH_SUPERLU)
list(APPEND PALACE_OPTIONS
"-DPALACE_DEP_superlu_dist_VERSION=${EXTERN_SUPERLU_GIT_TAG}"
)
endif()
endif()The same should be done for the other enabled optional dependencies. Then the source-tree lookup is actually a fallback rather than the normal route.
| # dependency the version is resolved in order of decreasing authority: | ||
| # 1. PALACE_DEP_<NAME>_VERSION passed in by the producer that knows the | ||
| # concrete provenance (e.g. a Spack recipe passing its resolved spec). | ||
| # 2. The version number discovered by find_package. |
There was a problem hiding this comment.
We have the same gap in the Spack recipe. It knows the exact concrete dependencies, but doesn’t pass any of them through, so --version can still leave out MFEM, libCEED, PETSc, and SLEPc.
Can we add something like this in cmake_args?
dependency_versions = {
"STRUMPACK": "strumpack",
"arpack_ng": "arpack-ng",
"eigen": "eigen",
"fmt": "fmt",
"gslib": "gslib",
"hypre": "hypre",
"json": "nlohmann-json",
"libCEED": "libceed",
"libxsmm": "libxsmm",
"magma": "magma",
"metis": "metis",
"mfem": "mfem",
"mumps": "mumps",
"parmetis": "parmetis",
"petsc": "petsc",
"scalapack": "scalapack",
"scn": "scnlib",
"slepc": "slepc",
"sundials": "sundials",
"superlu_dist": "superlu-dist",
}
for cmake_name, spack_name in dependency_versions.items():
if spack_name not in self.spec:
continue
dep = self.spec[spack_name]
provenance = f"{dep.version} /{dep.dag_hash(7)}"
args.append(
self.define(
f"PALACE_DEP_{cmake_name}_VERSION",
provenance,
)
)I included the short DAG hash because develop, or the same nominal dependency version, can still mean a different concrete build.
Addresses PR review comments. - The superbuild now passes its pinned EXTERN_*_GIT_TAG revisions to the inner build via PALACE_DEP_<NAME>_VERSION, so the source-tree git probe in the inner build is a fallback rather than the normal route. - The Spack recipe passes each concrete dependency's version and short DAG hash as provenance, so `--version` no longer omits MFEM, libCEED, PETSc, and SLEPc when no source tree is available. Co-Authored-By: Kimi K3 <noreply@moonshot.ai>
New PR of #477 with #477 (review) addressed with dee4dfc