Пример #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && !_disposed)
     {
         _blas.Dispose();
         _cuda.Dispose();
         //if(_solver.IsValueCreated)
         //    _solver.Value.Dispose();
         _numerics.Dispose();
         _disposed = true;
     }
 }
Пример #2
0
        public void _MatrixMultiplication(int rowsA, int columnsArowsB, int columnsB)
        {
            var rand = new Random(1);
            var a    = _cpu.
                       CreateMatrix(rowsA, columnsArowsB, (j, k) => Convert.ToSingle(rand.NextDouble())).
                       AsIndexable();
            var b = _cpu.
                    CreateMatrix(columnsArowsB, columnsB, (j, k) => Convert.ToSingle(rand.NextDouble())).
                    AsIndexable();
            var cpuResults = a.Multiply(b);
            IIndexableMatrix gpuResults;

            using (var gpuA = _cuda.CreateMatrix(a))
            {
                using var gpuB = _cuda.CreateMatrix(b);
                using var gpuC = gpuA.Multiply(gpuB);
                gpuResults     = gpuC.AsIndexable();
            }

            FloatingPointHelper.AssertEqual(gpuResults, cpuResults.AsIndexable());
            _cuda.Dispose();
        }
Пример #3
0
 public static void Cleanup()
 {
     _cuda.Dispose();
     _cpu.Dispose();
 }
Пример #4
0
 public static void Cleanup() => _lap.Dispose();
Пример #5
0
 public static void Cleanup() => _cpu.Dispose();
Пример #6
0
 private static void Cleanup()
 {
     _cuda.Dispose();
     _cpu.Dispose();
 }