namespace gpr::kokkos_environment¶
Overview¶
namespace kokkos_environment {
// typedefs
typedef kd::exec_space ExecutionSpace;
typedef kd::mem_space MemorySpace;
typedef Kokkos::View<T*, MemorySpace> DeviceArray;
typedef Kokkos::IndexType<std::size_t> Index;
// classes
class DeviceEnvironments;
// global variables
std::size_t default_scratch_bytes = std::size_t(256)<<20;
// global functions
DeviceEnvironments upload(const gpr::detail::EnvironmentBatchView& source);
std::size_t pairsPerChunk(const DeviceEnvironments& left, const DeviceEnvironments& right, int channel_count, std::size_t scratch_bytes);
Eigen::VectorXd assemble(const DeviceEnvironments& left, const DeviceEnvironments& right, const gpr::detail::EnvironmentPairBatch& batch, std::size_t scratch_bytes = default_scratch_bytes);
} // namespace kokkos_environment
Detailed Documentation¶
Global Variables¶
std::size_t default_scratch_bytes = std::size_t(256)<<20
Execution memory, in bytes, that one call to assemble() may use for its per-pair scratch (jets, weighted Jacobians, Gram matrices and blocks).
Global Functions¶
DeviceEnvironments upload(const gpr::detail::EnvironmentBatchView& source)
Copy the environments of source to execution memory.
std::size_t pairsPerChunk(const DeviceEnvironments& left, const DeviceEnvironments& right, int channel_count, std::size_t scratch_bytes)
Pairs assemble() processes at once so that their scratch fits in scratch_bytes; at least one. A pair’s scratch grows with the number of central atoms squared, so the batch is never allocated whole.
Eigen::VectorXd assemble(const DeviceEnvironments& left, const DeviceEnvironments& right, const gpr::detail::EnvironmentPairBatch& batch, std::size_t scratch_bytes = default_scratch_bytes)
Covariance blocks of the pairs in batch, one (1 + dl) x (1 + dr) column-major block per pair and channel. batch names host index arrays; its environment views are replaced by left and right, which live in execution memory. The pairs run in chunks of pairsPerChunk(scratch_bytes) and each chunk’s blocks are copied to the host after its last kernel. Every work item has one writer and a fixed summation order, so the result does not depend on the chunk size.