Skip to content

Compiler: GenericGaussDeriv.cc lists the instances used by all generator workers - #465

Merged
evaleev merged 3 commits into
masterfrom
fix/parallel-generic-gauss-deriv
Nov 10, 2026
Merged

evaleev merged 3 commits into
masterfrom
fix/parallel-generic-gauss-deriv

Conversation

@evaleev

@evaleev evaleev commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Why

The 2.14.0 standard tarball (MAX_AM=6, OPT_AM=3, ENABLE_GENERIC_CODE=ON), generated with LIBINT2_GENERATOR_JOBS=0 now that #464 restored the option, fails to link all its tests:

Undefined symbols: libint2::GenericGaussDeriv<0, false>::compute(...), <7,false> ... <12,false>

CR_DerivGauss_GenericInstantiator records which instances of the generic GenericGaussDeriv kernel the generated code uses, and its destructor writes GenericGaussDeriv.cc when the generator exits. Since #455 that code is generated by worker processes, which exit with _exit() and so never run the destructors. The parent recorded no instances, so the tarball had no GenericGaussDeriv.cc at all.

No CI lane enables LIBINT2_ENABLE_GENERIC_CODE, so neither the generic kernels nor libint2/compiler/codegen_order's serial-vs-parallel comparison of them ever ran in CI. Blocks 2.14.0.

What

  • Workers append the instances they recorded to their final report, and the parent merges them before it writes GenericGaussDeriv.cc. CR_DerivGauss_GenericInstantiator::instances() exposes the set.
  • I checked the other generator singletons; none writes output at exit.
  • CI: the Ubuntu Release shared-library lane now sets LIBINT2_ENABLE_GENERIC_CODE=ON and LIBINT2_OPT_AM=1. Generic kernels are then built and tested for the d shells, and check-libint2compiler checks that generating them in parallel gives the same source.

Testing

Generated the standard tarball's configuration serially (LIBINT_GENERATOR_JOBS=1) and in parallel (=0):

  • before: the parallel output has no GenericGaussDeriv.cc;
  • after: both outputs have 19,408 files with no differences, and GenericGaussDeriv.cc has the same 7 instances (L = 0, 7–12).

CR_DerivGauss_GenericInstantiator records the instances of the generic
GenericGaussDeriv kernel used by the generated code and writes
GenericGaussDeriv.cc when the generator exits. With
LIBINT_GENERATOR_JOBS > 1 the code is generated by the workers, which exit
without running the destructors, hence the instances were lost: the
library of a configuration with LIBINT2_ENABLE_GENERIC_CODE=ON and
derivatives beyond LIBINT2_OPT_AM (e.g. the standard release tarball) had
no GenericGaussDeriv.cc and failed to link. The workers now report the
instances to the parent.

CI: one lane enables LIBINT2_ENABLE_GENERIC_CODE with LIBINT2_OPT_AM=1, so
that the generic kernels are built and tested, and
libint2/compiler/codegen_order checks that generating them in parallel gives
the same source; no lane did.
@evaleev evaleev added this to the 2.14 milestone Nov 10, 2026
… with a list LIBINT2_MAX_AM

int_am.cmake rejected a scalar LIBINT2_OPT_AM with a list LIBINT2_MAX_AM,
although the generator handles it (the per-derivative tasks without their
own value use the default OPT_AM). Only a list of a different length is
invalid. The generic-code CI lane uses LIBINT2_OPT_AM=1 again.
@evaleev
evaleev merged commit e5ac124 into master Nov 10, 2026
15 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.

1 participant