Пример #1
0
        private void SetCudaDataForFormat()
        {
            evalThreads = threadsPerRow * sliceSize;
            int N = sizeSV;

            evalBlocks = (int)Math.Ceiling(1.0 * N * threadsPerRow / evalThreads);

            align = (int)Math.Ceiling(1.0 * sliceSize * threadsPerRow / 64) * 64;


            float[] vecVals;
            int[]   vecColIdx;
            int[]   vecLenght;
            int[]   sliceStart;

            CudaHelpers.TransformToSERTILP(out vecVals, out vecColIdx, out sliceStart, out vecLenght, TrainedModel.SupportElements, threadsPerRow, sliceSize, preFechSize);

            float[] selfSum = TrainedModel.SupportElements.AsParallel().Select(c => c.Values.Sum()).ToArray();


            //copy data to device, set cuda function parameters
            //copy data to device, set cuda function parameters
            valsPtr       = cuda.CopyHostToDevice(vecVals);
            idxPtr        = cuda.CopyHostToDevice(vecColIdx);
            vecLengthPtr  = cuda.CopyHostToDevice(vecLenght);
            sliceStartPtr = cuda.CopyHostToDevice(sliceStart);

            selfSumPtr = cuda.CopyHostToDevice(selfSum);
        }