xnn.common.models.cpu_extension#
Optional C++ / OpenMP CPU kernels of some fast paths (D3, D4, the HDNNP symmetry functions).
xnn’s CPU paths are PyTorch code. For D3, D4 and the HDNNP symmetry functions an optional
backend of hand-written C++ / OpenMP kernels is available as well, with the loops of the Fortran
reference codes. It is off by default; turn it on with enable() or the environment variable
XNN_CPP_KERNELS=1. The kernels ship as C++ source and are compiled with
torch.utils.cpp_extension.load_inline() the first time they run (a C++ compiler with OpenMP
and ninja are needed, pip install "xnns[cpu-kernels]"); PyTorch keeps the build in its
extension cache, so later processes load it. Where the build fails, or while the backend is off,
the callers run their PyTorch paths.
Functions
|
Turn the optional C++ CPU kernels on (or off) for this process. |
|
Whether the optional C++ CPU kernels are turned on. |
|
The extension |