Example #1
0
// Returns true if all underlying GPU streams have completed.
func (s Stream) Ready() (ready bool) {
	str := cu.Stream(s)
	if str.Query() != cu.SUCCESS {
		return false
	}
	return true
}
Example #2
0
// Copy from device array to device array.
func (dst *Array) CopyFromDevice(src *Array) {
	CheckSize(dst.size4D, src.size4D)

	d := dst.pointer
	s := src.pointer
	// copies run concurrently on the individual devices
	length := src.partLen4D
	cu.MemcpyDtoDAsync(cu.DevicePtr(d), cu.DevicePtr(s), SIZEOF_FLOAT*int64(length), cu.Stream(dst.Stream))
	// Synchronize with all copies
	dst.Stream.Sync()

}
Example #3
0
// Makes all elements zero.
func (a *Array) Zero() {
	slices := a.pointer
	cu.MemsetD8Async(slices, uint8(0), int64(a.partLen4D*SIZEOF_FLOAT), cu.Stream(a.Stream))
	a.Stream.Sync()
}
Example #4
0
// Synchronizes with all underlying GPU-streams
func (s Stream) Sync() {
	str := cu.Stream(s)
	str.Synchronize()
}
Example #5
0
// Destroys the multi-GPU stream.
func (s Stream) Destroy() {
	str := cu.Stream(s)
	if int(str) != 0 {
		cu.StreamDestroy(&str)
	}
}