コード例 #1
0
ファイル: context.go プロジェクト: callistoaz/3
//Destroys the CUDA context specified by ctx. If the context usage count is not equal to 1, or the context is current to any CPU thread other than the current one, this function fails. Floating contexts (detached from a CPU thread via cuCtxPopCurrent()) may be destroyed by this function.
func CtxDestroy(ctx *Context) {
	err := Result(C.cuCtxDestroy(C.CUcontext(unsafe.Pointer(uintptr(*ctx)))))
	*ctx = 0
	if err != SUCCESS {
		panic(err)
	}
}
コード例 #2
0
ファイル: context.go プロジェクト: LStoleriu/hotspin
// Returns the API version to create the context.
func CtxGetApiVersion(ctx Context) (version int) {
	var cversion C.uint
	err := Result(C.cuCtxGetApiVersion(C.CUcontext(unsafe.Pointer(uintptr(ctx))), &cversion))
	if err != SUCCESS {
		panic(err)
	}
	version = int(cversion)
	return
}
コード例 #3
0
ファイル: memory.go プロジェクト: postfix/cuda5
// Asynchronously copies from device memory in one context (device) to another.
func MemcpyPeerAsync(dst DevicePtr, dstCtx Context, src DevicePtr, srcCtx Context, bytes int64, stream Stream) {
	err := Result(C.cuMemcpyPeerAsync(C.CUdeviceptr(dst), C.CUcontext(unsafe.Pointer(uintptr(dstCtx))), C.CUdeviceptr(src), C.CUcontext(unsafe.Pointer(uintptr(srcCtx))), C.size_t(bytes), C.CUstream(unsafe.Pointer(uintptr(stream)))))
	if err != SUCCESS {
		panic(err)
	}
}
コード例 #4
0
ファイル: context.go プロジェクト: LStoleriu/hotspin
// Sets the current active context.
func CtxSetCurrent(ctx Context) {
	err := Result(C.cuCtxSetCurrent(C.CUcontext(unsafe.Pointer(uintptr(ctx)))))
	if err != SUCCESS {
		panic(err)
	}
}
コード例 #5
0
ファイル: peer.go プロジェクト: LStoleriu/hotspin
// Reverses CtxEnablePeerAccess().
func CtxDisablePeerAccess(peer Context) {
	err := Result(C.cuCtxDisablePeerAccess(C.CUcontext(unsafe.Pointer(uintptr(peer)))))
	if err != SUCCESS {
		panic(err)
	}
}