示例#1
0
文件: reduce.go 项目: shenyp09/mx3
// copy back single float result from GPU and recycle buffer
func copyback(buf unsafe.Pointer) float32 {
	var result_ [1]float32
	result := result_[:]
	cu.MemcpyDtoH(unsafe.Pointer(&result[0]), cu.DevicePtr(buf), 1*cu.SIZEOF_FLOAT32)
	reduceBuffers <- buf
	return result_[0]
}
示例#2
0
文件: slice.go 项目: postfix/cuda5
func (src *slice) copyDtoH(dst unsafe.Pointer, dstlen int, elemsize int) {
	if dstlen != src.Len() {
		panic(fmt.Errorf("cuda4/safe: len mismatch: src.Len()=%v (device), len(dst)=%v (host)", src.Len(), dstlen))
	}
	cu.MemcpyDtoH(dst, src.Pointer(), int64(elemsize)*int64(dstlen))
}
示例#3
0
文件: slice.go 项目: shenyp09/mx3
func memCpyDtoH(dst, src unsafe.Pointer, bytes int64) { cu.MemcpyDtoH(dst, cu.DevicePtr(src), bytes) }