MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / compute

Function compute

external/ggml/examples/simple/simple-backend.cpp:99–112  ·  view source on GitHub ↗

compute with backend

Source from the content-addressed store, hash-verified

97
98// compute with backend
99struct ggml_tensor * compute(simple_model & model, struct ggml_cgraph * gf) {
100 ggml_backend_sched_reset(model.sched);
101 ggml_backend_sched_alloc_graph(model.sched, gf);
102
103 // load data from cpu memory to backend buffer
104 ggml_backend_tensor_set(model.a, matrix_A, 0, ggml_nbytes(model.a));
105 ggml_backend_tensor_set(model.b, matrix_B, 0, ggml_nbytes(model.b));
106
107 // compute the graph
108 ggml_backend_sched_graph_compute(model.sched, gf);
109
110 // in this case, the output tensor is the last one in the graph
111 return ggml_graph_node(gf, -1);
112}
113
114int main(void) {
115 ggml_time_init();

Callers 1

mainFunction · 0.70

Calls 6

ggml_backend_sched_resetFunction · 0.85
ggml_backend_tensor_setFunction · 0.85
ggml_nbytesFunction · 0.85
ggml_graph_nodeFunction · 0.85

Tested by

no test coverage detected