Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ jobs:
build_shared_libs: OFF
do_fortran: ON
api_prefix: gha
# exercise the generic kernels (LIBINT2_ENABLE_GENERIC_CODE, used
# beyond LIBINT2_OPT_AM) in one lane, as in the release tarballs;
# check-libint2compiler then also checks that generating them in
# parallel gives the same source (e.g. GenericGaussDeriv.cc)
- build_type: Release
build_shared_libs: ON
os: ubuntu-24.04
do_fortran: ON
generic_code: ON
opt_am: 1
# exercise derivatives of 1-body property operators (multipoles,
# opemuop) in one lane only, to save compile time; derivatives of
# opVop and op_q_gau_op are generated (and tested) in every lane
Expand Down Expand Up @@ -93,6 +99,8 @@ jobs:
-D LIBINT2_ENABLE_PYTHON=ON
-D LIBINT2_EXPORT_COMPRESSOR=${{ matrix.compressor }}
-D LIBINT2_API_PREFIX=${{ matrix.api_prefix }}
-D LIBINT2_ENABLE_GENERIC_CODE=${{ matrix.generic_code || 'OFF' }}
${{ matrix.opt_am && format('-D LIBINT2_OPT_AM={0}', matrix.opt_am) || '' }}

outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Note that options, docs, and CMake components are focused on the C++ interface,
`export CMAKE_BUILD_PARALLEL_LEVEL=N`.

* `LIBINT2_MAX_AM` - G - Support Gaussians of angular momentum up to N. If ERI3 ints are enabled, specifing values for each derivative level as a semicolon-separated string also controls the AM of the paired centers. [Default=4]
* `LIBINT2_OPT_AM` - G - Optimize maximally for up to angular momentum N (N <= LIBINT2_MAX_AM). Can specify values for each derivative level as a semicolon-separated string. [Default=-1 -> `(LIBINT2_MAX_AM/2)+1`]
* `LIBINT2_OPT_AM` - G - Optimize maximally for up to angular momentum N (N <= LIBINT2_MAX_AM). Can specify values for each derivative level as a semicolon-separated string of the same length as `LIBINT2_MAX_AM`; a single value applies to all derivative levels. [Default=-1 -> `(LIBINT2_MAX_AM/2)+1`]

* `LIBINT2_MULTIPOLE_MAX_ORDER` - G - Maximum order of spherical multipole integrals. There is no maximum. [Default=4]

Expand Down
12 changes: 6 additions & 6 deletions cmake/modules/int_am.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ message(STATUS "Preparing generic LIBINT_MAX_AM_LIST ${LIBINT_MAX_AM_LIST} and m
# <<< overall opt_am defaults >>>

list(LENGTH LIBINT2_OPT_AM _ntokens_optam)
if (NOT LIBINT2_OPT_AM EQUAL -1)
if (NOT _ntokens_optam EQUAL _ntokens_maxam)
# discard two cases: scalar opt and list max -and- list opt and scalar max
message(FATAL_ERROR "Invalid format for LIBINT2_OPT_AM (${LIBINT2_OPT_AM}). Use the same format and length like `N` or `N0;N1;N2` as LIBINT2_MAX_AM (${LIBINT2_MAX_AM}).")
endif()
# a scalar opt applies to all derivative levels (also with list max); a list
# opt must have the length of list max
if (_ntokens_optam GREATER 1 AND NOT _ntokens_optam EQUAL _ntokens_maxam)
message(FATAL_ERROR "Invalid format for LIBINT2_OPT_AM (${LIBINT2_OPT_AM}). Use `N` (for all derivative levels) or a list of the same length as LIBINT2_MAX_AM (${LIBINT2_MAX_AM}).")
endif()
if (_ntokens_optam GREATER 1)
# list opt and list max: use list opt validating aginst max
Expand Down Expand Up @@ -152,7 +151,8 @@ else()
math(EXPR LIBINT_OPT_AM "${LIBINT_MAX_AM}/2 + 1")
endif()
else()
# scalar opt and scalar max: use scalar opt validating aginst max
# scalar opt (and scalar or list max): use scalar opt for all derivative
# levels, validating against max
set(LIBINT_OPT_AM_LIST "")
set(LIBINT_OPT_AM ${LIBINT2_OPT_AM})

Expand Down
15 changes: 15 additions & 0 deletions src/bin/libint/codegen_jobs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include <codegen_jobs.h>
#include <comp_deriv_gauss.h>
#include <context.h>
#include <default_params.h>
#include <dims.h>
Expand Down Expand Up @@ -691,6 +692,14 @@ void CodegenJobs::run_in_parallel(
std::ofstream report(report_file(k, "rrs"));
write_task_symbols(report);
write_names(report, registry_filenames());
// the instances of GenericGaussDeriv used by the code of this
// worker; GenericGaussDeriv.cc is written by the parent at exit
// (this process exits without running the destructors)
const auto& generic_instances =
CR_DerivGauss_GenericInstantiator::instance().instances();
report << generic_instances.size() << ' ';
for (auto& i : generic_instances)
report << i.first << ' ' << (i.second ? 1 : 0) << ' ';
report.close();
if (!report) throw std::runtime_error("failed to write the report");
}
Expand Down Expand Up @@ -838,6 +847,12 @@ void CodegenJobs::run_in_parallel(
std::ifstream report(report_file(k, "rrs"));
merge_task_symbols(report);
local[k] = read_names(report);
const auto ngeneric = read_value<std::size_t>(report);
for (std::size_t i = 0; i != ngeneric; ++i) {
const auto L = read_value<unsigned int>(report);
const auto vectorize = read_value<int>(report);
CR_DerivGauss_GenericInstantiator::instance().add(L, vectorize != 0);
}
}

// file names that differ only in case get suffixes in the lexicographic
Expand Down
6 changes: 6 additions & 0 deletions src/bin/libint/comp_deriv_gauss.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ class CR_DerivGauss_GenericInstantiator {
public:
static CR_DerivGauss_GenericInstantiator& instance();
void add(unsigned int L, bool vectorize);
/// @return the (L,vectorize) pairs of the instances added so far (the
/// workers of CodegenJobs report them to the parent process, which writes
/// GenericGaussDeriv.cc)
const std::set<std::pair<unsigned int, bool> >& instances() const {
return template_instances_;
}
};

/** Compute relation for (geometric) derivative Gaussian ints of generic type \c
Expand Down
Loading