Exemplo n.º 1
0
        public CUP2PTokens GetP2PTokens(CUdeviceptr ptr)
        {
            CUP2PTokens tokens = new CUP2PTokens();

            this.LastError = CUDADriver.cuPointerGetAttribute(ref tokens, CUPointerAttribute.P2PTokens, ptr);
            return(tokens);
        }
Exemplo n.º 2
0
        public uint GetTextureFlags(CUtexref tex)
        {
            uint pFlags = 0;

            this.LastError = CUDADriver.cuTexRefGetFlags(ref pFlags, tex);
            return(pFlags);
        }
Exemplo n.º 3
0
        public CUcontext GetCurrentContextV1()
        {
            CUcontext ctx = new CUcontext();

            this.LastError = CUDADriver.cuCtxGetCurrent(ref ctx);
            return(ctx);
        }
Exemplo n.º 4
0
        public CUAddressMode GetTextureAddressMode(CUtexref tex, int dimension)
        {
            CUAddressMode wrap = CUAddressMode.Wrap;

            this.LastError = CUDADriver.cuTexRefGetAddressMode(ref wrap, tex, dimension);
            return(wrap);
        }
Exemplo n.º 5
0
        public IntPtr AllocateHost(uint bytes)
        {
            IntPtr pp = new IntPtr();

            this.LastError = CUDADriver.cuMemAllocHost(ref pp, bytes);
            return(pp);
        }
Exemplo n.º 6
0
        public CUdeviceptr Allocate(uint bytes)
        {
            CUdeviceptr dptr = new CUdeviceptr();

            this.LastError = CUDADriver.cuMemAlloc(ref dptr, bytes);
            return(dptr);
        }
Exemplo n.º 7
0
        public CUtexref GetModuleTexture(CUmodule mod, string textureName)
        {
            CUtexref pTexRef = new CUtexref();

            this.LastError = CUDADriver.cuModuleGetTexRef(ref pTexRef, mod, textureName);
            return(pTexRef);
        }
Exemplo n.º 8
0
        public CUstream CreateStream(StreamFlags flags)
        {
            CUstream phStream = new CUstream();

            this.LastError = CUDADriver.cuStreamCreate(ref phStream, (uint)flags);
            return(phStream);
        }
Exemplo n.º 9
0
        public CUtexref CreateTexture()
        {
            CUtexref pTexRef = new CUtexref();

            this.LastError = CUDADriver.cuTexRefCreate(ref pTexRef);
            return(pTexRef);
        }
Exemplo n.º 10
0
 public CUcontext CreateContext(int ordinal, CUCtxFlags flags)
 {
     this.curCtx        = new CUcontext();
     this.LastError     = CUDADriver.cuCtxCreate(ref this.curCtx, (uint)flags, this.Devices[ordinal].Handle);
     this.CurrentDevice = this.Devices[ordinal];
     return(this.curCtx);
 }
Exemplo n.º 11
0
        public CUevent CreateEvent(CUEventFlags flags)
        {
            CUevent phEvent = new CUevent();

            this.LastError = CUDADriver.cuEventCreate(ref phEvent, (uint)flags);
            return(phEvent);
        }
Exemplo n.º 12
0
        public CUarray CreateArray(CUDAArrayDescriptor desc)
        {
            CUarray pHandle = new CUarray();

            this.LastError = CUDADriver.cuArrayCreate(ref pHandle, ref desc);
            return(pHandle);
        }
Exemplo n.º 13
0
        public void CopyHostToDevice <T>(CUdeviceptr devPtr, T[] data)
        {
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            this.LastError = CUDADriver.cuMemcpyHtoD(devPtr, handle.AddrOfPinnedObject(), this.GetSize <T>(data));
            handle.Free();
        }
Exemplo n.º 14
0
        public void CopyHostToArray <T>(CUarray devArray, T[] data, uint index)
        {
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            this.LastError = CUDADriver.cuMemcpyHtoA(devArray, index, handle.AddrOfPinnedObject(), this.GetSize <T>(data));
            handle.Free();
        }
Exemplo n.º 15
0
        public CUarray GetGraphicsSubResourceMappedArray(CUgraphicsResource resource, uint arrIndex, uint mipLevel)
        {
            CUarray pArray = new CUarray();

            this.LastError = CUDADriver.cuGraphicsSubResourceGetMappedArray(ref pArray, resource, arrIndex, mipLevel);
            return(pArray);
        }
Exemplo n.º 16
0
        public float ElapsedTime(CUevent start, CUevent end)
        {
            float pMilliseconds = 0f;

            this.LastError = CUDADriver.cuEventElapsedTime(ref pMilliseconds, start, end);
            return(pMilliseconds);
        }
Exemplo n.º 17
0
        public CUdeviceptr GetHostDevicePointer(IntPtr hostPtr, uint flags)
        {
            CUdeviceptr pdptr = new CUdeviceptr();

            this.LastError = CUDADriver.cuMemHostGetDevicePointer(ref pdptr, hostPtr, flags);
            return(pdptr);
        }
Exemplo n.º 18
0
        public CUDAArrayDescriptor GetArrayDescriptor(CUarray devArr)
        {
            CUDAArrayDescriptor pArrayDescriptor = new CUDAArrayDescriptor();

            this.LastError = CUDADriver.cuArrayGetDescriptor(ref pArrayDescriptor, devArr);
            return(pArrayDescriptor);
        }
Exemplo n.º 19
0
        public CUfunction GetModuleFunction(CUmodule mod, string funcName)
        {
            CUfunction hfunc = new CUfunction();

            this.LastError = CUDADriver.cuModuleGetFunction(ref hfunc, mod, funcName);
            return(hfunc);
        }
Exemplo n.º 20
0
        public CUdevice GetContextDevice()
        {
            CUdevice device = new CUdevice();

            this.LastError = CUDADriver.cuCtxGetDevice(ref device);
            return(device);
        }
Exemplo n.º 21
0
        public CUdeviceptr GetTextureAddress(CUtexref tex)
        {
            CUdeviceptr pdptr = new CUdeviceptr();

            this.LastError = CUDADriver.cuTexRefGetAddress(ref pdptr, tex);
            return(pdptr);
        }
Exemplo n.º 22
0
        public CUdevice GetDevice(int ordinal)
        {
            CUdevice device = new CUdevice();

            this.LastError = CUDADriver.cuDeviceGet(ref device, ordinal);
            return(device);
        }
Exemplo n.º 23
0
        public CUarray GetTextureArray(CUtexref tex)
        {
            CUarray phArray = new CUarray();

            this.LastError = CUDADriver.cuTexRefGetArray(ref phArray, tex);
            return(phArray);
        }
Exemplo n.º 24
0
        public int GetDeviceAttribute(CUDeviceAttribute attrib, CUdevice dev)
        {
            int pi = 0;

            this.LastError = CUDADriver.cuDeviceGetAttribute(ref pi, attrib, dev);
            return(pi);
        }
Exemplo n.º 25
0
        public CUFilterMode GetTextureFilterMode(CUtexref tex)
        {
            CUFilterMode point = CUFilterMode.Point;

            this.LastError = CUDADriver.cuTexRefGetFilterMode(ref point, tex);
            return(point);
        }
Exemplo n.º 26
0
        public int GetDeviceCount()
        {
            int count = 0;

            this.LastError = CUDADriver.cuDeviceGetCount(ref count);
            return(count);
        }
Exemplo n.º 27
0
        public IntPtr HostAllocate(uint size, uint flags)
        {
            IntPtr pp = new IntPtr();

            this.LastError = CUDADriver.cuMemHostAlloc(ref pp, size, flags);
            return(pp);
        }
Exemplo n.º 28
0
        public int GetFunctionAttribute(CUfunction func, CUFunctionAttribute attrib)
        {
            int pi = 0;

            this.LastError = CUDADriver.cuFuncGetAttribute(ref pi, attrib, func);
            return(pi);
        }
Exemplo n.º 29
0
        //private CUcontext _pctx;

        public CUcontext MakeFloating()
        {
            CUcontext pctx = new CUcontext();

            this.LastError = CUDADriver.cuCtxPopCurrent(ref pctx);
            return(pctx);
        }
Exemplo n.º 30
0
        public CUcontext GetPointerContext(CUdeviceptr ptr)
        {
            CUcontext ctx = new CUcontext();

            this.LastError = CUDADriver.cuPointerGetAttribute(ref ctx, CUPointerAttribute.Context, ptr);
            return(ctx);
        }