コード例 #1
0
ファイル: slice.go プロジェクト: shenyp09/mx3
// Memset sets the Slice's components to the specified values.
func Memset(s *data.Slice, val ...float32) {
	util.Argument(len(val) == s.NComp())
	str := stream()
	for c, v := range val {
		cu.MemsetD32Async(cu.DevicePtr(s.DevPtr(c)), math.Float32bits(v), int64(s.Len()), str)
	}
	syncAndRecycle(str)
}
コード例 #2
0
ファイル: reduce.go プロジェクト: shenyp09/mx3
// return a 1-float CUDA reduction buffer from a pool
// initialized to initVal
func reduceBuf(initVal float32) unsafe.Pointer {
	if reduceBuffers == nil {
		initReduceBuf()
	}
	buf := <-reduceBuffers
	str := stream()
	cu.MemsetD32Async(cu.DevicePtr(buf), math.Float32bits(initVal), 1, str)
	syncAndRecycle(str)
	return buf
}
コード例 #3
0
ファイル: float32s.go プロジェクト: postfix/cuda5
// Set the entire slice to this value, asynchronously.
func (s Float32s) MemsetAsync(value float32, stream cu.Stream) {
	cu.MemsetD32Async(s.Pointer(), math.Float32bits(value), int64(s.Len()), stream)
}
コード例 #4
0
ファイル: conv_symm.go プロジェクト: shenyp09/mx3
// zero 1-component slice
func zero1(dst *data.Slice, str cu.Stream) {
	cu.MemsetD32Async(cu.DevicePtr(dst.DevPtr(0)), 0, int64(dst.Len()), str)
}