1#ifndef COLVAR_GPU_CALC_H
2#define COLVAR_GPU_CALC_H
4#if defined (COLVARS_CUDA) || defined (COLVARS_HIP)
7#include "colvar_gpu_support.h"
18namespace colvars_gpu {
71 std::vector<compute_node_t>
nodes;
137 #if defined (COLVARS_NVTX_PROFILING)
153 int cv_update_flags(
const std::vector<colvar*>& colvars);
154 int cvc_calc_total_force(
155 const std::vector<colvar*>& colvars,
157 bool use_current_step =
false);
158 int atom_group_read_data_gpu(
159 const std::vector<colvar*>& colvars,
163 const std::vector<colvar*>& colvars,
165 int cvc_calc_gradients(
166 const std::vector<colvar*>& colvars,
168 int atom_group_calc_fit_gradients(
169 const std::vector<colvar*>& colvars,
172 int cvc_debug_gradients(
173 const std::vector<colvar*>& colvars,
175 int cvc_calc_Jacobian_derivative(
176 const std::vector<colvar*>& colvars,
178 int cv_collect_cvc_data(
179 const std::vector<colvar*>& colvars,
A collective variable (main class); to be defined, it needs at least one object of a derived class of...
Definition: colvar.h:53
Parent class for a member object of a bias, cv or cvc etc. containing features and their dependencies...
Definition: colvardeps.h:34
Collective variables module (main class)
Definition: colvarmodule.h:71
Class for managing NVTX profiling ranges.
Definition: colvar_gpu_support.h:346
A struct for holding a CUDA graph and its execution object.
Definition: colvar_gpu_calc.h:54
bool graph_exec_initialized
Flag to describe whether the graph execution instance has been initialized.
Definition: colvar_gpu_calc.h:65
std::vector< compute_node_t > nodes
List of compute nodes.
Definition: colvar_gpu_calc.h:71
compute_gpu_graph_t()
Constructor.
Definition: colvar_gpu_calc.cpp:375
~compute_gpu_graph_t()
Destructor.
Definition: colvar_gpu_calc.cpp:395
void dump_graph(const char *filename)
Dump the CUDA graph to a dot file for debugging.
Definition: colvar_gpu_calc.cpp:408
cudaGraphExec_t graph_exec
CUDA graph execution instance object.
Definition: colvar_gpu_calc.h:69
int init()
(Re)initialize the CUDA graph
Definition: colvar_gpu_calc.cpp:379
cudaGraph_t graph
CUDA graph object.
Definition: colvar_gpu_calc.h:67
Class for managing the GPU calculation of CVCs.
Definition: colvar_gpu_calc.h:29
compute_gpu_graph_t calc_fit_gradients_compute
CUDA graph for calculating fit gradients.
Definition: colvar_gpu_calc.h:126
compute_gpu_graph_t read_data_compute
CUDA graph for reading data to GPU and calculating required properties.
Definition: colvar_gpu_calc.h:124
~colvarmodule_gpu_calc()
Destructor.
Definition: colvar_gpu_calc.h:80
int calc_cvs(const std::vector< colvar * > &colvars, colvarmodule *colvar_module)
Calculate the colvar {...} blocks.
Definition: colvar_gpu_calc.cpp:435
colvarmodule_gpu_calc()
Constructor.
Definition: colvar_gpu_calc.cpp:413
std::vector< colvardeps * > forced_atom_groups
A list of atom groups that require forces to be applied.
Definition: colvar_gpu_calc.h:135
int apply_forces(const std::vector< colvar * > &colvars, colvarmodule *colvar_module)
Apply the forces to the atom groups from the CVCs.
Definition: colvar_gpu_calc.cpp:473
int init()
Initialize all the GPU compute graphs.
Definition: colvar_gpu_calc.cpp:426
compute_gpu_graph_t apply_forces_compute
CUDA graph for applying forces to atom groups.
Definition: colvar_gpu_calc.h:128
A struct for holding a compute node in the CUDA graph and its corresponding atom group or CVC (child ...
Definition: colvar_gpu_calc.h:43
bool require_cpu_buffers
Whether the node requires CPU buffers.
Definition: colvar_gpu_calc.h:49
colvardeps * colvar_node
Pointer to the corresponding colvardeps object.
Definition: colvar_gpu_calc.h:45
cudaGraphNode_t child_graph_node
CUDA graph node.
Definition: colvar_gpu_calc.h:47