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)
| 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. |
| 335 | func (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. |
no test coverage detected