Esempio n. 1
0
        public void SetSparseData(List <float[]> values, List <int[]> indices)
        {
            if ((SparseMatrix == null))
            {
                Console.WriteLine("Creating sparse input arrays");
                SparseMatrix = new CpuGpuMatrixSparse(_gpuModule, this.SparseDataSize, MinibatchSize, this.Size);
            }

            SparseMatrix.SetData(values, indices);
            SparseMatrix.CopyToGPU();
        }
Esempio n. 2
0
        public void SetSparseData(List<float[]> values, List<int[]> indices)
        {
            if ((SparseMatrix == null))
            {
                Console.WriteLine("Creating sparse input arrays");
                SparseMatrix = new CpuGpuMatrixSparse(_gpuModule, this.SparseDataSize, MinibatchSize, this.Size);
            }

            SparseMatrix.SetData(values, indices);
            SparseMatrix.CopyToGPU();
        }
Esempio n. 3
0
        public void MultiplySparse(CpuGpuMatrixSparse A, CpuGpuArray B, CpuGpuArray C, bool transposeA)
        {
            FillArray(C, 0f);

            var kernelCount  = B.ColCount * A.NonZeroCount;
            var dim          = ComputeBlocksTreads(kernelCount);
            var colcountA    = A.ColCount;
            var transposeInt = transposeA ? 1 : 0;

            Gpu.Launch(dim.Item1, dim.Item2).MultiplySparseGPU2(
                kernelCount,
                A.GPUIndices,
                A.GPUValues,
                A.NonZeroCount,
                colcountA,
                B.GPUArray,
                B.ColCount,
                C.GPUArray,
                transposeInt
                );
            return;
        }
Esempio n. 4
0
        public void MultiplySparse(CpuGpuMatrixSparse A, CpuGpuArray B, CpuGpuArray C, bool transposeA)
        {
            FillArray(C, 0f);

            var kernelCount = B.ColCount * A.NonZeroCount;
            var dim = ComputeBlocksTreads(kernelCount);
            var colcountA = A.ColCount;
            var transposeInt = transposeA ? 1 : 0;
            Gpu.Launch(dim.Item1, dim.Item2).MultiplySparseGPU2(
                kernelCount,
                A.GPUIndices,
                A.GPUValues,
                A.NonZeroCount,
                colcountA,
                B.GPUArray,
                B.ColCount,
                C.GPUArray,
                transposeInt
            );
            return;
        }