Skip to content

Expand version argument - #775

Open
nikosavola wants to merge 10 commits into
awslabs:mainfrom
nikosavola:expand-version-argument
Open

Expand version argument#775
nikosavola wants to merge 10 commits into
awslabs:mainfrom
nikosavola:expand-version-argument

Conversation

@nikosavola

Copy link
Copy Markdown
Contributor

New PR of #477 with #477 (review) addressed with dee4dfc

@hughcars hughcars left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread palace/CMakeLists.txt Outdated
Comment thread palace/main.cpp
@nikosavola
nikosavola force-pushed the expand-version-argument branch from dee4dfc to 6e41962 Compare July 24, 2026 09:33
Copilot AI and others added 9 commits September 2, 2026 11:45
Co-authored-by: nikosavola <7860886+nikosavola@users.noreply.github.com>
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>
@hughcars
hughcars force-pushed the expand-version-argument branch from 6e41962 to 0b63f2b Compare September 2, 2026 15:45

@hughcars hughcars left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 222499a

Comment thread palace/CMakeLists.txt
# 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 222499a

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>
@nikosavola
nikosavola requested a review from hughcars September 10, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants