示例#1
0
        protected void DisposeResourses()
        {
            for (int i = 0; i < NUM_STREAMS; i++)
            {
                cuda.FreeHost(mainVecIntPtrs[i]);
                cuda.Free(mainVecCuPtr[i]);

                cuda.Free(evalOutputCuPtr[i]);

                cuda.Free(reduceCuPtr[i]);
                cuda.FreeHost(reduceIntPtrs[i]);


                if (cuVecTexRef[i].Pointer != IntPtr.Zero)
                {
                    cuda.DestroyTexture(cuVecTexRef[i]);
                }

                cuda.DestroyStream(stream[i]);
            }

            if (labelsPtr.Pointer != IntPtr.Zero)
            {
                cuda.Free(labelsPtr);
                labelsPtr.Pointer = IntPtr.Zero;
            }

            if (alphasPtr.Pointer != IntPtr.Zero)
            {
                cuda.Free(alphasPtr);
                alphasPtr.Pointer = IntPtr.Zero;
            }
        }
示例#2
0
        protected void DisposeResourses()
        {
            //free all resources
            cuda.Free(valsPtr);
            valsPtr.Pointer = IntPtr.Zero;
            cuda.Free(idxPtr);
            idxPtr.Pointer = IntPtr.Zero;
            cuda.Free(vecLengthPtr);
            vecLengthPtr.Pointer = IntPtr.Zero;


            cuda.FreeHost(outputIntPtr);
            //if (outputPtr.Pointer != IntPtr.Zero)
            //{
            //    cuda.Free(outputPtr);
            //    outputPtr.Pointer = IntPtr.Zero;
            //}

            cuda.Free(labelsPtr);
            labelsPtr.Pointer = IntPtr.Zero;


            if (VecIPtr.Pointer != IntPtr.Zero)
            {
                cuda.Free(VecIPtr);
                VecIPtr.Pointer = IntPtr.Zero;
            }

            if (VecJPtr.Pointer != IntPtr.Zero)
            {
                cuda.Free(VecJPtr);
                VecJPtr.Pointer = IntPtr.Zero;
            }



            if (cuVecI_TexRef.Pointer != IntPtr.Zero)
            {
                cuda.DestroyTexture(cuVecI_TexRef);
            }

            if (cuVecJ_TexRef.Pointer != IntPtr.Zero)
            {
                cuda.DestroyTexture(cuVecJ_TexRef);
            }
        }