Skip to content

Build the libtorch CI variants with C++20 (#1476) - #1485

Merged
carlocamilloni merged 3 commits into
plumed:v2.10from
aalhossary:ci-torch-cxx20
Oct 11, 2026
Merged

carlocamilloni merged 3 commits into
plumed:v2.10from
aalhossary:ci-torch-cxx20

Conversation

@aalhossary

@aalhossary aalhossary commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
Description

Fixes #1476. As @Zhang-pchao found there, the torch 2.14 headers require C++20, so under PLUMED's default C++17 configure cannot enable libtorch/libmetatomic and the seven pytorch/ and metatomic/ regtests are skipped. That turns -coverage-mpi- and -doc-mpi- red through PLUMED_ALL_TESTS=yes.

  1. ci: add --enable-cxx=20 in the CI step that enables libmetatomic/libtorch.
  2. asmjit: C++20 does not accept a template-id as a constructor name, and GCC 11/12 reject ASMJIT_NONCOPYABLE(StringBuilderTmp<N>) and two similar uses. Using the injected class name works in every standard. Three lines.
  3. PathMSDBase: cherry-pick of PathMSDBase: drop four omp simd pragmas that cannot vectorize #1437 (already on master). Under C++20 the Intel compiler rejects an omp simd pragma over a loop that copies std::vectors; PathMSDBase: drop four omp simd pragmas that cannot vectorize #1437 removed that pragma together with three others that could not vectorize.

I checked locally that these are the only C++20-specific errors: I syntax-checked every source file with clang + libstdc++ 12 + OpenMP under C++17 and under C++20, and did a full GCC 11 build under C++20.

Target release

I would like my code to appear in release v2.10

Type of contribution
  • changes to code or doc authored by PLUMED developers, or additions of code in the core or within the default modules
  • changes to a module not authored by you
  • new module contribution or edit of a module authored by you
Copyright
  • I agree to transfer the copyright of the code I have written to the PLUMED developers or to the author of the code I am modifying.
Tests
  • I added a new regtest or modified an existing regtest to validate my changes.
  • I verified that all regtests are passed successfully on GitHub Actions.

Tested first on my fork, run 38074095509. The whole run is green, including -coverage-mpi- and -doc-mpi- (the two jobs #1476 turned red) as well as -intel- and -nvhpc-mpi-. On -mpi-: 784 tests performed, 0 not applicable, 0 errors, with all seven pytorch/ and metatomic/ regtests run.

torch 2.14 headers stop with "C++20 or later compatible compiler is
required", so configure's libtorch and libmetatomic checks fail under
PLUMED's default C++17 and the seven pytorch/metatomic regtests are
skipped. See plumed#1476.
C++20 no longer accepts a template-id as the name of a constructor
(StringBuilderTmp<N>(const StringBuilderTmp<N>&)), and GCC 11 and 12
reject it with --enable-cxx=20. The injected class name is valid in
every standard.
@carlocamilloni
carlocamilloni merged commit acaba1b into plumed:v2.10 Oct 11, 2026
16 checks passed
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.

2 participants