MCPcopy Create free account
hub / github.com/cogentcore/core / SyncRegionValueIndex

Method SyncRegionValueIndex

vgpu/memory.go:335–348  ·  view source on GitHub ↗

SyncRegionValueIndex returns memory region for syncing given value from GPU device memory to CPU host memory, specifying value by index for given named variable, in given set. Variable can only only be Storage memory -- otherwise an error is returned. Multiple regions can be combined into one transf

(set int, varNm string, valIndex int)

Source from the content-addressed store, hash-verified

333// Variable can only only be Storage memory -- otherwise an error is returned.
334// Multiple regions can be combined into one transfer call for greater efficiency.
335func (mm *Memory) SyncRegionValueIndex(set int, varNm string, valIndex int) (MemReg, error) {
336 vr, vl, err := mm.Vars.ValueByIndexTry(set, varNm, valIndex)
337 if err != nil {
338 return MemReg{}, err
339 }
340 if vr.BuffType() != StorageBuff {
341 err = fmt.Errorf("SyncRegionValueIndex: Variable must be in Storage buffer, not: %s", vr.BuffType().String())
342 if Debug {
343 log.Println(err)
344 return MemReg{}, err
345 }
346 }
347 return vl.MemReg(vr), nil
348}
349
350// SyncValueNameFromGPU syncs given value from GPU device memory to CPU host memory,
351// specifying value by name for given named variable in given set.

Callers 1

SyncValueIndexFromGPUMethod · 0.95

Calls 6

PrintlnMethod · 0.80
MemRegMethod · 0.80
ErrorfMethod · 0.65
StringMethod · 0.65
ValueByIndexTryMethod · 0.45
BuffTypeMethod · 0.45

Tested by

no test coverage detected